RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
coff.h
1#ifndef COFF_H
2#define COFF_H
3
4#include <array>
5#include <map>
6#include "cpm68k.h" // for Concurrent DOS 68K
7#include "mzexe.h" // for DJGPP
8#include "macos.h" // for A/UX
9
10#include "../common.h"
11#include "../linker/module.h"
12#include "../linker/options.h"
13#include "../linker/segment.h"
14#include "../linker/segment_manager.h"
15#include "../linker/writer.h"
16
17namespace COFF
18{
29 class COFFFormat : public virtual Linker::InputFormat, public virtual Linker::SegmentManager
30 {
31 public:
32 /* * * General members * * */
33
37 enum cpu
38 {
39 CPU_UNKNOWN = 0,
40
42
47 CPU_I386 = 0x014C,
48
53 CPU_M68K = 0x0150,
54
56
61 CPU_W65 = 0x6500,
62
67 CPU_Z80 = 0x805A,
68
73 CPU_Z8K = 0x8000,
74
76
81 CPU_I86 = 0x0148,
82
87 CPU_I286 = 0x014A,
88
93 CPU_NS32K = 0x0154,
94
99 CPU_I370 = 0x0158,
100
105 CPU_MIPS = 0x0160,
106
111 CPU_M88K = 0x016D,
112
117 CPU_WE32K = 0x0170,
118
123 CPU_VAX = 0x017D,
124
129 CPU_AM29K = 0x017A,
130
135 CPU_ALPHA = 0x0183,
136
141 CPU_PPC = 0x01DF,
142
147 CPU_PPC64 = 0x01F7,
148
150 CPU_SHARC = 0x521C,
151
153
154 CPU_C5400 = 0x0098,
155 CPU_C6000 = 0x0099,
156 CPU_C5500 = 0x009C,
157 CPU_MSP430 = 0x00A0,
158
160
165 CPU_I860 = 0x014D,
166
171 CPU_SH = 0x01A2,
172
177 CPU_ARM = 0x01C0,
178
183 CPU_AM33 = 0x01D3,
184
189 CPU_IA64 = 0x0200,
190
195 CPU_HPPA = 0x0290,
196
201 CPU_EFI = 0x0EBC,
202
207 CPU_RISCV32 = 0x5032,
208
213 CPU_RISCV64 = 0x5064,
214
219 CPU_RISCV128 = 0x5128,
220
225 CPU_AMD64 = 0x8664,
226
231 CPU_M32R = 0x9041,
232
237 CPU_ARM64 = 0xAA64,
238
240 // for now, there are no overloaded values
241 };
242
245 {
247 COFF = 1,
249 ECOFF = 2,
260 };
261
262 static constexpr COFFVariantType AnyCOFFVariant = COFFVariantType(0);
263
265 {
266 cpu actual_cpu;
267 ::EndianType endian;
268 COFFVariantType coff_variant = AnyCOFFVariant;
269 };
270
271 static const std::map<uint32_t, MachineType> MACHINE_TYPES;
272
273 offset_t file_size;
274
276 char signature[2] = { };
277
281 ::EndianType GetEndianType() const;
282
304
305 relocation_format_type relocation_format;
306
307 constexpr size_t GetRelocationEntrySize() const
308 {
309 switch(relocation_format)
310 {
311 case COFF_10:
312 return 10;
313 case COFF_14:
314 return 14;
315 case COFF_16:
316 return 16;
317 case ECOFF_8:
318 return 8;
319 case ECOFF_16:
320 return 16;
321 case XCOFF_10:
322 return 10;
323 case XCOFF_14:
324 return 14;
325 case TICOFF_10:
326 return 10;
327 case TICOFF_12:
328 return 12;
329 }
330 assert(false);
331 }
332
333 // UNIX relocations
334
336 static constexpr uint16_t R_ABS = 0;
338 static constexpr uint16_t R_DIR16 = 1;
340 static constexpr uint16_t R_REL16 = 2;
342 static constexpr uint16_t R_IND16 = 3;
344 static constexpr uint16_t R_DIR24 = 4;
346 static constexpr uint16_t R_REL24 = 5;
348 static constexpr uint16_t R_DIR32 = 6;
350 static constexpr uint16_t R_OFF8 = 7;
352 static constexpr uint16_t R_OFF16 = 8;
354 static constexpr uint16_t R_SEG12 = 9;
356 static constexpr uint16_t R_DIR32S = 10;
358 static constexpr uint16_t R_AUX = 11;
360 static constexpr uint16_t R_OPT16 = 12;
362 static constexpr uint16_t R_IND24 = 13;
364 static constexpr uint16_t R_IND32 = 14;
366 static constexpr uint16_t R_RELBYTE = 15;
368 static constexpr uint16_t R_RELWORD = 16;
370 static constexpr uint16_t R_RELLONG = 17;
372 static constexpr uint16_t R_PCRBYTE = 18;
374 static constexpr uint16_t R_PCRWORD = 19;
376 static constexpr uint16_t R_PCRLONG = 20;
377
378 // Microsoft relocations (Intel 386)
379
381 static constexpr uint16_t REL_I386_ABSOLUTE = 0;
383 static constexpr uint16_t REL_I386_DIR16 = 1;
385 static constexpr uint16_t REL_I386_REL16 = 2;
387 static constexpr uint16_t REL_I386_DIR32 = 6;
389 static constexpr uint16_t REL_I386_DIR32NB = 7;
391 static constexpr uint16_t REL_I386_SEG12 = 9;
393 static constexpr uint16_t REL_I386_SECTION = 10;
395 static constexpr uint16_t REL_I386_SECREL = 11;
397 static constexpr uint16_t REL_I386_TOKEN = 12;
399 static constexpr uint16_t REL_I386_SECREL7 = 13;
401 static constexpr uint16_t REL_I386_REL32 = 20;
402
403 // Microsoft relocations (AMD64)
404
406 static constexpr uint16_t REL_AMD64_ABSOLUTE = 0;
408 static constexpr uint16_t REL_AMD64_ADDR64 = 1;
410 static constexpr uint16_t REL_AMD64_ADDR32 = 2;
412 static constexpr uint16_t REL_AMD64_ADDR32NB = 3;
414 static constexpr uint16_t REL_AMD64_REL32 = 4;
416 static constexpr uint16_t REL_AMD64_REL32_1 = 5;
418 static constexpr uint16_t REL_AMD64_REL32_2 = 6;
420 static constexpr uint16_t REL_AMD64_REL32_3 = 7;
422 static constexpr uint16_t REL_AMD64_REL32_4 = 8;
424 static constexpr uint16_t REL_AMD64_REL32_5 = 9;
426 static constexpr uint16_t REL_AMD64_SECTION = 10;
428 static constexpr uint16_t REL_AMD64_SECREL = 11;
430 static constexpr uint16_t REL_AMD64_SECREL7 = 12;
432 static constexpr uint16_t REL_AMD64_TOKEN = 13;
434 static constexpr uint16_t REL_AMD64_SREL32 = 14;
436 static constexpr uint16_t REL_AMD64_PAIR = 15;
438 static constexpr uint16_t REL_AMD64_SSPAN32 = 16;
439
440 // Microsoft relocations (ARM)
441
443 static constexpr uint16_t REL_ARM_ABSOLUTE = 0;
445 static constexpr uint16_t REL_ARM_ADDR32 = 1;
447 static constexpr uint16_t REL_ARM_ADDR32NB = 2;
449 static constexpr uint16_t REL_ARM_BRANCH24 = 3;
451 static constexpr uint16_t REL_ARM_BRANCH11 = 4;
453 static constexpr uint16_t REL_ARM_REL32 = 10;
455 static constexpr uint16_t REL_ARM_SECTION = 14;
457 static constexpr uint16_t REL_ARM_SECREL = 15;
459 static constexpr uint16_t REL_ARM_MOV32 = 16;
461 static constexpr uint16_t REL_THUMB_MOV32 = 17;
463 static constexpr uint16_t REL_THUMB_BRANCH24 = 20;
465 static constexpr uint16_t REL_THUMB_BLX23 = 21;
467 static constexpr uint16_t REL_ARM_PAIR = 22;
468
469 // Microsoft relocations (ARM64)
470
472 static constexpr uint16_t REL_ARM64_ABSOLUTE = 0;
474 static constexpr uint16_t REL_ARM64_ADDR32 = 1;
476 static constexpr uint16_t REL_ARM64_ADDR32NB = 2;
478 static constexpr uint16_t REL_ARM64_BRANCH26 = 3;
480 static constexpr uint16_t REL_ARM64_PAGEBASE_REL21 = 4;
482 static constexpr uint16_t REL_ARM64_REL21 = 5;
484 static constexpr uint16_t REL_ARM64_PAGEOFFSET_12A = 6;
486 static constexpr uint16_t REL_ARM64_PAGEOFFSET_12L = 7;
488 static constexpr uint16_t REL_ARM64_SECREL = 8;
490 static constexpr uint16_t REL_ARM64_SECREL_LOW12A = 9;
492 static constexpr uint16_t REL_ARM64_SECREL_HIGH12A = 10;
494 static constexpr uint16_t REL_ARM64_SECREL_LOW12L = 11;
496 static constexpr uint16_t REL_ARM64_TOKEN = 12;
498 static constexpr uint16_t REL_ARM64_SECTION = 13;
500 static constexpr uint16_t REL_ARM64_ADDR64 = 14;
502 static constexpr uint16_t REL_ARM64_BRANCH19 = 15;
504 static constexpr uint16_t REL_ARM64_BRANCH14 = 16;
506 static constexpr uint16_t REL_ARM64_REL32 = 17;
507
508 // TODO: Microsoft relocations (MIPS)
509
510 // Microsoft relocations (Alpha)
511
513 static constexpr uint16_t REL_ALPHA_ABSOLUTE = 0;
515 static constexpr uint16_t REL_ALPHA_REFLONG = 1;
517 static constexpr uint16_t REL_ALPHA_REFQUAD = 2;
519 static constexpr uint16_t REL_ALPHA_GPREL32 = 3;
521 static constexpr uint16_t REL_ALPHA_LITERAL = 4;
523 static constexpr uint16_t REL_ALPHA_LITUSE = 5;
525 static constexpr uint16_t REL_ALPHA_GPDISP = 6;
527 static constexpr uint16_t REL_ALPHA_BRADDR = 7;
529 static constexpr uint16_t REL_ALPHA_HINT = 8;
531 static constexpr uint16_t REL_ALPHA_INLINE_REFLONG = 9;
533 static constexpr uint16_t REL_ALPHA_REFHI = 10;
535 static constexpr uint16_t REL_ALPHA_REFLO = 11;
537 static constexpr uint16_t REL_ALPHA_PAIR = 12;
539 static constexpr uint16_t REL_ALPHA_MATCH = 13;
541 static constexpr uint16_t REL_ALPHA_SECTION = 14;
543 static constexpr uint16_t REL_ALPHA_SECREL = 15;
545 static constexpr uint16_t REL_ALPHA_REFLONGNB = 16;
547 static constexpr uint16_t REL_ALPHA_SECRELLO = 17;
549 static constexpr uint16_t REL_ALPHA_SECRELHI = 18;
551 static constexpr uint16_t REL_ALPHA_REFQ3 = 19;
553 static constexpr uint16_t REL_ALPHA_REFQ2 = 20;
555 static constexpr uint16_t REL_ALPHA_REFQ1 = 21;
557 static constexpr uint16_t REL_ALPHA_GPRELLO = 22;
559 static constexpr uint16_t REL_ALPHA_GPRELHI = 23;
560
561 // TODO: Microsoft relocations (PowerPC)
562 // TODO: Microsoft relocations (IA64)
563
564 // TODO: Microsoft relocations (SuperH)
565
566 // Other relocation types
567
568 // https://github.com/aixoss/binutils/blob/master/include/coff/internal.h
569 // https://github.com/aixoss/binutils/blob/master/include/coff/z80.h
570 // https://github.com/aixoss/binutils/blob/master/include/coff/z8k.h
571
572 static constexpr uint16_t R_Z80_IMM8 = 0x22;
573 static constexpr uint16_t R_Z80_IMM16 = 0x01;
574 static constexpr uint16_t R_Z80_IMM24 = 0x33;
575 static constexpr uint16_t R_Z80_IMM32 = 0x17;
576 static constexpr uint16_t R_Z80_OFF8 = 0x32;
577 static constexpr uint16_t R_Z80_JR = 0x02;
578
579 static constexpr uint16_t R_Z8K_IMM4L = 0x23;
580 static constexpr uint16_t R_Z8K_IMM4H = 0x24;
581 static constexpr uint16_t R_Z8K_DISP7 = 0x25; /* djnz */
582 static constexpr uint16_t R_Z8K_IMM8 = 0x22;
583 static constexpr uint16_t R_Z8K_IMM16 = 0x01;
584 static constexpr uint16_t R_Z8K_REL16 = 0x04;
585 static constexpr uint16_t R_Z8K_IMM32 = 0x11;
586 static constexpr uint16_t R_Z8K_JR = 0x02; /* jr */
587 static constexpr uint16_t R_Z8K_CALLR = 0x05; /* callr */
588
589 static constexpr uint16_t R_W65_ABS8 = 0x01;
590 static constexpr uint16_t R_W65_ABS16 = 0x02;
591 static constexpr uint16_t R_W65_ABS24 = 0x03;
592 static constexpr uint16_t R_W65_ABS8S8 = 0x04;
593 static constexpr uint16_t R_W65_ABS8S16 = 0x05;
594 static constexpr uint16_t R_W65_ABS16S8 = 0x06;
595 static constexpr uint16_t R_W65_ABS16S16 = 0x07;
596 static constexpr uint16_t R_W65_PCR8 = 0x08;
597 static constexpr uint16_t R_W65_PCR16 = 0x09;
598 static constexpr uint16_t R_W65_DP = 0x0A;
599
600 // XCOFF relocation types
601
602 static constexpr uint8_t R_XCOFF_POS = 0x00;
603 static constexpr uint8_t R_XCOFF_NEG = 0x01;
604 static constexpr uint8_t R_XCOFF_REL = 0x02;
605 static constexpr uint8_t R_XCOFF_TOC = 0x03;
606 static constexpr uint8_t R_XCOFF_GL = 0x05;
607 static constexpr uint8_t R_XCOFF_TCL = 0x06;
608 static constexpr uint8_t R_XCOFF_BA = 0x08;
609 static constexpr uint8_t R_XCOFF_BR = 0x0A;
610 static constexpr uint8_t R_XCOFF_RL = 0x0C;
611 static constexpr uint8_t R_XCOFF_RLA = 0x0D;
612 static constexpr uint8_t R_XCOFF_REF = 0x0F;
613 static constexpr uint8_t R_XCOFF_TRL = 0x12;
614 static constexpr uint8_t R_XCOFF_TRLA = 0x13;
615 static constexpr uint8_t R_XCOFF_RBA = 0x18;
616 static constexpr uint8_t R_XCOFF_RBR = 0x1A;
617 static constexpr uint8_t R_XCOFF_TLS = 0x20;
618 static constexpr uint8_t R_XCOFF_TLS_IE = 0x21;
619 static constexpr uint8_t R_XCOFF_TLS_LD = 0x22;
620 static constexpr uint8_t R_XCOFF_TLS_LE = 0x23;
621 static constexpr uint8_t R_XCOFF_TLSM = 0x24;
622 static constexpr uint8_t R_XCOFF_TLSML = 0x25;
623 static constexpr uint8_t R_XCOFF_TOCU = 0x30;
624 static constexpr uint8_t R_XCOFF_TOCL = 0x31;
625
626 // ECOFF relocation types
627
628 static constexpr uint16_t R_ECOFF_ABS = 0x00;
629 static constexpr uint16_t R_ECOFF_REFLONG = 0x01;
630 static constexpr uint16_t R_ECOFF_REFQUAD = 0x02;
631 static constexpr uint16_t R_ECOFF_GPREL32 = 0x03;
632 static constexpr uint16_t R_ECOFF_LITERAL = 0x04;
633 static constexpr uint16_t R_ECOFF_LITUSE = 0x05;
634 static constexpr uint16_t R_ECOFF_GPDISP = 0x06;
635 static constexpr uint16_t R_ECOFF_BRADDR = 0x07;
636 static constexpr uint16_t R_ECOFF_HINT = 0x08;
637 static constexpr uint16_t R_ECOFF_SREL16 = 0x09;
638 static constexpr uint16_t R_ECOFF_SREL32 = 0x0A;
639 static constexpr uint16_t R_ECOFF_SREL64 = 0x0B;
640 static constexpr uint16_t R_ECOFF_OP_PUSH = 0x0C;
641 static constexpr uint16_t R_ECOFF_OP_STORE = 0x0D;
642 static constexpr uint16_t R_ECOFF_OP_PSUB = 0x0E;
643 static constexpr uint16_t R_ECOFF_OP_PRSHIFT = 0x0F;
644 static constexpr uint16_t R_ECOFF_GPVALUE = 0x10;
645 static constexpr uint16_t R_ECOFF_GPRELHIGH = 0x11;
646 static constexpr uint16_t R_ECOFF_GPRELLOW = 0x12;
647 static constexpr uint16_t R_ECOFF_IMMED = 0x13;
648 static constexpr uint16_t R_ECOFF_TLS_LITERAL = 0x14;
649 static constexpr uint16_t R_ECOFF_TLS_HIGH = 0x15;
650 static constexpr uint16_t R_ECOFF_TLS_LOW = 0x16;
651
656 {
657 public:
661 offset_t address;
665 uint32_t symbol_index;
669 uint32_t offset;
673 uint16_t type;
677 uint16_t information;
678
679 void Read(const std::shared_ptr<Linker::Reader>& rd, const COFFFormat& coff);
680
681 size_t GetSize(const COFFFormat& coff) const;
682 void WriteFile(const std::shared_ptr<Linker::Writer>& wr, const COFFFormat& coff) const;
683 void FillEntry(Dumper::Entry& entry, const COFFFormat& coff) const;
684 };
685
689 class Symbol
690 {
691 public:
695 std::string name;
699 uint32_t name_index;
703 uint32_t value;
711 uint16_t type;
722
723 void Read(const std::shared_ptr<Linker::Reader>& rd);
724
725 bool IsExternal() const;
726
728 {
729 public:
730 virtual ~AuxiliaryEntry() = default;
731 virtual void Read(const std::shared_ptr<Linker::Reader>& rd) = 0;
732 virtual void Write(const std::shared_ptr<Linker::Writer>& wr) const = 0;
733 virtual void FillDumpData(Dumper::Entry& entry) const = 0;
734 };
735
737 {
738 public:
739 std::string file_name;
740
741 void Read(const std::shared_ptr<Linker::Reader>& rd) override;
742 void Write(const std::shared_ptr<Linker::Writer>& wr) const override;
743 void FillDumpData(Dumper::Entry& entry) const override;
744 };
745
747 {
748 public:
749 // TODO
750 int32_t section_length;
751 uint16_t relocation_entry_count;
752 uint16_t line_number_count;
753
754 void Read(const std::shared_ptr<Linker::Reader>& rd) override;
755 void Write(const std::shared_ptr<Linker::Writer>& wr) const override;
756 void FillDumpData(Dumper::Entry& entry) const override;
757 };
758
760 {
761 public:
762 // TODO
763 // skip 6 bytes
764 uint16_t size;
765 // skip 4 bytes
766 int32_t next_entry_index;
767
768 void Read(const std::shared_ptr<Linker::Reader>& rd) override;
769 void Write(const std::shared_ptr<Linker::Writer>& wr) const override;
770 void FillDumpData(Dumper::Entry& entry) const override;
771 };
772
774 {
775 public:
776 // TODO
777 int32_t tag_index;
778 // skip 2 bytes
779 uint16_t size;
780 // skip 4 bytes
781
782 void Read(const std::shared_ptr<Linker::Reader>& rd) override;
783 void Write(const std::shared_ptr<Linker::Writer>& wr) const override;
784 void FillDumpData(Dumper::Entry& entry) const override;
785 };
786
788 {
789 public:
790 // TODO
791 int32_t tag_index;
792 int32_t size;
793 int32_t pointer_to_line_number;
794 int32_t next_entry_index;
795 uint16_t transfer_table_index;
796
797 void Read(const std::shared_ptr<Linker::Reader>& rd) override;
798 void Write(const std::shared_ptr<Linker::Writer>& wr) const override;
799 void FillDumpData(Dumper::Entry& entry) const override;
800 };
801
803 {
804 public:
805 // TODO
806 int32_t tag_index;
807 uint16_t declaration_line_number;
808 uint16_t size;
809 std::array<uint16_t, 4> dimensions;
810
811 void Read(const std::shared_ptr<Linker::Reader>& rd) override;
812 void Write(const std::shared_ptr<Linker::Writer>& wr) const override;
813 void FillDumpData(Dumper::Entry& entry) const override;
814 };
815
817 {
818 public:
819 // TODO
820 // skip 4 bytes
821 uint16_t line_number;
822 // skip 6 bytes
823 int32_t next_entry_index; // TODO: only for beginning
824
825 void Read(const std::shared_ptr<Linker::Reader>& rd) override;
826 void Write(const std::shared_ptr<Linker::Writer>& wr) const override;
827 void FillDumpData(Dumper::Entry& entry) const override;
828 };
829
831 {
832 public:
833 // TODO
834 int32_t tag_index;
835 // skip 2 bytes
836 uint16_t size;
837
838 void Read(const std::shared_ptr<Linker::Reader>& rd) override;
839 void Write(const std::shared_ptr<Linker::Writer>& wr) const override;
840 void FillDumpData(Dumper::Entry& entry) const override;
841 };
842
843 std::unique_ptr<AuxiliaryEntry> auxiliary_entry = nullptr;
844
845 enum
846 {
848 C_EFCN = uint8_t(-1),
849 C_NULL = 0,
887 C_BLOCK = 100,
895 C_LINE,
904 };
905
906 enum
907 {
909 N_DEBUG = uint16_t(-2),
911 N_ABS = uint16_t(-1),
914 };
915
916 enum
917 {
918 T_NULL = 0,
949 };
950
951 enum
952 {
961 };
962 };
963
968 {
969 public:
973 std::string name;
979 offset_t physical_address = 0;
983 offset_t address = 0;
987 offset_t size = 0;
991 offset_t section_pointer = 0;
995 offset_t relocation_pointer = 0;
1003 uint32_t relocation_count = 0;
1007 uint32_t line_number_count = 0;
1011 uint32_t flags = 0;
1016
1020 std::shared_ptr<Linker::Contents> image;
1021
1025 std::vector<std::unique_ptr<Relocation>> relocations;
1026
1027 /* COFF section flags (common to all variants) */
1029 static constexpr uint32_t TEXT = 0x0020;
1031 static constexpr uint32_t DATA = 0x0040;
1033 static constexpr uint32_t BSS = 0x0080;
1034
1035 /* UNIX COFF section flags */
1037 {
1039 static constexpr uint32_t DSECT = 0x0001;
1041 static constexpr uint32_t NOLOAD = 0x0002;
1043 static constexpr uint32_t GROUP = 0x0004;
1045 static constexpr uint32_t PAD = 0x0008;
1047 static constexpr uint32_t COPY = 0x0010;
1049 static constexpr uint32_t INFO = 0x0200;
1051 static constexpr uint32_t OVER = 0x0400;
1053 static constexpr uint32_t LIB = 0x0800;
1054 };
1055
1056 /* ECOFF section flags */
1058 {
1060 static constexpr uint32_t RDATA = 0x00000100;
1062 static constexpr uint32_t SDATA = 0x00000200;
1064 static constexpr uint32_t SBSS = 0x00000400;
1066 static constexpr uint32_t UCODE = 0x00000800;
1068 static constexpr uint32_t GOT = 0x00001000;
1070 static constexpr uint32_t DYNAMIC = 0x00002000;
1072 static constexpr uint32_t DYNSYM = 0x00004000;
1074 static constexpr uint32_t REL_DYN = 0x00008000;
1076 static constexpr uint32_t DYNSTR = 0x00010000;
1078 static constexpr uint32_t HASH = 0x00020000;
1080 static constexpr uint32_t DSOLIST = 0x00040000;
1082 static constexpr uint32_t MSYM = 0x00080000;
1084 static constexpr uint32_t EXTMASK = 0x0FF00000;
1086 static constexpr uint32_t CONFLICT = 0x00100000;
1088 static constexpr uint32_t FINI = 0x01000000;
1090 static constexpr uint32_t COMMENT = 0x02000000;
1092 static constexpr uint32_t RCONST = 0x02200000;
1094 static constexpr uint32_t XDATA = 0x02400000;
1096 static constexpr uint32_t TLSDATA = 0x02500000;
1098 static constexpr uint32_t TLSBSS = 0x02600000;
1100 static constexpr uint32_t TLSINIT = 0x02700000;
1102 static constexpr uint32_t PDATA = 0x02800000;
1104 static constexpr uint32_t LITA = 0x04000000;
1106 static constexpr uint32_t LIT8 = 0x08000000;
1108 static constexpr uint32_t LIT4 = 0x10000000;
1110 static constexpr uint32_t NRELOC_OVERFLOWED = 0x20000000;
1112 static constexpr uint32_t INIT = 0x80000000;
1113 };
1114
1115 /* PE section flags */
1117 {
1119 static constexpr uint32_t TYPE_NO_PAD = 0x00000008;
1121 static constexpr uint32_t LNK_OTHER = 0x00000100;
1123 static constexpr uint32_t LNK_INFO = 0x00000200;
1125 static constexpr uint32_t LNK_REMOVE = 0x00000800;
1127 static constexpr uint32_t LNK_COMDAT = 0x00001000;
1129 static constexpr uint32_t GPREL = 0x00008000;
1131 static constexpr uint32_t MEM_PURGEABLE = 0x00010000;
1133 static constexpr uint32_t MEM_16BIT = 0x00020000;
1135 static constexpr uint32_t MEM_LOCKED = 0x00040000;
1137 static constexpr uint32_t MEM_PRELOAD = 0x00080000;
1139 static constexpr uint32_t ALIGN_MASK = 0x00F00000;
1141 static constexpr uint32_t ALIGN_SHIFT = 20;
1143 static constexpr uint32_t LNK_NRELOC_OVFL = 0x01000000;
1145 static constexpr uint32_t MEM_DISCARDABLE = 0x02000000;
1147 static constexpr uint32_t MEM_NOT_CACHED = 0x04000000;
1149 static constexpr uint32_t MEM_NOT_PAGED = 0x08000000;
1151 static constexpr uint32_t MEM_SHARED = 0x10000000;
1153 static constexpr uint32_t MEM_EXECUTE = 0x20000000;
1155 static constexpr uint32_t MEM_READ = 0x40000000;
1157 static constexpr uint32_t MEM_WRITE = 0x80000000;
1158 };
1159
1160 /* XCOFF section flags */
1162 {
1164 static constexpr uint32_t PAD = 0x0008;
1166 static constexpr uint32_t DWARF = 0x0010;
1168 static constexpr uint32_t EXCEPT = 0x0100;
1170 static constexpr uint32_t INFO = 0x0200;
1172 static constexpr uint32_t TDATA = 0x0400;
1174 static constexpr uint32_t TBSS = 0x0800;
1176 static constexpr uint32_t LOADER = 0x1000;
1178 static constexpr uint32_t DEBUG = 0x2000;
1180 static constexpr uint32_t TYPCHK = 0x4000;
1182 static constexpr uint32_t OVERFLO = 0x8000;
1183 };
1184
1185 /* TICOFF section flags */
1187 {
1189 static constexpr uint32_t DSECT = 0x00000001;
1191 static constexpr uint32_t NOLOAD = 0x00000002;
1193 static constexpr uint32_t GROUP = 0x00000004;
1195 static constexpr uint32_t PAD = 0x00000008;
1197 static constexpr uint32_t COPY = 0x00000010;
1199 static constexpr uint32_t BLOCK = 0x00010000;
1201 static constexpr uint32_t PASS = 0x00020000;
1203 static constexpr uint32_t CLINK = 0x00040000;
1205 static constexpr uint32_t VECTOR = 0x00080000;
1207 static constexpr uint32_t PADDED = 0x00100000;
1208 };
1209
1210 void Clear();
1211
1212 Section(uint32_t flags = 0, std::shared_ptr<Linker::Contents> image = nullptr)
1213 : flags(flags), image(image)
1214 {
1215 }
1216
1217 virtual ~Section();
1218
1219 bool PresentInFile(COFFVariantType coff_variant) const;
1220 bool PresentInMemory(COFFVariantType coff_variant) const;
1221
1223 void ReadSectionHeader(const std::shared_ptr<Linker::Reader>& rd, COFFFormat& coff_format);
1224
1226 void WriteSectionHeader(const std::shared_ptr<Linker::Writer>& wr, const COFFFormat& coff_format);
1227
1229 virtual uint32_t ImageSize(const COFFFormat& coff_format) const;
1230
1232 virtual void ReadSectionData(const std::shared_ptr<Linker::Reader>& rd, const COFFFormat& coff_format);
1234 virtual void WriteSectionData(const std::shared_ptr<Linker::Writer>& wr, const COFFFormat& coff_format) const;
1236 virtual void Dump(Dumper::Dumper& dump, const COFFFormat& format, unsigned section_index) const;
1237 };
1238
1246 {
1247 public:
1248 // TODO: these are not entirely clear, names based on symbols of COFF binary
1249 uint32_t srtl_load_bias = 0;
1250 uint32_t text_load_size = 0;
1251 uint32_t data_load_size = 0;
1252 uint32_t bss_load_size = 0;
1253 uint32_t stack_load_size = 0;
1254 uint32_t flags = 0x80;
1255 uint32_t reserved = 0;
1257 {
1258 uint16_t major, minor;
1259 };
1260 version_type version = { 0 };
1261 std::string path;
1262 std::string name;
1263
1264 void AssignNameAndVersion(std::string name_and_version);
1265 offset_t ReadFile(const std::shared_ptr<Linker::Reader>& rd, offset_t size, bool& is_definition);
1266 offset_t ImageSize() const;
1267 offset_t WriteFile(const std::shared_ptr<Linker::Writer>& wr, bool as_export = false) const;
1268
1269 void Dump(Dumper::Dumper& dump, std::optional<unsigned> index) const;
1270 };
1271
1276 {
1277 public:
1281 std::optional<FlexOSLibrary> library_definition;
1285 std::vector<FlexOSLibrary> library_imports;
1286
1290 std::shared_ptr<Linker::Contents> actual_contents;
1291
1292 static std::shared_ptr<FlexOSLibrarySection> ReadFile(const std::shared_ptr<Linker::Reader>& rd, offset_t size);
1293 std::shared_ptr<const Linker::Image> AsImage() const override;
1294 offset_t ImageSize() const override;
1295 offset_t WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1296
1297 void Dump(Dumper::Dumper& dump) const;
1298 };
1299
1303 std::vector<std::shared_ptr<Section>> sections;
1304
1308 uint16_t section_count = 0;
1312 ::Timestamp<POSIX_clock> timestamp = { };
1320 uint32_t symbol_count = 0;
1324 std::vector<std::unique_ptr<Symbol>> symbols;
1332 uint16_t flags = 0;
1336 uint16_t target = 0;
1337
1342 {
1343 public:
1344 virtual ~OptionalHeader();
1348 virtual uint32_t GetSize() const = 0;
1349 virtual void ReadFile(const std::shared_ptr<Linker::Reader>& rd) = 0;
1350 virtual void WriteFile(const std::shared_ptr<Linker::Writer>& wr) const = 0;
1356 virtual offset_t CalculateValues(COFFFormat& coff) = 0;
1360 virtual void PostReadFile(COFFFormat& coff, const std::shared_ptr<Linker::Reader>& rd);
1364 virtual void PostWriteFile(const COFFFormat& coff, const std::shared_ptr<Linker::Writer>& wr) const;
1365
1366 virtual void Dump(const COFFFormat& coff, Dumper::Dumper& dump) const;
1367
1368 virtual std::string GetHeaderFormatName(const COFFFormat& coff) const;
1369 };
1370
1374 std::unique_ptr<OptionalHeader> optional_header = nullptr;
1375
1377 {
1378 size_t size;
1379 CDOS_Relocation(size_t size = 0)
1380 : size(size)
1381 {
1382 }
1383 operator size_t() const;
1384 static CDOS_Relocation Create(size_t size, uint32_t offset, const COFFFormat& format);
1385 };
1386
1390 std::map<uint32_t, CDOS_Relocation> relocations; /* CDOS68K */
1391
1396 {
1397 public:
1398 std::unique_ptr<Linker::Buffer> buffer = nullptr;
1399
1400 UnknownOptionalHeader(offset_t size)
1401 : buffer(std::make_unique<Linker::Buffer>(size))
1402 {
1403 }
1404
1405 uint32_t GetSize() const override;
1406
1407 void ReadFile(const std::shared_ptr<Linker::Reader>& rd) override;
1408
1409 void WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1410
1411 offset_t CalculateValues(COFFFormat& coff) override;
1412
1413 void Dump(const COFFFormat& coff, Dumper::Dumper& dump) const override;
1414 };
1415
1420 {
1421 public:
1425 uint16_t magic = 0;
1429 uint16_t version_stamp = 0;
1430
1434 uint32_t code_size = 0;
1438 uint32_t data_size = 0;
1442 uint32_t bss_size = 0;
1446 uint32_t entry_address = 0;
1450 uint32_t code_address = 0;
1454 uint32_t data_address = 0;
1455
1456 AOutHeader(uint16_t magic = 0)
1457 : magic(magic)
1458 {
1459 }
1460
1461 uint32_t GetSize() const override;
1462
1463 void ReadFile(const std::shared_ptr<Linker::Reader>& rd) override;
1464
1465 void WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1466
1467 offset_t CalculateValues(COFFFormat& coff) override;
1468
1469 std::string GetHeaderFormatName(const COFFFormat& coff) const override;
1470
1471 protected:
1472 virtual void DumpFields(const COFFFormat& coff, Dumper::Dumper& dump, Dumper::Region& header_region) const;
1473
1474 public:
1475 void Dump(const COFFFormat& coff, Dumper::Dumper& dump) const override;
1476 };
1477
1482 {
1483 public:
1484 uint32_t reserved1 = 0;
1485 uint32_t reserved2 = 0;
1486
1487 AOutHeader3B20(uint16_t magic = 0)
1488 : AOutHeader(magic)
1489 {
1490 }
1491
1492 uint32_t GetSize() const override;
1493
1494 void ReadFile(const std::shared_ptr<Linker::Reader>& rd) override;
1495
1496 void WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1497
1498 //offset_t CalculateValues(COFFFormat& coff) override;
1499
1500 std::string GetHeaderFormatName(const COFFFormat& coff) const override;
1501
1502 protected:
1503 void DumpFields(const COFFFormat& coff, Dumper::Dumper& dump, Dumper::Region& header_region) const override;
1504
1505 //public:
1506 // void Dump(const COFFFormat& coff, Dumper::Dumper& dump) const override;
1507 };
1508
1514 {
1515 public:
1516 FlexOSAOutHeader(uint16_t magic = 0)
1517 : AOutHeader(magic)
1518 {
1519 }
1520
1528 uint32_t stack_size = 0;
1529
1530 /* TODO: magic not needed for CDOS68K? */
1531
1532 uint32_t GetSize() const override;
1533
1534 void ReadFile(const std::shared_ptr<Linker::Reader>& rd) override;
1535
1536 void WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1537
1538 offset_t CalculateValues(COFFFormat& coff) override;
1539
1540 void PostReadFile(COFFFormat& coff, const std::shared_ptr<Linker::Reader>& rd) override;
1541
1542 void PostWriteFile(const COFFFormat& coff, const std::shared_ptr<Linker::Writer>& wr) const override;
1543
1544 std::string GetHeaderFormatName(const COFFFormat& coff) const override;
1545
1546 protected:
1547 void DumpFields(const COFFFormat& coff, Dumper::Dumper& dump, Dumper::Region& header_region) const override;
1548 };
1549
1555 {
1556 public:
1557 /* Note: untested */
1558 uint32_t info = 0;
1559 uint32_t code_size = 0;
1560 uint32_t data_size = 0;
1561 uint32_t bss_size = 0;
1562 uint32_t symbol_table_size = 0;
1563 uint32_t entry_address = 0;
1564 uint32_t code_relocation_size = 0;
1565 uint32_t data_relocation_size = 0;
1566
1567 uint32_t GetSize() const override;
1568
1569 void ReadFile(const std::shared_ptr<Linker::Reader>& wr) override;
1570
1571 void WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1572
1573 offset_t CalculateValues(COFFFormat& coff) override;
1574
1575 void Dump(const COFFFormat& coff, Dumper::Dumper& dump) const override;
1576
1577 std::string GetHeaderFormatName(const COFFFormat& coff) const override;
1578 };
1579
1586 {
1587 public:
1588 // https://web.archive.org/web/20140723105157/http://www-scf.usc.edu/~csci402/ncode/coff_8h-source.html
1589 /* bss_start */
1590 uint32_t bss_address;
1591 /* gpr_mask */
1592 uint32_t gpr_mask;
1593 /* cprmask */
1594 uint32_t cpr_mask[4];
1595 /* gp_value */
1596 uint32_t gp_value;
1597
1598 MIPSAOutHeader(uint16_t magic = 0)
1599 : AOutHeader(magic)
1600 {
1601 }
1602
1603 uint32_t GetSize() const override;
1604
1605 void ReadFile(const std::shared_ptr<Linker::Reader>& rd) override;
1606
1607 void WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1608
1609 offset_t CalculateValues(COFFFormat& coff) override;
1610
1611 std::string GetHeaderFormatName(const COFFFormat& coff) const override;
1612
1613 protected:
1614 void DumpFields(const COFFFormat& coff, Dumper::Dumper& dump, Dumper::Region& header_region) const override;
1615 };
1616
1623 {
1624 public:
1628 uint16_t magic = 0;
1629 static constexpr uint16_t SYM_STAMP = 0x030D;
1633 uint16_t version_stamp = SYM_STAMP;
1637 uint16_t build_revision = 0;
1638
1642 uint64_t code_size = 0;
1646 uint64_t data_size = 0;
1650 uint64_t bss_size = 0;
1654 uint64_t entry_address = 0;
1658 uint64_t code_address = 0;
1662 uint64_t data_address = 0;
1666 uint64_t bss_address = 0;
1668 uint32_t gpr_mask = 0;
1670 uint32_t fpr_mask = 0;
1672 uint64_t global_pointer = 0;
1673
1674 ECOFFAOutHeader(uint16_t magic = 0)
1675 : magic(magic)
1676 {
1677 }
1678
1679 uint32_t GetSize() const override;
1680
1681 void ReadFile(const std::shared_ptr<Linker::Reader>& rd) override;
1682
1683 void WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1684
1685 offset_t CalculateValues(COFFFormat& coff) override;
1686
1687 void Dump(const COFFFormat& coff, Dumper::Dumper& dump) const override;
1688
1689 std::string GetHeaderFormatName(const COFFFormat& coff) const override;
1690 };
1691
1698 {
1699 public:
1701 bool is64 = false;
1705 uint16_t magic = 0;
1709 uint16_t version_stamp = 0;
1713 uint64_t code_size = 0;
1717 uint64_t data_size = 0;
1721 uint64_t bss_size = 0;
1725 uint64_t entry_address = 0;
1729 uint64_t code_address = 0;
1733 uint64_t data_address = 0;
1737 uint64_t toc_address = 0;
1741 uint16_t entry_section = 0;
1745 uint16_t code_section = 0;
1749 uint16_t data_section = 0;
1753 uint16_t toc_section = 0;
1757 uint16_t loader_section = 0;
1761 uint16_t bss_section = 0;
1765 uint16_t code_align = 0;
1769 uint16_t data_align = 0;
1773 uint16_t module_type = 0;
1777 uint8_t cpu_flags = 0;
1781 uint8_t cpu_type = 0;
1789 uint64_t maximum_data_size = 0;
1793 uint32_t debugger_data = 0;
1797 uint8_t code_page_size = 0;
1801 uint8_t text_page_size = 0;
1805 uint8_t stack_page_size = 0;
1809 uint8_t flags = 0;
1813 uint16_t tdata_section = 0;
1817 uint16_t tbss_section = 0;
1821 uint32_t xcoff64_flags = 0;
1822#if 0
1826 uint8_t shared_memory_page = 0;
1827#endif
1828
1829 XCOFFAOutHeader(bool is64, uint16_t magic = 0)
1830 : is64(is64), magic(magic)
1831 {
1832 }
1833
1834 uint32_t GetSize() const override;
1835
1836 void ReadFile(const std::shared_ptr<Linker::Reader>& rd) override;
1837
1838 void WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1839
1840 offset_t CalculateValues(COFFFormat& coff) override;
1841
1842 void Dump(const COFFFormat& coff, Dumper::Dumper& dump) const override;
1843
1844 std::string GetHeaderFormatName(const COFFFormat& coff) const override;
1845 };
1846
1847 void Clear() override;
1848
1850 void AssignMagicValue(uint16_t value, ::EndianType as_endian_type);
1852 void AssignMagicValue(uint16_t value);
1854 void AssignMagicValue();
1855
1856 COFFVariantType coff_variant = AnyCOFFVariant;
1857
1863 cpu cpu_type = CPU_UNKNOWN;
1864
1868 ::EndianType endiantype = ::UndefinedEndian;
1869
1870 bool DetectCpuType(::EndianType expected);
1871
1872 void DetectCpuType();
1873
1874 void ReadFile(const std::shared_ptr<Linker::Reader>& rd) override;
1875
1876 protected:
1877 void ReadCOFFHeader(const std::shared_ptr<Linker::Reader>& rd);
1878 void ReadOptionalHeader(const std::shared_ptr<Linker::Reader>& rd);
1879 void ReadRestOfFile(const std::shared_ptr<Linker::Reader>& rd);
1880
1881 public:
1882 offset_t ImageSize() const override;
1883
1885 offset_t WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
1886
1887 protected:
1888 offset_t WriteFileContents(const std::shared_ptr<Linker::Writer>& wr) const;
1889
1890 public:
1891 void Dump(Dumper::Dumper& dump) const override;
1892
1893 /* * * Reader members * * */
1894
1895 void SetupOptions(std::shared_ptr<Linker::OutputFormat> format) override;
1896
1897 bool option_segmentation = false;
1898
1899 bool FormatRequiresDataStreamFix() const override;
1900
1901 private:
1902 /* symbols */
1903 std::string segment_prefix();
1904
1905 std::string segment_of_prefix();
1906
1910 std::string segmented_address_prefix();
1911
1912#if 0
1913 // TODO: can this be used?
1914 std::string segment_difference_prefix();
1915#endif
1916
1917 enum
1918 {
1919 /* section number */
1920 N_UNDEF = 0,
1921 N_ABS = 0xFFFF,
1922 N_DEBUG = 0xFFFE,
1923
1924 /* storage class */
1925 C_EXT = 2,
1926 C_STAT = 3,
1927 C_LABEL = 6,
1928 };
1929
1930 public:
1932 void GenerateModule(Linker::Module& module) const override;
1933
1934 /* * * Writer members * * */
1935
1940 {
1944 OMAGIC = 0x0107,
1948 NMAGIC = 0x0108,
1952 ZMAGIC = 0x010B,
1956 SHMAGIC = 0x012B,
1969 };
1970 opthdr_magic_type magic_type = opthdr_magic_type(0);
1971 bool option_unmapped_zero_page = false;
1972
1974 {
1975 public:
1976 class MagicEnumeration : public Linker::Enumeration<opthdr_magic_type>
1977 {
1978 public:
1980 : Enumeration(
1981 "OMAGIC", OMAGIC,
1982 "IMPURE", OMAGIC,
1983 "NMAGIC", NMAGIC,
1984 "ROTEXT", NMAGIC,
1985 "PURE", NMAGIC,
1986 "ZMAGIC", ZMAGIC,
1987 "DEMANDPAGED", ZMAGIC)
1988 {
1989 descriptions = {
1990 { OMAGIC, "Impure executable (OMAGIC)" },
1991 { NMAGIC, "Pure executable (NMAGIC)" },
1992 { ZMAGIC, "Demand paged executable (ZMAGIC)" },
1993 };
1994 }
1995 };
1996
1997 Linker::Option<std::string> stub{"stub", "Filename for stub that gets prepended to executable"};
1998 Linker::Option<Linker::ItemOf<MagicEnumeration>> type{"type", "Executable type"};
1999 Linker::Option<bool> Nflag{"N", "Impure executable (OMAGIC)"};
2000 Linker::Option<bool> nflag{"n", "Pure executable (NMAGIC)"};
2001 Linker::Option<bool> zflag{"z", "Demand paged executable (ZMAGIC)"};
2002 Linker::Option<std::optional<std::string>> slib{"slib", "Generate FlexOS shared run-time library, parameter: <library name>.<major version>.<minor version>[.<optional flags as hexadecimal value>]"};
2003 Linker::Option<bool> reloc{"reloc", "Generate FlexOS relocations (default for CDOS68K and FlexOS 386 libraries)"};
2004 Linker::Option<bool> noreloc{"noreloc", "Suppress FlexOS relocations (default for FlexOS 386 programs)"};
2005
2006 // TODO: make stack size a parameter (for FlexOS)
2007
2008 COFFOptionCollector()
2009 {
2010 InitializeFields(stub, type, Nflag, nflag, zflag, slib, reloc, noreloc);
2011 }
2012 };
2013
2014 // for DJGPP binaries
2015 mutable Microsoft::MZSimpleStubWriter stub;
2016
2063
2068
2072 bool option_relocation = false;
2073
2077 uint32_t stub_size = 0;
2078
2082 std::shared_ptr<Linker::Segment> stack;
2086 uint32_t entry_address = 0; /* TODO */
2091
2095 bool has_lib_section = false;
2099 std::optional<FlexOSLibrary> flexos386_library_name;
2100
2101 COFFFormat(format_type type = GENERIC, COFFVariantType coff_variant = COFF, EndianType endiantype = ::UndefinedEndian)
2102 : coff_variant(coff_variant), endiantype(endiantype), type(type)
2103 {
2104 }
2105
2106 ~COFFFormat()
2107 {
2108 Clear();
2109 }
2110
2111 bool FormatSupportsLibraries() const override;
2112
2113 unsigned FormatAdditionalSectionFlags(std::string section_name) const override;
2114
2115 static std::vector<Linker::OptionDescription<void> *> ParameterNames;
2116 std::vector<Linker::OptionDescription<void> *> GetLinkerScriptParameterNames() override;
2117
2118 std::shared_ptr<Linker::OptionCollector> GetOptions() override;
2119
2120 void SetOptions(std::map<std::string, std::string>& options) override;
2121
2123 enum
2124 {
2139 };
2140
2141 void OnCallDirective(Linker::Module& module, std::string identifier) override;
2142
2143 void OnNewSegment(std::shared_ptr<Linker::Segment> segment) override;
2144
2145 void CreateDefaultSegments();
2146
2147 std::unique_ptr<Script::List> GetScript(Linker::Module& module);
2148
2149 void Link(Linker::Module& module);
2150
2152 std::shared_ptr<Linker::Segment> GetSegment(std::shared_ptr<Section>& section);
2153
2154 std::shared_ptr<Linker::Segment> GetCodeSegment();
2155
2157 std::shared_ptr<Linker::Segment> GetInitSegment();
2158
2159 std::shared_ptr<Linker::Segment> GetDataSegment();
2160
2161 std::shared_ptr<Linker::Segment> GetBssSegment();
2162
2163 void ProcessModule(Linker::Module& module) override;
2164
2165 void CalculateValues() override;
2166
2167 void GenerateFile(std::string filename, Linker::Module& module) override;
2168
2170 std::string GetDefaultExtension(Linker::Module& module, std::string filename) const override;
2171 };
2172
2174 {
2175 public:
2176 // TODO: very preliminary
2177
2179 : MacintoshOutputDriver(target)
2180 {
2181 }
2182
2184 : MacintoshOutputDriver(target, produce)
2185 {
2186 }
2187
2188 bool FormatSupportsResources() const override;
2189
2190 private:
2192 std::shared_ptr<COFFFormat> data_fork;
2194 std::shared_ptr<Apple::MacintoshResourceFileFormat> resource_fork;
2195 std::shared_ptr<Apple::FinderInfo> finder_info;
2196
2197 std::map<std::string, std::string> options;
2198 std::string model;
2199 std::string script_file;
2200 std::map<std::string, std::string> script_options;
2201 };
2202}
2203
2204#endif /* COFF_H */
This is not actually a file format, but an interface to permit generating multiple binary outputs for...
Definition macos.h:968
target_format_t
Represents the file type of the main file.
Definition macos.h:972
@ TARGET_DATA_FORK
Main file is a data fork, typically empty.
Definition macos.h:976
target_format_t target
Format of "filename".
Definition apple.h:746
produce_format_t produce
Bitset of other files to produce.
Definition apple.h:749
Definition coff.h:2174
bool FormatSupportsResources() const override
Whether the format supports resources.
Definition coff.cc:4262
AT&T 3B20 36 byte a.out optional header.
Definition coff.h:1482
uint32_t GetSize() const override
Returns size of optional header.
Definition coff.cc:1537
A standard 28 byte a.out optional header, used by AT&T UNIX and DJGPP.
Definition coff.h:1420
uint32_t code_address
Address of code (COFF name: text_start)
Definition coff.h:1450
uint16_t version_stamp
Version stamp (COFF name: vstamp)
Definition coff.h:1429
uint32_t entry_address
Initial value of eip (COFF name: entry)
Definition coff.h:1446
uint16_t magic
Type of executable, most typically ZMAGIC (COFF name: magic)
Definition coff.h:1425
uint32_t code_size
Code size (COFF name: tsize)
Definition coff.h:1434
uint32_t GetSize() const override
Returns size of optional header.
Definition coff.cc:1446
uint32_t data_size
Data size (COFF name: dsize)
Definition coff.h:1438
uint32_t bss_size
BSS size (COFF name: bsize)
Definition coff.h:1442
uint32_t data_address
Address of data (COFF name: data_start)
Definition coff.h:1454
ECOFF optional header.
Definition coff.h:1623
uint64_t bss_address
Base address for bss segment (ECOFF name: bss_start)
Definition coff.h:1666
uint32_t gpr_mask
unused (ECOFF name: gprmask)
Definition coff.h:1668
uint16_t magic
Type of executable.
Definition coff.h:1628
uint64_t data_size
Size of data segment (ECOFF name: dsize)
Definition coff.h:1646
uint32_t GetSize() const override
Returns size of optional header.
Definition coff.cc:1766
uint16_t version_stamp
Object file version stamp (ECOFF name: vstamp)
Definition coff.h:1633
uint64_t bss_size
Size of bss segment (ECOFF name: bsize)
Definition coff.h:1650
uint32_t fpr_mask
unused (ECOFF name: fprmask)
Definition coff.h:1670
uint64_t global_pointer
Initial global pointer value (ECOFF name: gp_value)
Definition coff.h:1672
uint64_t data_address
Base address for data segment (ECOFF name: data_start)
Definition coff.h:1662
uint64_t code_address
Base address for code segment (ECOFF name: text_start)
Definition coff.h:1658
uint16_t build_revision
Revision build of system tools (ECOFF name: bldrev)
Definition coff.h:1637
uint64_t code_size
Size of code segment (ECOFF name: tsize)
Definition coff.h:1642
uint64_t entry_address
Virtual address of execution start (ECOFF name: entry)
Definition coff.h:1654
Concurrent DOS 68K/FlexOS 386 optional header Concurrent DOS 68K uses the typical a....
Definition coff.h:1514
void PostReadFile(COFFFormat &coff, const std::shared_ptr< Linker::Reader > &rd) override
Retrieves any additional data from the file corresponding to this type of optional header.
Definition coff.cc:1619
uint32_t GetSize() const override
Returns size of optional header.
Definition coff.cc:1582
uint32_t stack_size
Size of stack for execution.
Definition coff.h:1528
void PostWriteFile(const COFFFormat &coff, const std::shared_ptr< Linker::Writer > &wr) const override
Stores any additional data in the file corresponding to this type of optional header.
Definition coff.cc:1628
uint32_t relocations_offset
The offset to the crunched relocation data within the file.
Definition coff.h:1524
Encodes the contents of a FlexOS 386 COFF .lib section.
Definition coff.h:1276
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Writes data of non-zero filled sections.
Definition coff.cc:3254
std::optional< FlexOSLibrary > library_definition
In a shared library, the first entry provides the attributes of the library.
Definition coff.h:1281
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition coff.cc:3237
std::vector< FlexOSLibrary > library_imports
Sequence of imported libraries.
Definition coff.h:1285
std::shared_ptr< const Linker::Image > AsImage() const override
Retrieves a randomly accessible image.
Definition coff.cc:3323
std::shared_ptr< Linker::Contents > actual_contents
Used internally to represent actual data.
Definition coff.h:1290
Represents a FlexOS library entry.
Definition coff.h:1246
GNU a.out optional header TODO.
Definition coff.h:1555
uint32_t GetSize() const override
Returns size of optional header.
Definition coff.cc:1649
56 byte long header used on MIPS
Definition coff.h:1586
uint32_t GetSize() const override
Returns size of optional header.
Definition coff.cc:1716
An abstract class to represent the optional header.
Definition coff.h:1342
virtual uint32_t GetSize() const =0
Returns size of optional header.
virtual void PostReadFile(COFFFormat &coff, const std::shared_ptr< Linker::Reader > &rd)
Retrieves any additional data from the file corresponding to this type of optional header.
Definition coff.cc:1394
virtual offset_t CalculateValues(COFFFormat &coff)=0
Sets up fields to be consistent.
virtual void PostWriteFile(const COFFFormat &coff, const std::shared_ptr< Linker::Writer > &wr) const
Stores any additional data in the file corresponding to this type of optional header.
Definition coff.cc:1398
A generic COFF relocation.
Definition coff.h:656
uint32_t offset
(COFF name: r_offset)
Definition coff.h:669
uint32_t symbol_index
Index of symbol in symbol table (COFF name: r_symndx)
Definition coff.h:665
uint16_t information
Assorted information (COFF name: r_bits, r_size, r_stuff etc.)
Definition coff.h:677
offset_t address
Address of the relocation (COFF name: r_vaddr)
Definition coff.h:661
uint16_t type
Type of relocation (COFF name: r_type)
Definition coff.h:673
A COFF section.
Definition coff.h:968
std::string name
The name of the section (COFF name: s_name)
Definition coff.h:973
offset_t relocation_pointer
Offset to COFF relocations (COFF name: s_relptr)
Definition coff.h:995
uint32_t relocation_count
COFF relocation count (COFF name: s_nreloc)
Definition coff.h:1003
virtual void WriteSectionData(const std::shared_ptr< Linker::Writer > &wr, const COFFFormat &coff_format) const
Writes the section contents to a stream, can be overloaded by subclasses.
Definition coff.cc:1168
virtual void Dump(Dumper::Dumper &dump, const COFFFormat &format, unsigned section_index) const
Displays the section information and contents.
Definition coff.cc:1174
offset_t size
The size of the section (COFF name: s_size)
Definition coff.h:987
offset_t address
The virtual address of the section (COFF name: s_vaddr)
Definition coff.h:983
static constexpr uint32_t BSS
COFF section flag: Section contains uninitialized data (COFF name: STYP_BSS)
Definition coff.h:1033
std::vector< std::unique_ptr< Relocation > > relocations
Collection of COFF relocations.
Definition coff.h:1025
void WriteSectionHeader(const std::shared_ptr< Linker::Writer > &wr, const COFFFormat &coff_format)
Writes an entry in the section header table.
Definition coff.cc:1073
uint16_t memory_page_number
TICOFF specific field.
Definition coff.h:1015
offset_t line_number_pointer
unused (COFF name: s_lnnoptr)
Definition coff.h:999
static constexpr uint32_t DATA
COFF section flag: Section contains initialized data (COFF name: STYP_DATA)
Definition coff.h:1031
offset_t section_pointer
Offset of stored image data from COFF header start (COFF name: s_scnptr)
Definition coff.h:991
offset_t physical_address
The physical address of the section (expected to be identical to the virtual address) (COFF name: s_p...
Definition coff.h:979
static constexpr uint32_t TEXT
COFF section flag: Section contains executable instructions (COFF name: STYP_TEXT)
Definition coff.h:1029
void ReadSectionHeader(const std::shared_ptr< Linker::Reader > &rd, COFFFormat &coff_format)
Reads an entry in the section header table.
Definition coff.cc:975
virtual void ReadSectionData(const std::shared_ptr< Linker::Reader > &rd, const COFFFormat &coff_format)
Reads the section contents from a stream, can be overloaded by subclasses.
Definition coff.cc:1157
uint32_t line_number_count
unused (COFF name: s_nlnno)
Definition coff.h:1007
uint32_t flags
COFF section flags, determines the type of the section (text, data, bss, etc.) (COFF name: s_flags)
Definition coff.h:1011
std::shared_ptr< Linker::Contents > image
The stored image data.
Definition coff.h:1020
A COFF symbol.
Definition coff.h:690
std::string name
Symbol name (COFF name: n_name, if it fits inside field)
Definition coff.h:695
uint16_t section_number
The number of the section, with special values 0 (N_UNDEF), 1 (N_ABS) and 2 (N_DEBUG) (COFF name: n_s...
Definition coff.h:707
@ N_UNDEF
Undefined external symbol.
Definition coff.h:913
@ N_ABS
Absolute symbol.
Definition coff.h:911
@ N_DEBUG
Debugging symbol.
Definition coff.h:909
uint16_t type
The symbol type (COFF name: n_type)
Definition coff.h:711
@ DT_NON
Not a derived type.
Definition coff.h:954
@ DT_FCN
Function returning.
Definition coff.h:958
@ DT_ARY
Array of.
Definition coff.h:960
@ DT_PTR
Pointer to.
Definition coff.h:956
uint8_t storage_class
COFF name: n_sclass, typical values are 2 (C_EXT), 3 (C_STAT)
Definition coff.h:717
@ C_UNTAG
union tag
Definition coff.h:873
@ C_MOU
member of union
Definition coff.h:871
@ C_EFCN
Pysical end of function.
Definition coff.h:848
@ C_ULABEL
undefined label
Definition coff.h:863
@ C_AUTO
Automatic variable.
Definition coff.h:851
@ C_EXTDEF
external definition
Definition coff.h:859
@ C_SHADOW
shadow symbol
Definition coff.h:901
@ C_ALIAS
duplicated tag
Definition coff.h:897
@ C_FIELD
bit field
Definition coff.h:885
@ C_TPDEF
type definition
Definition coff.h:875
@ C_STAT
static variable
Definition coff.h:855
@ C_FCN
begin/end function
Definition coff.h:889
@ C_LABEL
label
Definition coff.h:861
@ C_WEAKEXT
external with weak linkage
Definition coff.h:903
@ C_MOS
member of structure
Definition coff.h:865
@ C_REGPARM
register parameter
Definition coff.h:883
@ C_FILE
file name
Definition coff.h:893
@ C_REG
register variable
Definition coff.h:857
@ C_USTATIC
uninitialized static
Definition coff.h:877
@ C_MOE
member of enumeration
Definition coff.h:881
@ C_EXT
external symbol
Definition coff.h:853
@ C_STRTAG
structure tag
Definition coff.h:869
@ C_ARG
function argument
Definition coff.h:867
@ C_EOS
end of structure
Definition coff.h:891
@ C_BLOCK
begin/end block
Definition coff.h:887
@ C_HIDDEN
static but avoids name conflict
Definition coff.h:899
@ C_ENTAG
enumeration tag
Definition coff.h:879
uint32_t name_index
The index of the symbol name within the string table, if not stored directly in the entry,...
Definition coff.h:699
uint8_t auxiliary_count
Signifies how many extra entries are present, these should be skipped, 0 is a typical value (COFF nam...
Definition coff.h:721
uint32_t value
The actual value of the symbol (COFF name: n_value)
Definition coff.h:703
@ T_MOE
Member of enumeration.
Definition coff.h:940
@ T_UNION
Union (C keyword union)
Definition coff.h:936
@ T_USHORT
Unsigned short integer (C type unsigned short)
Definition coff.h:944
@ T_ULONG
Unsigned long integer (C type unsigned long)
Definition coff.h:948
@ T_ENUM
Enumeration (C keyword enum)
Definition coff.h:938
@ T_CHAR
Character (C type char)
Definition coff.h:922
@ T_LONG
Long integer (C type long)
Definition coff.h:928
@ T_STRUCT
Structure (C keyword struct)
Definition coff.h:934
@ T_ARG
Function argument.
Definition coff.h:920
@ T_UINT
Unsigned integer (C type unsigned int)
Definition coff.h:946
@ T_UCHAR
Unsigned character (C type unsigned char)
Definition coff.h:942
@ T_DOUBLE
Double (C type double)
Definition coff.h:932
@ T_INT
Integer (C type int)
Definition coff.h:926
@ T_SHORT
Short integer (C type short)
Definition coff.h:924
@ T_FLOAT
Float (C type float)
Definition coff.h:930
A simplified class to represent an optional header of unknown structure.
Definition coff.h:1396
uint32_t GetSize() const override
Returns size of optional header.
Definition coff.cc:1421
XCOFF optional header.
Definition coff.h:1698
uint16_t code_align
Maximum alignment of text (XCOFF name: algntext)
Definition coff.h:1765
uint16_t version_stamp
Object file version stamp (XCOFF name: vstamp)
Definition coff.h:1709
bool is64
False for XCOFF32, true for XCOFF64.
Definition coff.h:1701
uint64_t maximum_stack_size
Maximum stack size (XCOFF name: maxstack)
Definition coff.h:1785
uint16_t magic
Type of executable (XCOFF name: mflag)
Definition coff.h:1705
uint64_t data_size
Size of data segment (XCOFF name: dsize)
Definition coff.h:1717
uint32_t xcoff64_flags
XCOFF64 specific flags (XCOFF64 name: x64flags)
Definition coff.h:1821
uint16_t toc_section
Section number for TOC (XCOFF name: sntoc)
Definition coff.h:1753
uint32_t debugger_data
Reserved for debugger (XCOFF name: debugger)
Definition coff.h:1793
uint64_t code_size
Size of code segment (XCOFF name: tsize)
Definition coff.h:1713
uint16_t entry_section
Section number for entry point (XCOFF name: snentry)
Definition coff.h:1741
uint8_t text_page_size
Requested data page size (XCOFF name: datapsize)
Definition coff.h:1801
uint64_t data_address
Base address for data segment (XCOFF name: data_start)
Definition coff.h:1733
uint16_t tbss_section
Section number for tbss (XCOFF name: sntbss)
Definition coff.h:1817
uint16_t loader_section
Section number for loader data (XCOFF name: snloader)
Definition coff.h:1757
uint64_t bss_size
Size of bss segment (XCOFF name: bsize)
Definition coff.h:1721
uint8_t cpu_type
CPU type (XCOFF name: cputype)
Definition coff.h:1781
uint8_t stack_page_size
Requested stack page size (XCOFF name: stackpsize)
Definition coff.h:1805
uint8_t cpu_flags
CPU flags (XCOFF name: cpuflag)
Definition coff.h:1777
uint16_t module_type
Module type (XCOFF name: modtype)
Definition coff.h:1773
uint16_t data_section
Section number for data (XCOFF name: sndata)
Definition coff.h:1749
uint64_t code_address
Base address for code segment (XCOFF name: text_start)
Definition coff.h:1729
uint16_t data_align
Maximum alignment of data (XCOFF name: algndata)
Definition coff.h:1769
uint16_t code_section
Section number for text (XCOFF name: sntext)
Definition coff.h:1745
uint64_t entry_address
Virtual address of execution start (XCOFF name: entry)
Definition coff.h:1725
uint64_t toc_address
Address of TOC (XCOFF name: toc)
Definition coff.h:1737
uint8_t flags
Flags.
Definition coff.h:1809
uint8_t code_page_size
Requested code page size (XCOFF name: textpsize)
Definition coff.h:1797
uint32_t GetSize() const override
Returns size of optional header.
Definition coff.cc:1822
uint16_t bss_section
Section number for bss (XCOFF name: snbss)
Definition coff.h:1761
uint16_t tdata_section
Section number for tdata (XCOFF name: sntdata)
Definition coff.h:1813
uint64_t maximum_data_size
Maximum data size (XCOFF name: maxdata)
Definition coff.h:1789
The UNIX COFF file format.
Definition coff.h:30
void Clear() override
Resets all fields to their default values, deallocate memory.
Definition coff.cc:1968
static constexpr uint16_t R_REL16
16-bit relative address of symbol
Definition coff.h:340
static constexpr uint16_t REL_ALPHA_PAIR
Displacement value for a preceding REFHI, SECRELHI, REFQ3 or REFQ2 relocation.
Definition coff.h:537
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 coff.cc:2696
COFFVariantType
Variants of the COFF file format.
Definition coff.h:245
@ COFF
Standard COFF variant (also for 32-bit ECOFF for MIPS)
Definition coff.h:247
@ ECOFF
ECOFF 64-bit version.
Definition coff.h:249
@ XCOFF32
32-bit XCOFF from IBM
Definition coff.h:251
@ TICOFF
Texas Instruments COFF variant (COFF2)
Definition coff.h:257
@ XCOFF64
64-bit XCOFF from IBM
Definition coff.h:253
@ PECOFF
Microsoft PE/COFF variant.
Definition coff.h:255
@ TICOFF1
Texas Instruments COFF variant (COFF1)
Definition coff.h:259
static constexpr uint16_t REL_AMD64_REL32_4
32-bit relative address of symbol minus 4
Definition coff.h:422
std::optional< FlexOSLibrary > flexos386_library_name
FlexOS 386 specific: generate shared library (SLB)
Definition coff.h:2099
std::vector< std::shared_ptr< Section > > sections
The list of COFF sections.
Definition coff.h:1303
static constexpr uint16_t REL_ALPHA_GPDISP
reserved
Definition coff.h:525
static constexpr uint16_t R_RELWORD
16-bit direct (symbol relative) address of symbol
Definition coff.h:368
bool has_lib_section
FlexOS 386 specific: program participates in dynamic linking.
Definition coff.h:2095
static constexpr uint16_t REL_ARM64_SECREL_LOW12A
Low 12 bits of offset from section start for ADD/ADDS.
Definition coff.h:490
static constexpr uint16_t REL_AMD64_SECTION
16-bit section index (debugging)
Definition coff.h:426
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition coff.cc:3869
format_type
Represents the type of target system, which will determine the CPU type and several other fields.
Definition coff.h:2021
@ UNIX_3B5
AT&T UNIX System V Release 3 for the AT&T 3B5 and 3B15 (WE32K)
Definition coff.h:2037
@ UNIX
AT&T UNIX System V Release 1-3.
Definition coff.h:2029
@ UNIX_3B2
AT&T UNIX System V Release 3 for the AT&T 3B2 (WE32K)
Definition coff.h:2041
@ CDOS386
FlexOS 386 executable.
Definition coff.h:2053
@ WINDOWS
Windows Portable Executable (used only by PE)
Definition coff.h:2057
@ UNIX_3B20
AT&T UNIX System V Release 3 for the AT&T 3B20 (WE32K)
Definition coff.h:2033
@ GENERIC
An unspecified value, probably will not work.
Definition coff.h:2025
@ DJGPP
DJGPP COFF executable.
Definition coff.h:2045
@ CDOS68K
Concurrent DOS 68K executable (untested but confident)
Definition coff.h:2049
uint32_t optional_header_size
The size of the optional header (COFF: f_opthdr)
Definition coff.h:1328
static constexpr uint16_t REL_ARM64_BRANCH26
26-bit ARM relative address of symbol
Definition coff.h:478
@ FLAG_NO_SYMBOLS
F_LSYMS.
Definition coff.h:2132
@ FLAG_NO_RELOCATIONS
F_RELFLG.
Definition coff.h:2126
@ FLAG_32BIT_LITTLE_ENDIAN
F_AR32WR.
Definition coff.h:2136
@ FLAG_32BIT_BIG_ENDIAN
F_AR32W.
Definition coff.h:2138
@ FLAG_NO_LINE_NUMBERS
F_LNNO.
Definition coff.h:2130
@ FLAG_PDP11_ENDIAN
F_AR16WR.
Definition coff.h:2134
@ FLAG_EXECUTABLE
F_EXEC.
Definition coff.h:2128
static constexpr uint16_t REL_AMD64_REL32_2
32-bit relative address of symbol minus 2
Definition coff.h:418
static constexpr uint16_t REL_ARM64_BRANCH19
19-bit relative address of symbol
Definition coff.h:502
static constexpr uint16_t REL_ALPHA_REFLONG
32-bit virtual address of symbol
Definition coff.h:515
static constexpr uint16_t R_PCRLONG
32-bit PC relative address of symbol
Definition coff.h:376
static constexpr uint16_t REL_ALPHA_MATCH
Displacement value for a preceding REFLONG relocation.
Definition coff.h:539
static constexpr uint16_t REL_AMD64_SSPAN32
?
Definition coff.h:438
static constexpr uint16_t R_RELLONG
32-bit direct (symbol relative) address of symbol
Definition coff.h:370
static constexpr uint16_t REL_ALPHA_LITUSE
reserved
Definition coff.h:523
static constexpr uint16_t REL_ARM64_PAGEOFFSET_12L
12-bit page offset of symbol for LDR
Definition coff.h:486
static constexpr uint16_t R_DIR32
32-bit direct address of symbol
Definition coff.h:348
static constexpr uint16_t R_ABS
No relocation.
Definition coff.h:336
std::shared_ptr< Linker::Segment > GetSegment(std::shared_ptr< Section > &section)
Return the segment stored inside the section, note that this only works for binary generation.
Definition coff.cc:3738
static constexpr uint16_t REL_AMD64_REL32
32-bit relative address of symbol
Definition coff.h:414
static constexpr uint16_t REL_ALPHA_REFQ1
The least significant 16 bits of the 64-bit virtual address of symbol.
Definition coff.h:555
static constexpr uint16_t REL_ALPHA_INLINE_REFLONG
32-bit virtual address of symbol split into two 16-bit values; this relocation must be followed by an...
Definition coff.h:531
static constexpr uint16_t REL_ARM_MOV32
Two 32-bit ARM instructions with 32 bits of the virtual address of the symbol.
Definition coff.h:459
static constexpr uint16_t REL_I386_DIR32
32-bit virtual address of symbol
Definition coff.h:387
static constexpr uint16_t R_DIR32S
(WE32K) 32-bit direct address of symbol, byte swapped
Definition coff.h:356
static constexpr uint16_t REL_ARM_REL32
32-bit relative address of symbol
Definition coff.h:453
static constexpr uint16_t REL_ALPHA_SECREL
32-bit offset from section start (debugging)
Definition coff.h:543
static constexpr uint16_t REL_ALPHA_LITERAL
16-bit global pointer relative address of symbol
Definition coff.h:521
static constexpr uint16_t REL_I386_SECREL7
7-bit offset from section base
Definition coff.h:399
static constexpr uint16_t REL_AMD64_SECREL7
7-bit offset from section base
Definition coff.h:430
std::shared_ptr< Linker::OptionCollector > GetOptions() override
Returns object containing a sequence of option fields provided with the -S command line flag.
Definition coff.cc:3093
static constexpr uint16_t REL_ALPHA_GPRELHI
High 16 bits of 32-bit global pointer relative address of symbol.
Definition coff.h:559
static constexpr uint16_t REL_I386_SECTION
16-bit section index (debugging)
Definition coff.h:393
std::map< uint32_t, CDOS_Relocation > relocations
Concurrent DOS 68K requires a special block of data to represent "crunched" relocations (see CPM68KWr...
Definition coff.h:1390
std::vector< Linker::OptionDescription< void > * > GetLinkerScriptParameterNames() override
Returns a list of the parameters used in the linker scripts, used for documentation.
Definition coff.cc:3088
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition coff.cc:2431
bool FormatSupportsLibraries() const override
Whether the format supports libraries.
Definition coff.cc:3053
static constexpr uint16_t REL_ARM64_PAGEOFFSET_12A
12-bit page offset of symbol for ADD/ADDS
Definition coff.h:484
static constexpr uint16_t REL_ARM64_SECREL_HIGH12A
Bits 12 to 23 of offset from section start for ADD/ADDS.
Definition coff.h:492
static constexpr uint16_t REL_ALPHA_ABSOLUTE
No relocation.
Definition coff.h:513
static constexpr uint16_t REL_I386_REL32
32-bit relative address of symbol
Definition coff.h:401
static constexpr uint16_t REL_ALPHA_REFQ2
The third most significant 16 bits of the 64-bit virtual address of symbol; this relocation must be f...
Definition coff.h:553
format_type type
A representation of the format to generate.
Definition coff.h:2062
static constexpr uint16_t REL_ALPHA_REFHI
High 16 bits of 32-bit virtual address of symbol; this relocation must be followed by a PAIR relocati...
Definition coff.h:533
static constexpr uint16_t REL_ARM_BRANCH11
Two 16-bit instructions with 11 bits of the relative address of symbol each.
Definition coff.h:451
static constexpr uint16_t REL_THUMB_BLX23
23-bit Thumb BLX relative address of symbol
Definition coff.h:465
bool option_relocation
Enable relocation generation, only relevant for FlexOS 386.
Definition coff.h:2072
static constexpr uint16_t REL_ARM_ABSOLUTE
No relocation.
Definition coff.h:443
static constexpr uint16_t REL_ALPHA_REFLO
Low 16 bits of 32-bit virtual address of symbol.
Definition coff.h:535
static constexpr uint16_t REL_ALPHA_SECRELHI
High 16 bits of 32-bit offset from section start; this relocation must be followed by a PAIR relocati...
Definition coff.h:549
char signature[2]
The actual value of the magic number (COFF name: f_magic)
Definition coff.h:276
static constexpr uint16_t REL_ALPHA_GPREL32
32-bit global pointer relative address of symbol
Definition coff.h:519
static constexpr uint16_t REL_AMD64_REL32_3
32-bit relative address of symbol minus 3
Definition coff.h:420
static constexpr uint16_t REL_ARM_ADDR32
32-bit virtual address of symbol
Definition coff.h:445
std::vector< std::unique_ptr< Symbol > > symbols
The symbols stored inside the COFF file.
Definition coff.h:1324
bool FormatRequiresDataStreamFix() const override
Whether the generated file might contain bugs that require fixing.
Definition coff.cc:2691
static constexpr uint16_t REL_THUMB_MOV32
Two 32-bit Thumb instructions with 32 bits of the virtual address of the symbol.
Definition coff.h:461
static constexpr uint16_t R_OFF16
8-bit high byte of address of symbol
Definition coff.h:352
cpu
Represents the first 16-bit word of a COFF file.
Definition coff.h:38
@ CPU_IA64
Intel Itanium architecture, also known as IA-64.
Definition coff.h:189
@ CPU_ALPHA
DEC Alpha.
Definition coff.h:135
@ CPU_PPC
IBM PowerPC, 32-bit.
Definition coff.h:141
@ CPU_AMD64
x86-64, introduced by AMD
Definition coff.h:225
@ CPU_VAX
DEC VAX.
Definition coff.h:123
@ CPU_I86
Intel x86-16, introduced with the Intel 8086.
Definition coff.h:81
@ CPU_M32R
Mitsubishi M32R.
Definition coff.h:231
@ CPU_AM33
Matsushita AM33.
Definition coff.h:183
@ CPU_RISCV32
RISC-V 32.
Definition coff.h:207
@ CPU_Z8K
Zilog Z8000.
Definition coff.h:73
@ CPU_I286
Intel x86-16, introduced with the Intel 286.
Definition coff.h:87
@ CPU_Z80
Zilog Z80.
Definition coff.h:67
@ CPU_I370
IBM System/370.
Definition coff.h:99
@ CPU_NS32K
National Semiconductor NS32000.
Definition coff.h:93
@ CPU_PPC64
IBM PowerPC, 64-bit.
Definition coff.h:147
@ CPU_I386
Intel x86-32, introduced with the Intel 80386.
Definition coff.h:47
@ CPU_ARM
ARM, also known as ARM32 or AArch32; also represents Thumb.
Definition coff.h:177
@ CPU_EFI
EFI bytecode.
Definition coff.h:201
@ CPU_M68K
Motorola 68000 and compatibles.
Definition coff.h:53
@ CPU_I860
Intel i860.
Definition coff.h:165
@ CPU_WE32K
AT&T Bellmac 32, Western Electric 32000 and family.
Definition coff.h:117
@ CPU_M88K
Motorola 88000.
Definition coff.h:111
@ CPU_SH
Hitachi SuperH family.
Definition coff.h:171
@ CPU_HPPA
Hewlett-Packard PA-RISC.
Definition coff.h:195
@ CPU_SHARC
SHARC from Analog Devices.
Definition coff.h:150
@ CPU_ARM64
ARM64, also known as AArch64.
Definition coff.h:237
@ CPU_MIPS
MIPS architecture.
Definition coff.h:105
@ CPU_W65
WDC 65C816.
Definition coff.h:61
@ CPU_RISCV64
RISC-V 64.
Definition coff.h:213
@ CPU_RISCV128
RISC-V 128.
Definition coff.h:219
@ CPU_AM29K
AMD 29000.
Definition coff.h:129
static constexpr uint16_t REL_ARM64_ADDR32
32-bit virtual address of symbol
Definition coff.h:474
static constexpr uint16_t REL_ARM_SECREL
32-bit offset from section start (debugging)
Definition coff.h:457
static constexpr uint16_t R_SEG12
(Intel x86) 16-bit segment selector of symbol
Definition coff.h:354
static constexpr uint16_t REL_AMD64_ABSOLUTE
No relocation.
Definition coff.h:406
static constexpr uint16_t R_IND16
16-bit indirect address of symbol
Definition coff.h:342
static constexpr uint16_t REL_ARM64_REL32
32-bit relative address of symbol
Definition coff.h:506
::EndianType endiantype
The byte order.
Definition coff.h:1868
uint32_t relocations_offset
Concurrent DOS 68K: Offset to relocations.
Definition coff.h:2090
static constexpr uint16_t REL_ALPHA_REFQ3
The second most significant 16 bits of the 64-bit virtual address of symbol; this relocation must be ...
Definition coff.h:551
static constexpr uint16_t REL_AMD64_PAIR
?
Definition coff.h:436
static constexpr uint16_t REL_ARM64_TOKEN
CLR token.
Definition coff.h:496
static constexpr uint16_t REL_AMD64_REL32_5
32-bit relative address of symbol minus 5
Definition coff.h:424
bool option_no_relocation
Suppress relocation generation, only relevant for Concurrent DOS 68K and FlexOS 386 libraries,...
Definition coff.h:2067
static constexpr uint16_t REL_ALPHA_REFQUAD
64-bit virtual address of symbol
Definition coff.h:517
static constexpr uint16_t R_PCRWORD
16-bit PC relative address of symbol
Definition coff.h:374
static constexpr uint16_t REL_I386_TOKEN
CLR token.
Definition coff.h:397
static constexpr uint16_t R_IND32
32-bit indirect address of symbol
Definition coff.h:364
static constexpr uint16_t REL_I386_SEG12
16-bit segment selector of symbol (not supported)
Definition coff.h:391
uint32_t stub_size
Size of MZ stub, only used for DJGPP COFF executables.
Definition coff.h:2077
std::shared_ptr< Linker::Segment > stack
Concurrent DOS 68K and FlexOS 386: The stack segment, not stored as part of any section.
Definition coff.h:2082
void SetupOptions(std::shared_ptr< Linker::OutputFormat > format) override
Initializes the reader for linking purposes.
Definition coff.cc:2686
static constexpr uint16_t REL_ARM_BRANCH24
24-bit ARM relative address of symbol
Definition coff.h:449
static constexpr uint16_t REL_ARM_ADDR32NB
32-bit relative virtual address of symbol
Definition coff.h:447
void GenerateFile(std::string filename, Linker::Module &module) override
The main function that handles processing, calculating and generating the final image.
Definition coff.cc:4071
uint16_t section_count
Section count (COFF name: f_nscns)
Definition coff.h:1308
static constexpr uint16_t REL_ARM_SECTION
16-bit section index (debugging)
Definition coff.h:455
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition coff.cc:2342
::Timestamp< POSIX_clock > timestamp
Time stamp, unused (COFF name: f_timdat)
Definition coff.h:1312
static constexpr uint16_t R_DIR24
24-bit direct address of symbol
Definition coff.h:344
static constexpr uint16_t REL_ARM64_REL21
12-bit relative address of symbol for ADR
Definition coff.h:482
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition coff.cc:2051
uint16_t target
TI system target ID.
Definition coff.h:1336
static constexpr uint16_t REL_ALPHA_SECTION
16-bit section index (debugging)
Definition coff.h:541
uint32_t entry_address
Entry address, gets stored in optional header later.
Definition coff.h:2086
relocation_format_type
Definition coff.h:284
@ TICOFF_10
A 10-byte relocation used for TICOFF.
Definition coff.h:300
@ ECOFF_8
An 8-byte relocation, used for 32-bit ECOFF MIPS binaries.
Definition coff.h:292
@ XCOFF_10
A 10-byte relocation, used for 32-bit XCOFF32 binaries.
Definition coff.h:296
@ ECOFF_16
A 16-byte relocation, used for 64-bit ECOFF Alpha binaries.
Definition coff.h:294
@ XCOFF_14
A 14-byte relocation, used for 64-bit XCOFF64 binaries.
Definition coff.h:298
@ TICOFF_12
A 12-byte relocation used for TICOFF.
Definition coff.h:302
@ COFF_16
A 16-byte relocation, as stored by the Z80/Z8000 GNU assembler.
Definition coff.h:290
@ COFF_14
A 14-byte relocation.
Definition coff.h:288
@ COFF_10
The standard 10-byte UNIX COFF relocation format, also used for Microsoft PE COFF objects.
Definition coff.h:286
static constexpr uint16_t REL_ARM64_ADDR64
64-bit virtual address of symbol
Definition coff.h:500
static constexpr uint16_t REL_AMD64_ADDR32
32-bit virtual address of symbol
Definition coff.h:410
static constexpr uint16_t R_IND24
24-bit indirect address of symbol
Definition coff.h:362
static constexpr uint16_t REL_ARM64_ABSOLUTE
No relocation.
Definition coff.h:472
opthdr_magic_type
Value stored as the magic of the a.out header.
Definition coff.h:1940
@ MAGIC_FLEXOS386_SHLIB
Magic number for shared libraries in FlexOS 386.
Definition coff.h:1968
@ SHMAGIC
Shared library.
Definition coff.h:1956
@ MAGIC_FLEXOS386
Magic number required by FlexOS 386.
Definition coff.h:1960
@ NMAGIC
Shared text - text segment is write protected, data segment follows on the next page.
Definition coff.h:1948
@ ZMAGIC
Demand paged.
Definition coff.h:1952
@ OMAGIC
Impure format - text segment is not write protected, text and data segment are contiguous.
Definition coff.h:1944
@ MAGIC_FLEXOS386_USELIB
Magic number required by FlexOS 386 programs participating in shared linking.
Definition coff.h:1964
static constexpr uint16_t REL_THUMB_BRANCH24
24-bit Thumb relative address of symbol
Definition coff.h:463
static constexpr uint16_t R_OPT16
16-bit (WE32K) optimized indirect address of symbol
Definition coff.h:360
static constexpr uint16_t REL_AMD64_SECREL
32-bit offset from section start (debugging)
Definition coff.h:428
uint32_t symbol_count
The number of symbols (COFF name: f_nsyms)
Definition coff.h:1320
void AssignMagicValue()
Loads the currently set CPU value in the currently set byte order into the COFF header signature.
Definition coff.cc:1990
static constexpr uint16_t REL_I386_SECREL
32-bit offset from section start (debugging)
Definition coff.h:395
static constexpr uint16_t REL_ALPHA_SECRELLO
Low 16 bits of 32-bit offset from section start (debugging)
Definition coff.h:547
static constexpr uint16_t REL_I386_DIR32NB
32-bit relative virtual address of symbol
Definition coff.h:389
static constexpr uint16_t R_PCRBYTE
8-bit PC relative address of symbol
Definition coff.h:372
static constexpr uint16_t R_DIR16
16-bit direct address of symbol
Definition coff.h:338
static constexpr uint16_t REL_ARM64_ADDR32NB
32-bit relative virtual address of symbol
Definition coff.h:476
static constexpr uint16_t REL_I386_ABSOLUTE
No relocation.
Definition coff.h:381
static constexpr uint16_t REL_ARM64_BRANCH14
14-bit relative address of symbol for TBZ/TBNZ
Definition coff.h:504
void SetOptions(std::map< std::string, std::string > &options) override
Passes command line parameters as settings over to format object.
Definition coff.cc:3350
static constexpr uint16_t REL_I386_DIR16
16-bit virtual address of symbol (not supported)
Definition coff.h:383
static constexpr uint16_t R_REL24
24-bit relative address of symbol
Definition coff.h:346
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition coff.cc:3783
::EndianType GetEndianType() const
Retrieves the natural byte order for the architecture.
Definition coff.cc:130
std::shared_ptr< Linker::Segment > GetInitSegment()
Only used by FlexOS 386.
Definition coff.cc:3753
void OnCallDirective(Linker::Module &module, std::string identifier) override
Callback function for the CALL directive.
Definition coff.cc:3409
static constexpr uint16_t R_OFF8
8-bit low byte of address of symbol
Definition coff.h:350
static constexpr uint16_t REL_ARM64_SECTION
16-bit section index (debugging)
Definition coff.h:498
offset_t symbol_table_offset
Offset to the first symbol (COFF name: f_symptr)
Definition coff.h:1316
static constexpr uint16_t R_AUX
Auxiliary relocation.
Definition coff.h:358
static constexpr uint16_t REL_ALPHA_HINT
14-bit hint for jump target
Definition coff.h:529
static constexpr uint16_t REL_ARM64_PAGEBASE_REL21
Page base of symbol for ADRP.
Definition coff.h:480
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 coff.cc:3513
static constexpr uint16_t REL_AMD64_SREL32
?
Definition coff.h:434
static constexpr uint16_t REL_AMD64_ADDR64
64-bit virtual address of symbol
Definition coff.h:408
static constexpr uint16_t REL_ALPHA_BRADDR
21-bit relative address of symbol
Definition coff.h:527
std::string GetDefaultExtension(Linker::Module &module, std::string filename) const override
Appends a default extension to the filename.
Definition coff.cc:4237
static constexpr uint16_t REL_ARM64_SECREL
32-bit offset from section start (debugging)
Definition coff.h:488
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition coff.cc:2354
static constexpr uint16_t REL_ARM_PAIR
?
Definition coff.h:467
static constexpr uint16_t REL_AMD64_ADDR32NB
32-bit relative virtual address of symbol
Definition coff.h:412
static constexpr uint16_t REL_ALPHA_REFLONGNB
32-bit relative virtual address of symbol
Definition coff.h:545
std::unique_ptr< OptionalHeader > optional_header
The optional header instance used for reading/writing the COFF file.
Definition coff.h:1374
static constexpr uint16_t REL_I386_REL16
16-bit relative address of symbol (not supported)
Definition coff.h:385
static constexpr uint16_t REL_AMD64_REL32_1
32-bit relative address of symbol minus 1
Definition coff.h:416
static constexpr uint16_t REL_AMD64_TOKEN
CLR token.
Definition coff.h:432
uint16_t flags
COFF flags, such as whether the file is executable (f_flags)
Definition coff.h:1332
static constexpr uint16_t R_RELBYTE
8-bit direct (symbol relative) address of symbol
Definition coff.h:366
cpu cpu_type
The CPU type, reflected by the first 16-bit word of a COFF file.
Definition coff.h:1863
static constexpr uint16_t REL_ARM64_SECREL_LOW12L
Low 12 bits of offset from section start for LDR.
Definition coff.h:494
static constexpr uint16_t REL_ALPHA_GPRELLO
Low 16 bits of 32-bit global pointer relative address of symbol.
Definition coff.h:557
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:1009
A brief record, such as a relocation or imported library.
Definition dumper.h:923
A record that represents a region within the file.
Definition dumper.h:902
Represents abstract data contents whose data can be written to a file.
Definition image.h:17
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(const std::shared_ptr< 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:218
virtual void GenerateModule(ModuleCollector &linker, std::string file_name, bool is_library=false) const
Loads the information into a module object.
Definition format.cc:226
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:499
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 to collect sections into segments.
Definition segment_manager.h:32
Definition mzexe.h:356
Definition coff.h:1377
Definition coff.h:265
static constexpr uint32_t INFO
COFF section flag: Comment section (COFF name: STYP_INFO)
Definition coff.h:1049
static constexpr uint32_t NOLOAD
COFF section flag: Noload section (COFF name: STYP_NOLOAD)
Definition coff.h:1041
static constexpr uint32_t OVER
COFF section flag: Overlay section (COFF name: STYP_OVER)
Definition coff.h:1051
static constexpr uint32_t COPY
COFF section flag: Copy section (COFF name: STYP_COPY)
Definition coff.h:1047
static constexpr uint32_t PAD
COFF section flag: Padding section (COFF name: STYP_PAD)
Definition coff.h:1045
static constexpr uint32_t LIB
COFF section flag: Library section (also used by X/GEM to store library information) (COFF name: STYP...
Definition coff.h:1053
static constexpr uint32_t DSECT
COFF section flag: Dummy section (COFF name: STYP_DSECT)
Definition coff.h:1039
static constexpr uint32_t GROUP
COFF section flag: Grouped section, formed from input sections (COFF name: STYP_GROUP)
Definition coff.h:1043
static constexpr uint32_t SDATA
ECOFF section flag: "Small data" (ECOFF name: STYP_SDATA)
Definition coff.h:1062
static constexpr uint32_t DYNSYM
ECOFF section flag: Dynamic linking symbol table (ECOFF name: STYP_DYNSYM)
Definition coff.h:1072
static constexpr uint32_t REL_DYN
ECOFF section flag: Dynamic relocation information (ECOFF name: STYP_REL_DYN)
Definition coff.h:1074
static constexpr uint32_t XDATA
ECOFF section flag: Exception scope table (ECOFF name: STYP_XDATA)
Definition coff.h:1094
static constexpr uint32_t MSYM
ECOFF section flag: Additional dynamic linking symbol table (ECOFF name: STYP_MSYM)
Definition coff.h:1082
static constexpr uint32_t LITA
ECOFF section flag: Address literals (ECOFF name: STYP_LITA)
Definition coff.h:1104
static constexpr uint32_t GOT
ECOFF section flag: Global offset table (ECOFF name: STYP_GOT)
Definition coff.h:1068
static constexpr uint32_t SBSS
ECOFF section flag: "Small bss" (ECOFF name: STYP_SBSS)
Definition coff.h:1064
static constexpr uint32_t DYNSTR
ECOFF section flag: Dynamic linking string table (ECOFF name: STYP_DYNSTR)
Definition coff.h:1076
static constexpr uint32_t TLSINIT
ECOFF section flag: Initialization for TLS data (ECOFF name: STYP_TLSINIT)
Definition coff.h:1100
static constexpr uint32_t NRELOC_OVERFLOWED
ECOFF section flag: the s_nreloc field overflowed (ECOFF name: S_NRELOC_OVFL)
Definition coff.h:1110
static constexpr uint32_t HASH
ECOFF section flag: Dynamic symbol hash table (ECOFF name: STYP_HASH)
Definition coff.h:1078
static constexpr uint32_t EXTMASK
ECOFF section flag: Multiple bit flag values.
Definition coff.h:1084
static constexpr uint32_t TLSBSS
ECOFF section flag: Uninitialized TLS data (ECOFF name: STYP_TLSBSS)
Definition coff.h:1098
static constexpr uint32_t FINI
ECOFF section flag: Termination text (ECOFF name: STYP_FINI)
Definition coff.h:1088
static constexpr uint32_t LIT4
ECOFF section flag: 4-byte literals (ECOFF name: STYP_LIT8)
Definition coff.h:1108
static constexpr uint32_t RDATA
ECOFF section flag: Section contains read-only data (ECOFF name: STYP_RDATA)
Definition coff.h:1060
static constexpr uint32_t INIT
ECOFF section flag: Initialization text (ECOFF name: STYP_INIT)
Definition coff.h:1112
static constexpr uint32_t TLSDATA
ECOFF section flag: Initialized TLS data (ECOFF name: STYP_TLSDATA)
Definition coff.h:1096
static constexpr uint32_t COMMENT
ECOFF section flag: Comment section (ECOFF name: STYP_COMMENT)
Definition coff.h:1090
static constexpr uint32_t LIT8
ECOFF section flag: 8-byte literals (ECOFF name: STYP_LIT8)
Definition coff.h:1106
static constexpr uint32_t CONFLICT
ECOFF section flag: Additional dynamic linking information (ECOFF name: STYP_CONFLICT)
Definition coff.h:1086
static constexpr uint32_t PDATA
ECOFF section flag: Exception procedure table (ECOFF name: STYP_PDATA)
Definition coff.h:1102
static constexpr uint32_t DSOLIST
ECOFF section flag: Shared library dependency list (ECOFF name: STYP_DSOLIST)
Definition coff.h:1080
static constexpr uint32_t UCODE
ECOFF section flag: (ECOFF name: STYP_UCODE)
Definition coff.h:1066
static constexpr uint32_t RCONST
ECOFF section flag: Read-only constants (ECOFF name: STYP_RCONST)
Definition coff.h:1092
static constexpr uint32_t DYNAMIC
ECOFF section flag: Dynamic linking information (ECOFF name: STYP_DYNAMIC)
Definition coff.h:1070
static constexpr uint32_t LNK_INFO
PE section flag: Section contains comments.
Definition coff.h:1123
static constexpr uint32_t MEM_NOT_PAGED
PE section flag: Section is not pageable.
Definition coff.h:1149
static constexpr uint32_t GPREL
PE section flag: Section data accessed through the global pointer.
Definition coff.h:1129
static constexpr uint32_t MEM_LOCKED
PE section flag: reserved.
Definition coff.h:1135
static constexpr uint32_t LNK_COMDAT
PE section flag: Section contains COMDAT data.
Definition coff.h:1127
static constexpr uint32_t MEM_NOT_CACHED
PE section flag: Section cannot be cached.
Definition coff.h:1147
static constexpr uint32_t MEM_WRITE
PE section flag: Section can be written to.
Definition coff.h:1157
static constexpr uint32_t LNK_OTHER
PE section flag: reserved.
Definition coff.h:1121
static constexpr uint32_t MEM_PURGEABLE
PE section flag: reserved.
Definition coff.h:1131
static constexpr uint32_t MEM_16BIT
PE section flag: reserved.
Definition coff.h:1133
static constexpr uint32_t MEM_PRELOAD
PE section flag: reserved.
Definition coff.h:1137
static constexpr uint32_t ALIGN_SHIFT
PE section flag: alignment shift.
Definition coff.h:1141
static constexpr uint32_t MEM_SHARED
PE section flag: Section can be shared in memory.
Definition coff.h:1151
static constexpr uint32_t ALIGN_MASK
PE section flag: alignment mask.
Definition coff.h:1139
static constexpr uint32_t LNK_NRELOC_OVFL
PE section flag: Section contains more than 65535 relocations.
Definition coff.h:1143
static constexpr uint32_t TYPE_NO_PAD
PE section flag: Section should not be padded.
Definition coff.h:1119
static constexpr uint32_t MEM_EXECUTE
PE section flag: Section data can be executed.
Definition coff.h:1153
static constexpr uint32_t MEM_READ
PE section flag: Section can be read from.
Definition coff.h:1155
static constexpr uint32_t LNK_REMOVE
PE section flag: Section should be removed when generating image.
Definition coff.h:1125
static constexpr uint32_t MEM_DISCARDABLE
PE section flag: Section can be discarded.
Definition coff.h:1145
static constexpr uint32_t PASS
TI COFF section flag: Section should not be changed (TI COFF name: STYP_PASS)
Definition coff.h:1201
static constexpr uint32_t VECTOR
TI COFF section flag: Section contains vector table (TI COFF name: STYP_VECTOR)
Definition coff.h:1205
static constexpr uint32_t CLINK
TI COFF section flag: Conditional linking required (TI COFF name: STYP_CLINK)
Definition coff.h:1203
static constexpr uint32_t NOLOAD
COFF section flag: Noload section (COFF name: STYP_NOLOAD)
Definition coff.h:1191
static constexpr uint32_t COPY
COFF section flag: Copy section (COFF name: STYP_COPY)
Definition coff.h:1197
static constexpr uint32_t DSECT
COFF section flag: Dummy section (COFF name: STYP_DSECT)
Definition coff.h:1189
static constexpr uint32_t PAD
COFF section flag: Padding section (COFF name: STYP_PAD)
Definition coff.h:1195
static constexpr uint32_t PADDED
TI COFF section flag: Section has been padded (TI COFF name: STYP_PADDED)
Definition coff.h:1207
static constexpr uint32_t GROUP
COFF section flag: Grouped section, formed from input sections (COFF name: STYP_GROUP)
Definition coff.h:1193
static constexpr uint32_t BLOCK
TI COFF section flag: Alignment used as a blocking factor (TI COFF name: STYP_BLOCK)
Definition coff.h:1199
static constexpr uint32_t OVERFLO
XCOFF section flag: (XCOFF name: STYP_OVERFLO)
Definition coff.h:1182
static constexpr uint32_t INFO
XCOFF section flag: Comment section (XCOFF name: STYP_INFO)
Definition coff.h:1170
static constexpr uint32_t DWARF
XCOFF section flag: DWARF relocation section (XCOFF name: STYP_DWARF)
Definition coff.h:1166
static constexpr uint32_t EXCEPT
XCOFF section flag: Exception section (XCOFF name: STYP_EXCEPT)
Definition coff.h:1168
static constexpr uint32_t TYPCHK
XCOFF section flag: Type-check section (XCOFF name: STYP_TYPCHK)
Definition coff.h:1180
static constexpr uint32_t LOADER
XCOFF section flag: Loader section (XCOFF name: STYP_LOADER)
Definition coff.h:1176
static constexpr uint32_t TBSS
XCOFF section flag: Uninitialized thread-local data (XCOFF name: STYP_TBSS)
Definition coff.h:1174
static constexpr uint32_t TDATA
XCOFF section flag: Initialized thread-local data (XCOFF name: STYP_TDATA)
Definition coff.h:1172
static constexpr uint32_t DEBUG
XCOFF section flag: Debug section (XCOFF name: STYP_DEBUG)
Definition coff.h:1178
static constexpr uint32_t PAD
XCOFF section flag: Padding section (XCOFF name: STYP_PAD)
Definition coff.h:1164