RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
aout.h
1#ifndef AOUT_H
2#define AOUT_H
3
4#include "mzexe.h"
5#include "../common.h"
6#include "../dumper/dumper.h"
7#include "../linker/module.h"
8#include "../linker/options.h"
9#include "../linker/segment.h"
10#include "../linker/segment_manager.h"
11#include "../linker/writer.h"
12
13namespace AOut
14{
47 class AOutFormat : public virtual Linker::InputFormat, public virtual Linker::SegmentManager
48 {
49 public:
50 /* * * General members * * */
51 ::EndianType endiantype = ::UndefinedEndian;
52
57 {
98 LINUX, /* TODO: not fully supported */
104 FREEBSD, /* TODO */
110 NETBSD, /* TODO */
127 };
128
129 static constexpr system_type DEFAULT = system_type(-1);
130
135
140 {
142 OMAGIC = 0x0107,
145
147 NMAGIC = 0x0108,
152
154 ZMAGIC = 0x010B,
157
159 QMAGIC = 0x00CC,
162
163 // PDP-11 specific
164
166 MAGIC_V1 = 0x0105 | 0xFFFF0000,
167
170
172 IMAGIC = 0x0109,
173 MAGIC_SEPARATE = IMAGIC,
174
177
180 };
185
193 {
194 switch(system)
195 {
196 case UNIX_V1_V2:
197 return MAGIC_V1;
198 case UNIX:
199 case SYSTEM_V:
200 case UNSPECIFIED: // TODO: which should we pick?
201 return OMAGIC;
202 case BSD:
203 case LINUX: // TODO: check default
204 case FREEBSD: // TODO: check default
205 case NETBSD: // TODO: check default
206 return ZMAGIC;
207 case DJGPP1:
208 case EMX:
209 return ZMAGIC;
210 case PDOS386:
211 return OMAGIC;
212 }
213 return OMAGIC; // TODO: make sure it is the same as UNSPECIFIED
214 }
215
220 ::EndianType midmag_endiantype;
221
222 protected:
225 {
226 }
227
228 public:
229 AOutFormat()
231 {
232 }
233
235 uint16_t mid_value = 0;
236
238 uint8_t flags = 0;
239
240 static constexpr uint16_t MID_UNKNOWN = 0x000;
241 static constexpr uint16_t MID_68010 = 0x001;
242 static constexpr uint16_t MID_68020 = 0x002;
243 static constexpr uint16_t MID_PC386 = 0x064; // mentioned for Linux and NetBSD
244 static constexpr uint16_t MID_I386 = 0x086; // mentioned for FreeBSD and NetBSD
245 static constexpr uint16_t MID_ARM6 = 0x08F; // mentioned for FreeBSD and NetBSD
246 static constexpr uint16_t MID_MIPS1 = 0x097; // mentioned for Linux and NetBSD
247 static constexpr uint16_t MID_MIPS2 = 0x098; // mentioned for Linux and NetBSD
248 static constexpr uint16_t MID_HP200 = 0x0C8; // mentioned for FreeBSD and NetBSD
249 static constexpr uint16_t MID_HP300 = 0x12C; // mentioned for FreeBSD and NetBSD
250 static constexpr uint16_t MID_HPUX800 = 0x20B; // mentioned for FreeBSD and NetBSD
251 static constexpr uint16_t MID_HPUX = 0x20C; // mentioned for FreeBSD and NetBSD
252
253 // according to a.out.h
254 static constexpr uint16_t MID_LINUX_OLDSUN2 = 0x000;
255 static constexpr uint16_t MID_LINUX_SPARC = 0x003;
256
257 // according to imgact_aout.h
258 static constexpr uint16_t MID_FREEBSD_SPARC = 0x08C;
259
260 // according to aout_mids.h
261 static constexpr uint16_t MID_NETBSD_M68K = 0x087;
262 static constexpr uint16_t MID_NETBSD_M68K4K = 0x088;
263 static constexpr uint16_t MID_NETBSD_NS32532K = 0x089;
264 static constexpr uint16_t MID_NETBSD_SPARC = 0x08A;
265 static constexpr uint16_t MID_NETBSD_PMAX = 0x08B;
266 static constexpr uint16_t MID_NETBSD_VAX1K = 0x08C;
267 static constexpr uint16_t MID_NETBSD_ALPHA = 0x08D;
268 static constexpr uint16_t MID_NETBSD_MIPS = 0x08E;
269 static constexpr uint16_t MID_NETBSD_M680002K = 0x090;
270 static constexpr uint16_t MID_NETBSD_SH3 = 0x091;
271 static constexpr uint16_t MID_NETBSD_POWERPC64 = 0x094;
272 static constexpr uint16_t MID_NETBSD_POWERPC = 0x095;
273 static constexpr uint16_t MID_NETBSD_VAX = 0x096;
274 static constexpr uint16_t MID_NETBSD_M88K = 0x099;
275 static constexpr uint16_t MID_NETBSD_HPPA = 0x09A;
276 static constexpr uint16_t MID_NETBSD_SH5_64 = 0x09B;
277 static constexpr uint16_t MID_NETBSD_SPARC64 = 0x09C;
278 static constexpr uint16_t MID_NETBSD_X86_64 = 0x09D;
279 static constexpr uint16_t MID_NETBSD_SH5_32 = 0x09E;
280 static constexpr uint16_t MID_NETBSD_IA64 = 0x09F;
281 static constexpr uint16_t MID_NETBSD_AARCH64 = 0x0B7;
282 static constexpr uint16_t MID_NETBSD_OR1K = 0x0B8;
283 static constexpr uint16_t MID_NETBSD_RISCV = 0x0B9;
284
285 static constexpr uint16_t MID_BFD_ARM = 0x067;
286
288 {
295 };
296
299
301 constexpr uint32_t GetHeaderSize() const
302 {
303 switch(magic)
304 {
305 case MAGIC_V1:
306 return word_size * 6;
309 return word_size * (8 + 16);
310 default:
311 return std::min(4, int(word_size)) + 7 * word_size;
312 }
313 }
314
315 constexpr offset_t GetRelocationSize() const
316 {
317 switch(word_size)
318 {
319 case WordSize16:
320 // TODO: MAGIC_V1 has different format
321 return 2;
322 default:
323 return word_size + 4;
324 }
325 }
326
327 enum cpu_type
328 {
329 UNKNOWN,
330 M68K,
331 SPARC,
332 SPARC64,
333 I386,
334 AMD64,
335 ARM,
336 AARCH64,
337 MIPS,
338 PARISC,
339 PDP11,
340 NS32K,
341 VAX,
342 ALPHA,
343 SUPERH,
344 SUPERH64,
345 PPC,
346 PPC64,
347 M88K,
348 IA64,
349 OR1K,
350 RISCV,
351 SYS360,
352 SYS390_64,
353 };
354 cpu_type cpu = UNKNOWN;
355
357 ::EndianType GetEndianType() const;
358
360 word_size_t GetWordSize() const;
361
362 uint32_t code_size = 0;
363 uint32_t data_size = 0;
364 uint32_t bss_size = 0;
365 uint32_t symbol_table_size = 0;
366 uint32_t entry_address = 0;
367 // only for 16-bit format
368 uint16_t reserved = 0;
369 uint16_t relocations_suppressed = 0;
370 // only for 32-bit format
371 uint32_t code_relocation_size = 0;
372 uint32_t data_relocation_size = 0;
373 // AT&T specifi
374 uint16_t environment_stamp = 0;
375
380 {
381 public:
383 uint32_t address = 0;
385 uint32_t symbol = 0;
387 bool relative = false;
393 size_t size = 0;
417 uint32_t literal_entry = 0;
418
419 static Relocation ReadFile16Bit(Linker::Reader& rd, uint16_t offset);
420 void WriteFile16Bit(Linker::Writer& wr) const;
421
422 static Relocation ReadFile32Bit(Linker::Reader& rd, word_size_t word_size = WordSize32);
423 void WriteFile32Bit(Linker::Writer& wr, word_size_t word_size = WordSize32) const;
424 };
425
426 std::vector<Relocation> code_relocations, data_relocations;
427
428 std::shared_ptr<Linker::Contents> code, data, bss;
429
430 private:
431 bool AttemptFetchMagic(uint8_t signature[4]);
432
433 bool CheckFileSizes(Linker::Reader& rd, offset_t image_size);
434
435 bool AttemptReadFileWithCurrentSettings(Linker::Reader& rd, uint8_t signature[4], offset_t image_size);
436
437 struct read_attempt_type
438 {
439 word_size_t word_size;
440 ::EndianType midmag_endiantype;
441 };
442
443 bool AttemptReadFile(Linker::Reader& rd, uint8_t signature[4], offset_t image_size, read_attempt_type first_attempt)
444 {
445 return false;
446 }
447
448 template <typename ... read_attempt_types>
449 bool AttemptReadFile(Linker::Reader& rd, uint8_t signature[4], offset_t image_size, read_attempt_type first_attempt, read_attempt_types ... remaining_attempts)
450 {
451 midmag_endiantype = endiantype = first_attempt.midmag_endiantype;
452 word_size = first_attempt.word_size;
453
454 if(!AttemptReadFileWithCurrentSettings(rd, signature, image_size))
455 {
456 return AttemptReadFile(rd, signature, image_size, remaining_attempts...);
457 }
458 else
459 {
460 return true;
461 }
462 }
463
464 public:
473
474 class Symbol
475 {
476 public:
477 std::string name;
478 offset_t name_offset = 0;
479 uint32_t type_etc = 0;
480 offset_t value = 0;
481
482 enum segment_type
483 {
484 Undefined = 0,
485 Absolute = 1,
486 Text = 2,
487 Data = 3,
488 Bss = 4,
489 Common = 9,
490 Register = 20,
491 FileName = 31,
492 };
493
494 uint16_t GetTypeByte(const AOutFormat& aout) const;
495 segment_type GetType(const AOutFormat& aout) const;
496 bool IsExternal(const AOutFormat& aout) const;
497 };
498
499 std::vector<Symbol> symbols;
500
501 mutable uint32_t page_size = 0; // GetPageSize will set this if it is 0, and so it needs to be declared mutable
502
503 uint32_t GetPageSize() const;
504 uint32_t GetTextOffset() const;
505 uint32_t GetTextAddress() const;
506 uint32_t GetDataOffsetAlign() const;
507 uint32_t GetDataAddressAlign() const;
508
509 void ReadHeader(Linker::Reader& rd);
510
511 void ReadFile(Linker::Reader& rd) override;
512
513 offset_t ImageSize() const override;
514
515 void WriteHeader(Linker::Writer& wr) const;
517 offset_t WriteFile(Linker::Writer& wr) const override;
518
519 void Dump(Dumper::Dumper& dump) const override;
520
521 /* * * Reader members * * */
522
523 static std::shared_ptr<AOutFormat> CreateReader(word_size_t word_size, ::EndianType endiantype, system_type system = UNSPECIFIED);
524
526 void GenerateModule(Linker::Module& module) const override;
527
528 /* * * Writer members * * */
529
531 std::optional<offset_t> force_magic_number;
532
533 static std::shared_ptr<AOutFormat> CreateWriter(system_type system, magic_type magic);
534 static std::shared_ptr<AOutFormat> CreateWriter(system_type system);
535
538 {
539 DefaultVersion,
540 Version1,
541 Version2,
542 Version3,
543 Version4,
544 Version5,
545 Version6,
546 Version7,
547 SystemIII,
548 SystemV,
549 AnyBSD,
550 };
553
554 static constexpr bool SupportedMagicType(unix_version version, magic_type magic)
555 {
556 switch(version)
557 {
558 default:
559 return false;
560 case Version1:
561 return magic == MAGIC_V1;
562 case Version2:
563 return magic == OMAGIC;
564 case Version3:
565 case Version4:
566 case Version5:
567 return magic == OMAGIC || magic == NMAGIC;
568 case Version6:
569 return magic == OMAGIC || magic == NMAGIC || magic == MAGIC_SEPARATE;
570 case Version7:
571 case SystemIII:
572 case SystemV:
573 return magic == OMAGIC || magic == NMAGIC || magic == MAGIC_SEPARATE || magic == MAGIC_OVERLAY;
574 case AnyBSD:
575 return magic == OMAGIC || magic == NMAGIC
576 /* 16-bit only */
578 /* 32-bit only */
579 || magic == ZMAGIC;
580 case DefaultVersion:
581 return true;
582 }
583 }
584
586 {
587 public:
588 class UnixVersionEnumeration : public Linker::Enumeration<unix_version>
589 {
590 public:
592 : Enumeration(
593 "V1", Version1,
594 "V2", Version2,
595 "V3", Version3,
596 "V4", Version4,
597 "V5", Version5,
598 "V6", Version6,
599 "V7", Version7,
600 "SYSIII", SystemIII,
601 "SYS3", SystemIII,
602 "SIII", SystemIII,
603 "S3", SystemIII,
604 "SYSV", SystemV,
605 "SYS5", SystemV,
606 "SV", SystemV,
607 "S5", SystemV,
608 "BSD", AnyBSD,
609 "2.11BSD", AnyBSD,
610 "211BSD", AnyBSD,
611 "2.9BSD", AnyBSD,
612 "29BSD", AnyBSD,
613 "2BSD", AnyBSD,
614 "4.3BSD", AnyBSD,
615 "43BSD", AnyBSD,
616 "4BSD", AnyBSD)
617 {
618 descriptions = {
619 { Version1, "UNIX Version 1" },
620 { Version2, "UNIX Version 2" },
621 { Version3, "UNIX Version 3" },
622 { Version4, "UNIX Version 4" },
623 { Version5, "UNIX Version 5" },
624 { Version6, "UNIX Version 6" },
625 { Version7, "UNIX Version 7" },
626 { SystemIII, "UNIX System III" },
627 { SystemV, "UNIX System V" },
628 { AnyBSD, "2.11BSD (16-bit) or 4.3BSD (32-bit)" },
629 };
630 }
631 };
632
633 class MagicEnumeration : public Linker::Enumeration<magic_type>
634 {
635 public:
637 : Enumeration(
638 "OMAGIC", OMAGIC,
639 "IMPURE", OMAGIC,
640 "NMAGIC", NMAGIC,
641 "ROTEXT", NMAGIC,
642 "PURE", NMAGIC,
643 "ZMAGIC", ZMAGIC,
644 "DEMANDPAGED", ZMAGIC,
645 "QMAGIC", QMAGIC,
646 "UNMAPPED", QMAGIC,
647 "OVERLAY", MAGIC_OVERLAY,
648 "SEPARATE", MAGIC_SEPARATE,
651 "AUTOOVLS", MAGIC_AUTO_OVERLAY_SEPARATE,
652 "AUTOOVLSEP", MAGIC_AUTO_OVERLAY_SEPARATE)
653 {
654 descriptions = {
655 { OMAGIC, "Impure executable (OMAGIC)" },
656 { NMAGIC, "Pure executable (NMAGIC)" },
657 { ZMAGIC, "Demand paged (ZMAGIC)" },
658 { QMAGIC, "Demand paged with unmapped page zero (QMAGIC)" },
659 { MAGIC_SEPARATE, "Separate instruction and data spaces (PDP-11 only)" },
660 { MAGIC_OVERLAY, "Overlay (PDP-11 BSD only)" },
661 { MAGIC_AUTO_OVERLAY_NONSEPARATE, "Auto-overlay, non-separate (PDP-11 BSD only)" },
662 { MAGIC_AUTO_OVERLAY_SEPARATE, "Auto-overlay, separate (PDP-11 BSD only)" },
663 };
664 }
665 };
666
667 Linker::Option<std::string> stub{"stub", "Filename for stub that gets prepended to executable (DJGPP only)"};
668 Linker::Option<Linker::ItemOf<UnixVersionEnumeration>> unix_v{"version", "Targeted UNIX version (UNIX only)"};
669 Linker::Option<Linker::ItemOf<MagicEnumeration>> type{"type", "Executable type"};
670 Linker::Option<std::optional<offset_t>> magic{"magic", "Explicit magic type specification"};
671 Linker::Option<bool> Nflag{"N", "OMAGIC"};
672 Linker::Option<bool> nflag{"n", "NMAGIC"};
673 Linker::Option<bool> iflag{"i", "Generate separated executable"};
674 Linker::Option<bool> zflag{"z", "Demand paged executable (identical to -i for PDP-11)"};
675 Linker::Option<bool> Oflag{"O", "Generate text overlay"};
676
677 AOutOptionCollector()
678 {
679 InitializeFields(stub, unix_v, type, magic, Nflag, nflag, iflag, zflag, Oflag);
680 }
681 };
682
683 // for old DJGPP executables
685
686 static std::vector<Linker::OptionDescription<void> *> ParameterNames;
687 std::vector<Linker::OptionDescription<void> *> GetLinkerScriptParameterNames() override;
688
689 std::shared_ptr<Linker::OptionCollector> GetOptions() override;
690
691 void SetOptions(std::map<std::string, std::string>& options) override;
692
693 void OnNewSegment(std::shared_ptr<Linker::Segment> segment) override;
694
695 void CreateDefaultSegments();
696
697 std::unique_ptr<Script::List> GetScript(Linker::Module& module);
698
699 void Link(Linker::Module& module);
700
701 std::shared_ptr<Linker::Segment> GetCodeSegment();
702
703 std::shared_ptr<Linker::Segment> GetDataSegment();
704
705 std::shared_ptr<Linker::Segment> GetBssSegment();
706
707 void ProcessModule(Linker::Module& module) override;
708
709 void CalculateValues() override;
710
711 void GenerateFile(std::string filename, Linker::Module& module) override;
712
714 std::string GetDefaultExtension(Linker::Module& module, std::string filename) const override;
715 std::string GetDefaultExtension(Linker::Module& module) const override;
716 };
717
718}
719
720#endif /* AOUT_H */
Represents an a.out relocation, unifying 16-bit and 32-bit formats.
Definition aout.h:380
segment_type segment
Represents the type of relocation target.
Definition aout.h:415
bool relative
Set to true if the relocation is PC-relative.
Definition aout.h:387
uint32_t literal_entry
For invalid bit combinations, stores the bits that are expected to be 0.
Definition aout.h:417
uint32_t address
Offset of relocation within segment.
Definition aout.h:383
size_t size
Size of relocation, in bytes.
Definition aout.h:393
uint32_t symbol
Symbol number, only valid for external relocations.
Definition aout.h:385
segment_type
Type of target.
Definition aout.h:396
@ Illegal
Relocation entry is invalid.
Definition aout.h:412
@ External
Target is external, symbol contains symbol number.
Definition aout.h:400
@ Text
Target is the text segment.
Definition aout.h:404
@ Absolute
Target is an absolute value.
Definition aout.h:402
@ Undefined
Target is undefined.
Definition aout.h:398
@ Data
Target is the data segment.
Definition aout.h:406
@ Bss
Target is the bss segment.
Definition aout.h:408
@ FileName
Represents a file name symbol.
Definition aout.h:410
Definition aout.h:475
UNIX/Linux a.out binary file format.
Definition aout.h:48
std::optional< offset_t > force_magic_number
Setting this allows overriding the magic number without changing the file format (not recommended)
Definition aout.h:531
static constexpr magic_type GetDefaultMagic(system_type system)
Default magic number associated with the system.
Definition aout.h:192
magic_type
The low 16 bits of the midmag field, it determines how sections should be loaded into memory,...
Definition aout.h:140
@ ZMAGIC
Demand paged executable: Like NMAGIC, the data section starts on a page boundary, but the text sectio...
Definition aout.h:154
@ MAGIC_V1
UNIX Version 1 magic number, collides with Version 7 overlay magic number.
Definition aout.h:166
@ MAGIC_AUTO_OVERLAY_SEPARATE
2.9BSD/2.11BSD (PDP-11 only)
Definition aout.h:179
@ MAGIC_IMPURE
Same as OMAGIC.
Definition aout.h:144
@ IMAGIC
Code and data are in different address spaces (PDP-11 only)
Definition aout.h:172
@ MAGIC_DEMAND_PAGED
Same as ZMAGIC.
Definition aout.h:156
@ OMAGIC
Object file or impure executable: The text, data and bss sections are loaded contiguously.
Definition aout.h:142
@ MAGIC_UNMAPPED_ZERO
Same as QMAGIC.
Definition aout.h:161
@ MAGIC_PURE
Same as NMAGIC.
Definition aout.h:151
@ MAGIC_AUTO_OVERLAY_NONSEPARATE
2.9BSD/2.11BSD (PDP-11 only)
Definition aout.h:176
@ MAGIC_ROTEXT
Same as NMAGIC.
Definition aout.h:149
@ QMAGIC
The header is included in the text segment, but the first page is unmapped.
Definition aout.h:159
@ NMAGIC
Pure executable: The data section starts on a page boundary, making it possible to have a write prote...
Definition aout.h:147
@ MAGIC_OVERLAY
Overlay, since UNIX Version 7 (PDP-11 only, TODO: double check if not supported for VAX)
Definition aout.h:169
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition aout.cc:1371
magic_type magic
The low 16 bits of the midmag field.
Definition aout.h:184
word_size_t word_size
Number of bytes in a machine word (2 or 4), typically also determines the size of the header (16 or 3...
Definition aout.h:298
void GenerateModule(Linker::Module &module) const override
Loads the information into a module object, a convenience method when there is a single module genera...
Definition aout.cc:1734
system_type system
The target operating system, it influences section offset and address choices.
Definition aout.h:134
uint8_t flags
Definition aout.h:238
word_size_t
Definition aout.h:288
@ WordSize64
64-bit a.out, supported by GNU binutils (TODO: what systems actually use this?)
Definition aout.h:294
@ WordSize16
16-bit a.out, used on PDP-11
Definition aout.h:290
@ WordSize32
32-bit a.out
Definition aout.h:292
constexpr uint32_t GetHeaderSize() const
Retrieves the size of the header for the current settings.
Definition aout.h:301
std::vector< Linker::OptionDescription< void > * > GetLinkerScriptParameterNames() override
Returns a list of the parameters used in the linker scripts, used for documentation.
Definition aout.cc:1958
symbol_format_type
Definition aout.h:466
@ SYMBOL_FORMAT_ATT
Symbol entry contains name, used by AT&T UNIX and 16-bit BSD up to 2.9BSD and 32-bit BSD up to 3BSD.
Definition aout.h:468
@ SYMBOL_FORMAT_BSD
Symbol entry contains name offset, used since 2.11BSD and 4.1BSD.
Definition aout.h:470
unix_version
Target UNIX version.
Definition aout.h:538
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition aout.cc:1431
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition aout.cc:2193
std::shared_ptr< Linker::OptionCollector > GetOptions() override
Returns object containing a sequence of option fields provided with the -S command line flag.
Definition aout.cc:1963
void SetOptions(std::map< std::string, std::string > &options) override
Passes command line parameters as settings over to format object.
Definition aout.cc:1968
::EndianType midmag_endiantype
All fields in the header must appear in native byte order, except for FreeBSD and NetBSD where:
Definition aout.h:220
system_type
The target operating system type for parsing or generating binaries.
Definition aout.h:57
@ LINUX
Treat it as a Linux a.out binary, used before kernel 5.19 (Linux switched to ELF in 1....
Definition aout.h:98
@ NETBSD
Treat it as a NetBSD a.out binary, used before 1.5.
Definition aout.h:110
@ FREEBSD
Treat it as a FreeBSD a.out binary, used before 3.0.
Definition aout.h:104
@ UNSPECIFIED
Treat it as undetermined, intended for object files.
Definition aout.h:63
@ SYSTEM_V
Treat it as a UNIX System V binary (PDP-11 only)
Definition aout.h:86
@ UNIX
Treat it as a UNIX Version 3/4/5/6/7, also used for UNIX/32V and System III.
Definition aout.h:78
@ DJGPP1
Treat it as a DJGPP a.out binary, used before DJGPP 1.11.
Definition aout.h:116
@ BSD
Treat it as a 2.9BSD/2.11BSD or 4.3BSD binary.
Definition aout.h:92
@ UNIX_V1_V2
Treat it as a UNIX Version 1/2 binary (PDP-11 only)
Definition aout.h:71
@ EMX
Treat it as an EMX a.out binary, should only be used with EMXAOutFormat.
Definition aout.h:126
@ PDOS386
Treat it as a Public Domain OS a.out, a 32-bit DOS-like operating system (http://pdos....
Definition aout.h:122
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition aout.cc:2337
word_size_t GetWordSize() const
Returns the expected word size for the currently set CPU.
Definition aout.cc:41
uint16_t mid_value
Definition aout.h:235
std::string GetDefaultExtension(Linker::Module &module, std::string filename) const override
Appends a default extension to the filename.
Definition aout.cc:2499
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition aout.cc:743
void OnNewSegment(std::shared_ptr< Linker::Segment > segment) override
Callback function when allocating a new segment When the linker script runs, it creates segments cons...
Definition aout.cc:2073
void GenerateFile(std::string filename, Linker::Module &module) override
The main function that handles processing, calculating and generating the final image.
Definition aout.cc:2392
unix_version target_unix_version
Specify a UNIX version.
Definition aout.h:552
offset_t ImageSize() const override
Retrieves size of stored data.
Definition aout.cc:1289
::EndianType GetEndianType() const
Returns the default endian type for the currently set CPU.
Definition aout.cc:8
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:773
A representation of an enumeration with associated string representations for each value.
Definition options.h:15
std::map< value_type, std::string > descriptions
An empty dictionary that explains the value types in detail.
Definition options.h:20
offset_t WriteFile(Writer &wr) const override=0
Stores data in memory to file.
A class that provides a general interface to loading a module.
Definition format.h:198
virtual void GenerateModule(ModuleCollector &linker, std::string file_name, bool is_library=false) const
Loads the information into a module object.
Definition format.cc:221
Encodes an object module file as a collection of sections, symbols and relocations.
Definition module.h:24
Helper class that contains the options interpreted by the format.
Definition options.h:474
Documents and handles command line options.
Definition options.h:306
virtual std::string GetDefaultExtension(Module &module, std::string filename) const
Appends a default extension to the filename.
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:20
A helper class to collect sections into segments.
Definition segment_manager.h:32
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15
Definition mzexe.h:274