34 static constexpr uint8_t EI_OSABI = 7;
35 static constexpr uint8_t EI_ABIVERSION = 8;
36 static constexpr uint8_t EI_CLASS = 4;
37 static constexpr uint8_t EI_DATA = 5;
39 static constexpr uint8_t ELFCLASSNONE = 0;
40 static constexpr uint8_t ELFCLASS32 = 1;
41 static constexpr uint8_t ELFCLASS64 = 2;
43 static constexpr uint8_t ELFDATANONE = 0;
44 static constexpr uint8_t ELFDATA2LSB = 1;
45 static constexpr uint8_t ELFDATA2MSB = 2;
47 static constexpr uint8_t EV_NONE = 0;
48 static constexpr uint8_t EV_CURRENT = 1;
50 static constexpr uint8_t ELFOSABI_NONE = 0;
52 static constexpr offset_t SHF_WRITE = 0x0001;
53 static constexpr offset_t SHF_ALLOC = 0x0002;
54 static constexpr offset_t SHF_EXECINSTR = 0x0004;
55 static constexpr offset_t SHF_MERGE = 0x0010;
56 static constexpr offset_t SHF_STRINGS = 0x0020;
57 static constexpr offset_t SHF_INFO_LINK = 0x0040;
58 static constexpr offset_t SHF_LINK_ORDER = 0x0080;
59 static constexpr offset_t SHF_OS_NONCONFORMING = 0x0100;
60 static constexpr offset_t SHF_GROUP = 0x0200;
61 static constexpr offset_t SHF_TLS = 0x0400;
62 static constexpr offset_t SHF_COMPRESSED = 0x0800;
64 static constexpr offset_t SHF_GNU_RETAIN = 0x00200000;
65 static constexpr offset_t SHF_GNU_MBIND = 0x01000000;
66 static constexpr offset_t SHF_EXCLUDE = 0x80000000;
68 static constexpr offset_t SHF_BEGIN = 0x01000000;
69 static constexpr offset_t SHF_END = 0x02000000;
71 static constexpr uint16_t SHN_UNDEF = 0;
72 static constexpr uint16_t SHN_LORESERVE = 0xFF00;
73 static constexpr uint16_t SHN_ABS = 0xFFF1;
74 static constexpr uint16_t SHN_COMMON = 0xFFF2;
75 static constexpr uint16_t SHN_XINDEX = 0xFFFF;
77 static constexpr uint8_t STB_LOCAL = 0;
78 static constexpr uint8_t STB_GLOBAL = 1;
79 static constexpr uint8_t STB_WEAK = 2;
80 static constexpr uint8_t STB_ENTRY = 12;
82 static constexpr uint8_t STT_NOTYPE = 0;
83 static constexpr uint8_t STT_OBJECT = 1;
84 static constexpr uint8_t STT_FUNC = 2;
85 static constexpr uint8_t STT_SECTION = 3;
86 static constexpr uint8_t STT_FILE = 4;
87 static constexpr uint8_t STT_COMMON = 5;
88 static constexpr uint8_t STT_TLS = 6;
89 static constexpr uint8_t STT_IMPORT = 11;
91 static constexpr uint8_t STV_DEFAULT = 0;
92 static constexpr uint8_t STV_INTERNAL = 1;
93 static constexpr uint8_t STV_HIDDEN = 2;
94 static constexpr uint8_t STV_PROTECTED = 3;
96 static constexpr offset_t R_386_8 = 22;
97 static constexpr offset_t R_386_PC8 = 23;
98 static constexpr offset_t R_386_16 = 20;
99 static constexpr offset_t R_386_PC16 = 21;
100 static constexpr offset_t R_386_32 = 1;
101 static constexpr offset_t R_386_PC32 = 2;
102 static constexpr offset_t R_386_GOT32 = 3;
103 static constexpr offset_t R_386_GOTPC = 10;
104 static constexpr offset_t R_386_GOTOFF = 9;
105 static constexpr offset_t R_386_PLT32 = 4;
119 static constexpr offset_t R_X86_64_8 = 14;
120 static constexpr offset_t R_X86_64_PC8 = 15;
121 static constexpr offset_t R_X86_64_16 = 12;
122 static constexpr offset_t R_X86_64_PC16 = 13;
123 static constexpr offset_t R_X86_64_32 = 10;
124 static constexpr offset_t R_X86_64_32S = 11;
125 static constexpr offset_t R_X86_64_PC32 = 2;
126 static constexpr offset_t R_X86_64_PLT32 = 4;
127 static constexpr offset_t R_X86_64_64 = 1;
128 static constexpr offset_t R_X86_64_PC64 = 24;
130 static constexpr offset_t R_68K_8 = 3;
131 static constexpr offset_t R_68K_PC8 = 6;
132 static constexpr offset_t R_68K_16 = 2;
133 static constexpr offset_t R_68K_PC16 = 5;
134 static constexpr offset_t R_68K_32 = 1;
135 static constexpr offset_t R_68K_PC32 = 4;
136 static constexpr offset_t R_68K_GOT8 = 9;
137 static constexpr offset_t R_68K_GOT8O = 12;
138 static constexpr offset_t R_68K_GOT16 = 8;
139 static constexpr offset_t R_68K_GOT16O = 11;
140 static constexpr offset_t R_68K_GOT32 = 7;
141 static constexpr offset_t R_68K_GOT32O = 10;
142 static constexpr offset_t R_68K_PLT8 = 15;
143 static constexpr offset_t R_68K_PLT8O = 18;
144 static constexpr offset_t R_68K_PLT16 = 14;
145 static constexpr offset_t R_68K_PLT16O = 17;
146 static constexpr offset_t R_68K_PLT32 = 13;
147 static constexpr offset_t R_68K_PLT32O = 16;
149 static constexpr offset_t R_ARM_ABS8 = 8;
150 static constexpr offset_t R_ARM_ABS16 = 16;
151 static constexpr offset_t R_ARM_ABS32 = 2;
152 static constexpr offset_t R_ARM_REL32 = 3;
153 static constexpr offset_t R_ARM_CALL = 28;
154 static constexpr offset_t R_ARM_JUMP24 = 29;
155 static constexpr offset_t R_ARM_PC24 = 1;
156 static constexpr offset_t R_ARM_V4BX = 40;
158 static constexpr offset_t R_PPC_ADDR14 = 7;
159 static constexpr offset_t R_PPC_ADDR14_BRTAKEN = 8;
160 static constexpr offset_t R_PPC_ADDR14_BRNTAKEN = 9;
161 static constexpr offset_t R_PPC_REL14 = 11;
162 static constexpr offset_t R_PPC_REL14_BRTAKEN = 12;
163 static constexpr offset_t R_PPC_REL14_BRNTAKEN = 13;
164 static constexpr offset_t R_PPC_ADDR16 = 3;
165 static constexpr offset_t R_PPC_UADDR16 = 25;
166 static constexpr offset_t R_PPC_ADDR16_LO = 4;
167 static constexpr offset_t R_PPC_ADDR16_HI = 5;
168 static constexpr offset_t R_PPC_ADDR16_HA = 6;
169 static constexpr offset_t R_PPC_ADDR24 = 2;
170 static constexpr offset_t R_PPC_REL24 = 10;
171 static constexpr offset_t R_PPC_ADDR30 = 37;
172 static constexpr offset_t R_PPC_ADDR32 = 1;
173 static constexpr offset_t R_PPC_UADDR32 = 24;
174 static constexpr offset_t R_PPC_REL32 = 26;
175 static constexpr offset_t R_PPC64_ADDR64 = 38;
176 static constexpr offset_t R_PPC64_UADDR64 = 43;
177 static constexpr offset_t R_PPC64_REL64 = 44;
180 static constexpr offset_t R_VAX_8 = 3;
181 static constexpr offset_t R_VAX_PC8 = 6;
182 static constexpr offset_t R_VAX_16 = 2;
183 static constexpr offset_t R_VAX_PC16 = 5;
184 static constexpr offset_t R_VAX_32 = 1;
185 static constexpr offset_t R_VAX_PC32 = 4;
186 static constexpr offset_t R_VAX_GOT32 = 7;
187 static constexpr offset_t R_VAX_PLT32 = 13;
189 static constexpr offset_t R_Z80_8 = 1;
190 static constexpr offset_t R_Z80_8_DIS = 2;
191 static constexpr offset_t R_Z80_8_PCREL = 3;
192 static constexpr offset_t R_Z80_16 = 4;
193 static constexpr offset_t R_Z80_24 = 5;
194 static constexpr offset_t R_Z80_32 = 6;
196 static constexpr offset_t DT_NULL = 0;
197 static constexpr offset_t DT_NEEDED = 1;
198 static constexpr offset_t DT_PLTRELSZ = 2;
199 static constexpr offset_t DT_PLTGOT = 3;
200 static constexpr offset_t DT_HASH = 4;
201 static constexpr offset_t DT_STRTAB = 5;
202 static constexpr offset_t DT_SYMTAB = 6;
203 static constexpr offset_t DT_RELA = 7;
204 static constexpr offset_t DT_RELASZ = 8;
205 static constexpr offset_t DT_RELAENT = 9;
206 static constexpr offset_t DT_STRSZ = 10;
207 static constexpr offset_t DT_SYMENT = 11;
208 static constexpr offset_t DT_INIT = 12;
209 static constexpr offset_t DT_FINI = 13;
210 static constexpr offset_t DT_SONAME = 14;
211 static constexpr offset_t DT_RPATH = 15;
212 static constexpr offset_t DT_SYMBOLIC = 16;
213 static constexpr offset_t DT_REL = 17;
214 static constexpr offset_t DT_RELSZ = 18;
215 static constexpr offset_t DT_RELENT = 19;
216 static constexpr offset_t DT_PLTREL = 20;
217 static constexpr offset_t DT_DEBUG = 21;
218 static constexpr offset_t DT_TEXTREL = 22;
219 static constexpr offset_t DT_JMPREL = 23;
220 static constexpr offset_t DT_BIND_NOW = 24;
221 static constexpr offset_t DT_INIT_ARRAY = 25;
222 static constexpr offset_t DT_FINI_ARRAY = 26;
223 static constexpr offset_t DT_INIT_ARRAYSZ = 27;
224 static constexpr offset_t DT_FINI_ARRAYSZ = 28;
225 static constexpr offset_t DT_RUNPATH = 29;
226 static constexpr offset_t DT_FLAGS = 30;
227 static constexpr offset_t DT_ENCODING = 31;
228 static constexpr offset_t DT_PREINIT_ARRAY = 32;
229 static constexpr offset_t DT_PREINIT_ARRAYSZ = 33;
230 static constexpr offset_t DT_SYMTAB_SHNDX = 34;
231 static constexpr offset_t DT_RELRSZ = 35;
232 static constexpr offset_t DT_RELR = 36;
233 static constexpr offset_t DT_RELRENT = 37;
235 static constexpr offset_t DT_EXPORT = 0x60000001;
236 static constexpr offset_t DT_EXPORTSZ = 0x60000002;
237 static constexpr offset_t DT_EXPENT = 0x60000003;
238 static constexpr offset_t DT_IMPORT = 0x60000004;
239 static constexpr offset_t DT_IMPORTSZ = 0x60000005;
240 static constexpr offset_t DT_IMPENT = 0x60000006;
241 static constexpr offset_t DT_IT = 0x60000007;
242 static constexpr offset_t DT_ITPRTY = 0x60000008;
243 static constexpr offset_t DT_INITTERM = 0x60000009;
244 static constexpr offset_t DT_STACKSZ = 0x6000000A;
246 static constexpr offset_t DT_GNU_FLAGS1 = 0x6FFFFDF4;
247 static constexpr offset_t DT_GNU_PRELINKED = 0x6FFFFDF5;
248 static constexpr offset_t DT_GNU_CONFLICTSZ = 0x6FFFFDF6;
249 static constexpr offset_t DT_GNU_LIBLISTSZ = 0x6FFFFDF7;
250 static constexpr offset_t DT_CHECKSUM = 0x6FFFFDF8;
251 static constexpr offset_t DT_PLTPADSZ = 0x6FFFFDF9;
252 static constexpr offset_t DT_MOVEENT = 0x6FFFFDFA;
253 static constexpr offset_t DT_MOVESZ = 0x6FFFFDFB;
254 static constexpr offset_t DT_FEATURE = 0x6FFFFDFC;
255 static constexpr offset_t DT_POSTFLAG_1 = 0x6FFFFDFD;
256 static constexpr offset_t DT_SYMINSZ = 0x6FFFFDFE;
257 static constexpr offset_t DT_SYMINENT = 0x6FFFFDFF;
258 static constexpr offset_t DT_GNU_HASH = 0x6FFFFEF5;
259 static constexpr offset_t DT_TLSDESC_PLT = 0x6FFFFEF6;
260 static constexpr offset_t DT_TLSDESC_GOT = 0x6FFFFEF7;
261 static constexpr offset_t DT_GNU_CONFLICT = 0x6FFFFFEF8;
262 static constexpr offset_t DT_GNU_LIBLIST = 0x6FFFFEF9;
263 static constexpr offset_t DT_CONFIG = 0x6FFFFEFA;
264 static constexpr offset_t DT_DEPAUDIT = 0x6FFFFEFB;
265 static constexpr offset_t DT_AUDIT = 0x6FFFFEFC;
266 static constexpr offset_t DT_PLTPAD = 0x6FFFFEFD;
267 static constexpr offset_t DT_MOVETAB = 0x6FFFFEFE;
268 static constexpr offset_t DT_SYMINFO = 0x6FFFFEFF;
269 static constexpr offset_t DT_VERSYM = 0x6FFFFFF0;
270 static constexpr offset_t DT_RELACOUNT = 0x6FFFFFF9;
271 static constexpr offset_t DT_RELCOUNT = 0x6FFFFFFA;
272 static constexpr offset_t DT_FLAGS_1 = 0x6FFFFFFB;
273 static constexpr offset_t DT_VERDEF = 0x6FFFFFFC;
274 static constexpr offset_t DT_VERDEFNUM = 0x6FFFFFFD;
275 static constexpr offset_t DT_VERNEED = 0x6FFFFFFE;
276 static constexpr offset_t DT_VERNEEDNUM = 0x6FFFFFFF;
277 static constexpr offset_t DT_AUXILIARY = 0x7FFFFFFD;
278 static constexpr offset_t DT_USED = 0x7FFFFFFE;
279 static constexpr offset_t DT_FILTER = 0x7FFFFFFFF;
281 offset_t file_offset = 0;
283 uint8_t file_class = 0;
284 EndianType endiantype = ::LittleEndian;
286 uint8_t data_encoding = 0;
287 size_t wordbytes = 4;
373 EM_ARC_A5 = EM_ARC_COMPACT,
395 EM_ALTERA_NIOS32 = 113,
412 EM_LATTICEMICO32 = 138,
421 EM_CYPRESS_M8C = 161,
429 EM_ECOG1X = EM_ECOG1,
436 EM_MCST_ELBRUS = 175,
453 EM_CLOUDSHIELD = 192,
456 EM_ARC_COMPACT2 = 195,
480 EM_CSR_KALIMBA = 219,
493 EM_GRAPHCORE_IPU = 248,
498 EM_ARC_COMPACT3_64 = 253,
500 EM_ARC_COMPACT3 = 255,
515 cpu_type cpu = EM_NONE;
517 uint8_t header_version = 0;
519 uint8_t abi_version = 0;
529 file_type object_file_type = ET_NONE;
530 uint16_t file_version = 0;
533 offset_t program_header_offset = 0;
534 offset_t section_header_offset = 0;
536 uint16_t elf_header_size = 0;
537 uint16_t program_header_entry_size = 0;
538 uint16_t section_header_entry_size = 0;
539 uint32_t section_name_string_table = 0;
544 virtual void AddDumperFields(std::unique_ptr<Dumper::Region>& region,
Dumper::Dumper& dump,
const ELFFormat& fmt,
unsigned index)
const;
551 uint32_t name_offset = 0;
553 offset_t value = 0, size = 0;
554 uint8_t bind = 0, type = 0, other = 0;
556 uint32_t sh_link = 0;
557 bool defined =
false;
558 bool unallocated =
false;
569 std::vector<Symbol> symbols;
572 : wordbytes(wordbytes), entsize(entsize)
577 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
586 std::vector<std::string> strings;
594 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
603 std::vector<offset_t> array;
605 Array(offset_t entsize)
611 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
626 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
628 void AddDumperFields(std::unique_ptr<Dumper::Region>& region,
Dumper::Dumper& dump,
const ELFFormat& fmt,
unsigned index)
const override;
649 uint32_t sh_link = 0, sh_info = 0;
650 bool addend_from_section_data =
false;
652 size_t GetSize(cpu_type cpu)
const;
653 std::string GetName(cpu_type cpu)
const;
662 std::vector<Relocation> relocations;
665 : wordbytes(wordbytes), entsize(entsize)
670 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
677 std::vector<uint32_t> buckets;
678 std::vector<uint32_t> chains;
680 static uint32_t Hash(
const std::string& name);
683 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
685 void AddDumperFields(std::unique_ptr<Dumper::Region>& region,
Dumper::Dumper& dump,
const ELFFormat& fmt,
unsigned index)
const override;
701 : tag(tag), value(value)
712 std::vector<DynamicObject> dynamic;
715 : wordbytes(wordbytes), entsize(entsize)
720 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
728 std::string descriptor;
738 std::vector<Note> notes;
746 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
759 uint32_t name_offset = 0;
761 uint32_t offset_next_entry = 0;
764 uint16_t version = 0;
765 uint32_t file_name_offset = 0;
766 std::string file_name;
767 uint32_t offset_auxiliary_array = 0;
768 std::vector<Auxiliary> auxiliary_array;
769 uint32_t offset_next_entry = 0;
775 std::vector<VersionRequirement> requirements;
778 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
786 enum system_type : uint32_t
794 system_type os_type = EOS_NONE;
795 uint32_t os_size = 0;
796 bool IsOS2Specific()
const;
800 enum os2_session : uint8_t
807 os2_session sessiontype = OS2_SES_NONE;
808 uint8_t sessionflags;
811 std::vector<uint8_t> os_specific;
814 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
815 void AddDumperFields(std::unique_ptr<Dumper::Region>& region,
Dumper::Dumper& dump,
const ELFFormat& fmt,
unsigned index)
const override;
822 uint32_t ordinal = 0, name_offset = 0;
830 import_type type = IMP_IGNORED;
832 std::string dll_name;
840 std::vector<IBMImportEntry> imports;
848 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
856 uint32_t ordinal = 0, symbol_index = 0, name_offset = 0;
858 uint32_t sh_link = 0, sh_info = 0;
866 std::vector<IBMExportEntry> exports;
874 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
883 uint32_t ordinal = 0;
884 uint32_t name_offset = 0;
886 uint32_t data_offset = 0;
887 uint32_t data_size = 0;
888 std::shared_ptr<Linker::Contents> data;
902 uint16_t version = 0;
904 uint32_t name_offset = 0;
906 uint32_t item_array_offset = 0;
907 uint32_t item_array_entry_size = 0;
908 uint32_t header_size = 0;
909 uint32_t string_table_offset = 0;
910 uint32_t locale_offset = 0;
912 char16_t country[2] = { };
913 char16_t language[2] = { };
915 std::vector<IBMResource> resources;
918 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
920 void AddDumperFields(std::unique_ptr<Dumper::Region>& region,
Dumper::Dumper& dump,
const ELFFormat& fmt,
unsigned index)
const override;
925 class IBMResourceFile
928 uint8_t file_class = 0;
929 EndianType endiantype = ::LittleEndian;
931 uint8_t data_encoding = 0;
932 size_t wordbytes = 4;
936 uint32_t header_size = 0;
937 uint32_t resource_collection_offset = 0;
938 std::vector<IBMResourceCollection> resource_collections;
945 uint32_t name_offset = 0;
963 SHT_PREINIT_ARRAY = 16,
965 SHT_SYMTAB_SHNDX = 18,
968 SHT_IMPORTS = 0x60000002,
969 SHT_EXPORTS = 0x60000003,
970 SHT_RES = 0x60000004,
973 SHT_OLD_IMPORTS = 13,
974 SHT_OLD_EXPORTS = 14,
978 SHT_GNU_INCREMENTAL_INPUTS = 0x6FFF4700,
979 SHT_GNU_ATTRIBUTES = 0x6FFFFFF5,
980 SHT_GNU_HASH = 0x6FFFFFF6,
981 SHT_GNU_LIBLIST = 0x6FFFFFF7,
982 SHT_SUNW_verdef = 0x6FFFFFFD,
983 SHT_SUNW_verneed = 0x6FFFFFFE,
984 SHT_SUNW_versym = 0x6FFFFFFF,
986 section_type type = SHT_NULL;
987 uint32_t link = 0, info = 0;
989 offset_t address = 0, file_offset = 0, size = 0, align = 0, entsize = 0;
991 std::shared_ptr<Linker::Contents> contents;
993 std::shared_ptr<Linker::Section> GetSection();
994 const std::shared_ptr<Linker::Section> GetSection()
const;
996 std::shared_ptr<SymbolTable> GetSymbolTable();
997 const std::shared_ptr<SymbolTable> GetSymbolTable()
const;
1000 std::shared_ptr<StringTable> GetStringTable();
1002 std::shared_ptr<Array> GetArray();
1004 std::shared_ptr<Relocations> GetRelocations();
1005 const std::shared_ptr<Relocations> GetRelocations()
const;
1007 std::shared_ptr<DynamicSection> GetDynamicSection();
1010 std::shared_ptr<NotesSection> GetNotesSection();
1012 std::shared_ptr<IBMSystemInfo> GetIBMSystemInfo();
1015 std::shared_ptr<IBMImportTable> GetIBMImportTable();
1016 std::shared_ptr<IBMExportTable> GetIBMExportTable();
1018 bool GetFileSize()
const;
1022 static std::shared_ptr<Linker::Section> ReadProgBits(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset,
const std::string& name, offset_t size);
1023 static std::shared_ptr<Linker::Section> ReadNoBits(
const std::string& name, offset_t size);
1024 static std::shared_ptr<SymbolTable> ReadSymbolTable(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_size, offset_t entsize, uint32_t section_link,
size_t wordbytes);
1025 static std::shared_ptr<Relocations> ReadRelocations(
const std::shared_ptr<Linker::Reader>& rd, Section::section_type type, offset_t file_offset, offset_t section_size, offset_t entsize, uint32_t section_link, uint32_t section_info,
size_t wordbytes);
1026 static std::shared_ptr<StringTable> ReadStringTable(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_size);
1027 static std::shared_ptr<Array> ReadArray(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_size, offset_t entsize);
1028 static std::shared_ptr<SectionGroup> ReadSectionGroup(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_size, offset_t entsize);
1029 static std::shared_ptr<IndexArray> ReadIndexArray(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_size, offset_t entsize);
1030 static std::shared_ptr<HashTable> ReadHashTable(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset);
1031 static std::shared_ptr<DynamicSection> ReadDynamic(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_size, offset_t entsize,
size_t wordbytes);
1032 static std::shared_ptr<NotesSection> ReadNote(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_size);
1033 static std::shared_ptr<VersionRequirements> ReadVersionRequirements(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_link, offset_t section_info);
1034 static std::shared_ptr<IBMSystemInfo> ReadIBMSystemInfo(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset);
1035 static std::shared_ptr<IBMImportTable> ReadIBMImportTable(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_size, offset_t entsize);
1036 static std::shared_ptr<IBMExportTable> ReadIBMExportTable(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset, offset_t section_size, offset_t entsize);
1037 static std::shared_ptr<IBMResourceCollection> ReadIBMResourceCollection(
const std::shared_ptr<Linker::Reader>& rd, offset_t file_offset);
1039 std::vector<Section> sections;
1056 PT_RES = 0x60000002,
1061 PT_SUNW_EH_FRAME = 0x6474E550,
1062 PT_GNU_STACK = 0x6474E551,
1063 PT_GNU_RELRO = 0x6474E552,
1064 PT_GNU_PROPERTY = 0x6474E553,
1065 PT_GNU_SFRAME = 0x6474E554,
1066 PT_GNU_MBIND_LO = 0x6474E555,
1067 PT_GNU_MBIND_HI = 0x6474F554,
1068 PT_OPENBSD_MUTABLE = 0x65A3DBE5,
1069 PT_OPENBSD_RANDOMIZE = 0x65A3DBE6,
1070 PT_OPENBSD_WXNEEDED = 0x65A3DBE7,
1071 PT_OPENBSD_NOBTCFI = 0x65A3DBE8,
1072 PT_OPENBSD_BOOTDATA = 0x65A41BE6,
1085 offset_t offset = 0, vaddr = 0, paddr = 0, filesz = 0, memsz = 0, align = 0;
1100 offset_t offset, size;
1101 Part(
part_type type, uint32_t index, offset_t offset, offset_t size)
1102 : type(type), index(index), offset(offset), size(size)
1106 offset_t GetOffset(
const ELFFormat& fmt)
const;
1107 offset_t GetActualSize(
const ELFFormat& fmt)
const;
1110 std::vector<Part> parts;
1112 std::vector<Segment> segments;
1117 offset_t offset = 0;
1119 std::shared_ptr<Linker::Contents> image;
1120 Block(offset_t offset = 0, offset_t size = 0)
1121 : offset(offset), size(size)
1137 offset_t unknown1, offset, size, unknown2;
1138 std::shared_ptr<Linker::Buffer> image;
1140 offset_t hobbit_beos_resource_offset = 0;
1141 std::vector<HobbitBeOSResource> hobbit_beos_resources;
1147 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
1150 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
1161 bool option_16bit =
true;
1162 bool option_linear =
false;
1171 bool option_absolute_symbols =
false;
1174 void SetupOptions(std::shared_ptr<Linker::OutputFormat> format)
override;
1182 enum operating_system_type
1190 operating_system_type operating_system = Linux;
1192 offset_t image_base;
1193 offset_t header_size;
1194 bool create_header_segment;
1195 bool include_header_segment;
1196 offset_t segment_align;
1197 offset_t section_align;
1220 static std::vector<Linker::OptionDescription<void> *> ParameterNames;
1222 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
1224 void SetOptions(std::map<std::string, std::string>& options)
override;
1225 void OnNewSegment(std::shared_ptr<Linker::Segment> segment)
override;