mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 23:13:34 +00:00
0c630d95b5
The build/bootstrap/ar.com program is now tinier. This change reduces its size from 140kb to 53kb. Nothing was traded away. Cosmopolitan Ar performance is now 2x better than llvm-ar largely thanks to using the copy_file_range() system call. This change homebrews a new allocation API that addresses the shortcomings of the C standard library design. Using these new balloc() and reballoc() functions I managed to reduce memory consumption so much that Cosmpolitan Ar should now use roughly 100x fewer bytes of peak resident memory compared to llvm-ar. Correct behavior with better compatibility has been assured. Binary output is now pretty much bit-identical to llvm-ar, as of this change. This can and should be the living proof we need to show that a better world is possible for software.
58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
#ifndef COSMOPOLITAN_LIBC_ELF_STRUCT_RELA_H_
|
|
#define COSMOPOLITAN_LIBC_ELF_STRUCT_RELA_H_
|
|
#include "libc/elf/scalar.h"
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
/*
|
|
* ELF relocation w/ explicit addend.
|
|
*
|
|
* Relocations let us easily apply fixups to compiled object code. This
|
|
* data structure represents the contents of an `sh_type` w/ `SHT_RELA`
|
|
*
|
|
* @see Elf64_Rel
|
|
*/
|
|
typedef struct Elf64_Rela {
|
|
|
|
/*
|
|
* Location to be modified.
|
|
*
|
|
* If `e_type` is `ET_REL` then this is a section data byte offset.
|
|
*
|
|
* If `e_type` isn't `ET_REL` then this is a virtual address.
|
|
*/
|
|
Elf64_Addr r_offset;
|
|
|
|
/*
|
|
* Relocation type and symbol.
|
|
*
|
|
* This value may be created using:
|
|
*
|
|
* r_info = ELF64_R_INFO(sym, type);
|
|
*
|
|
* This value may be read using:
|
|
*
|
|
* Elf64_Word sym = ELF64_R_SYM(r_info);
|
|
* Elf64_Word type = ELF64_R_TYPE(r_info);
|
|
*
|
|
* Where `sym` is a symbol index, and `type` might be:
|
|
*
|
|
* - `R_X86_64_64`
|
|
* - `R_X86_64_PC32`
|
|
* - `R_X86_64_GOTPCRELX`
|
|
* - `R_AARCH64_ABS64`
|
|
*
|
|
*/
|
|
Elf64_Xword r_info;
|
|
|
|
/*
|
|
* Relocation parameter.
|
|
*
|
|
* Each relocation type has its own mathematical formula, which should
|
|
* incorporate this value in its own unique way.
|
|
*/
|
|
Elf64_Sxword r_addend;
|
|
|
|
} Elf64_Rela;
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_ELF_STRUCT_RELA_H_ */
|