-
Notifications
You must be signed in to change notification settings - Fork 1
/
elf.h
2737 lines (2555 loc) · 104 KB
/
elf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//-
// Copyright (c) 2010 Joseph Koshy
// Copyright (c) 2015 Kai K.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.
// These definitions are based on:
// - The public specification of the ELF format as defined in the
// October 2009 draft of System V ABI.
// See: http://www.sco.com/developers/gabi/latest/ch4.intro.html
// - The May 1998 (version 1.5) draft of "The ELF-64 object format".
// - Processor-specific ELF ABI definitions for sparc, i386, amd64, mips,
// ia64, and powerpc processors.
// - The "Linkers and Libraries Guide", from Sun Microsystems.
#include "stddefs.h"
// Types of capabilities.
#define _ELF_DEFINE_CAPABILITIES() \
_ELF_DEFINE_CA(CA_SUNW_NULL, 0, "ignored") \
_ELF_DEFINE_CA(CA_SUNW_HW_1, 1, "hardware capability") \
_ELF_DEFINE_CA(CA_SUNW_SW_1, 2, "software capability")
#undef _ELF_DEFINE_CA
#define _ELF_DEFINE_CA(N, V, DESCR) N = V ,
enum Capabilities {
_ELF_DEFINE_CAPABILITIES()
CA__LAST__
};
//
// Flags used with dynamic linking entries.
//
#define _ELF_DEFINE_DYN_FLAGS() \
_ELF_DEFINE_DF(DF_ORIGIN, 0x1, \
"object being loaded may refer to $ORIGIN") \
_ELF_DEFINE_DF(DF_SYMBOLIC, 0x2, \
"search library for references before executable") \
_ELF_DEFINE_DF(DF_TEXTREL, 0x4, \
"relocation entries may modify text segment") \
_ELF_DEFINE_DF(DF_BIND_NOW, 0x8, \
"process relocation entries at load time") \
_ELF_DEFINE_DF(DF_STATIC_TLS, 0x10, \
"uses static thread-local storage")
#undef _ELF_DEFINE_DF
#define _ELF_DEFINE_DF(N, V, DESCR) N = V ,
enum DynFlags {
_ELF_DEFINE_DYN_FLAGS()
DF__LAST__
};
//
// Dynamic linking entry types.
///
#define _ELF_DEFINE_DYN_TYPES() \
_ELF_DEFINE_DT(DT_NULL, 0, "end of array") \
_ELF_DEFINE_DT(DT_NEEDED, 1, "names a needed library") \
_ELF_DEFINE_DT(DT_PLTRELSZ, 2, \
"size in bytes of associated relocation entries") \
_ELF_DEFINE_DT(DT_PLTGOT, 3, \
"address associated with the procedure linkage table") \
_ELF_DEFINE_DT(DT_HASH, 4, \
"address of the symbol hash table") \
_ELF_DEFINE_DT(DT_STRTAB, 5, \
"address of the table") \
_ELF_DEFINE_DT(DT_SYMTAB, 6, \
"address of the symbol table") \
_ELF_DEFINE_DT(DT_RELA, 7, \
"address of the relocation table") \
_ELF_DEFINE_DT(DT_RELASZ, 8, "size of the DT_RELA table") \
_ELF_DEFINE_DT(DT_RELAENT, 9, "size of each DT_RELA entry") \
_ELF_DEFINE_DT(DT_STRSZ, 10, "size of the string table") \
_ELF_DEFINE_DT(DT_SYMENT, 11, \
"size of a symbol table entry") \
_ELF_DEFINE_DT(DT_INIT, 12, \
"address of the initialization function") \
_ELF_DEFINE_DT(DT_FINI, 13, \
"address of the finalization function") \
_ELF_DEFINE_DT(DT_SONAME, 14, "names the shared object") \
_ELF_DEFINE_DT(DT_RPATH, 15, \
"runtime library search path") \
_ELF_DEFINE_DT(DT_SYMBOLIC, 16, \
"alter symbol resolution algorithm") \
_ELF_DEFINE_DT(DT_REL, 17, \
"address of the DT_REL table") \
_ELF_DEFINE_DT(DT_RELSZ, 18, "size of the DT_REL table") \
_ELF_DEFINE_DT(DT_RELENT, 19, "size of each DT_REL entry") \
_ELF_DEFINE_DT(DT_PLTREL, 20, \
"type of relocation entry in the procedure linkage table") \
_ELF_DEFINE_DT(DT_DEBUG, 21, "used for debugging") \
_ELF_DEFINE_DT(DT_TEXTREL, 22, \
"text segment may be written to during relocation") \
_ELF_DEFINE_DT(DT_JMPREL, 23, \
"address of relocation entries associated with the procedure linkage table") \
_ELF_DEFINE_DT(DT_BIND_NOW, 24, \
"bind symbols at loading time") \
_ELF_DEFINE_DT(DT_INIT_ARRAY, 25, \
"pointers to initialization functions") \
_ELF_DEFINE_DT(DT_FINI_ARRAY, 26, \
"pointers to termination functions") \
_ELF_DEFINE_DT(DT_INIT_ARRAYSZ, 27, "size of the DT_INIT_ARRAY") \
_ELF_DEFINE_DT(DT_FINI_ARRAYSZ, 28, "size of the DT_FINI_ARRAY") \
_ELF_DEFINE_DT(DT_RUNPATH, 29, \
"index of library search path string") \
_ELF_DEFINE_DT(DT_FLAGS, 30, \
"flags specific to the object being loaded") \
_ELF_DEFINE_DT(DT_ENCODING, 32, "standard semantics") \
_ELF_DEFINE_DT(DT_PREINIT_ARRAY, 32, \
"pointers to pre-initialization functions") \
_ELF_DEFINE_DT(DT_PREINIT_ARRAYSZ, 33, \
"size of pre-initialization array") \
_ELF_DEFINE_DT(DT_MAXPOSTAGS, 34, \
"the number of positive tags") \
_ELF_DEFINE_DT(DT_LOOS, 0x6000000D, \
"start of OS-specific types") \
_ELF_DEFINE_DT(DT_SUNW_AUXILIARY, 0x6000000D, \
"offset of string naming auxiliary filtees") \
_ELF_DEFINE_DT(DT_SUNW_RTLDINF, 0x6000000E, "rtld internal use") \
_ELF_DEFINE_DT(DT_SUNW_FILTER, 0x6000000F, \
"offset of string naming standard filtees") \
_ELF_DEFINE_DT(DT_SUNW_CAP, 0x60000010, \
"address of hardware capabilities section") \
_ELF_DEFINE_DT(DT_HIOS, 0x6FFFF000, \
"end of OS-specific types") \
_ELF_DEFINE_DT(DT_VALRNGLO, 0x6FFFFD00, \
"start of range using the d_val field") \
_ELF_DEFINE_DT(DT_GNU_PRELINKED, 0x6FFFFDF5, \
"prelinking timestamp") \
_ELF_DEFINE_DT(DT_GNU_CONFLICTSZ, 0x6FFFFDF6, \
"size of conflict section") \
_ELF_DEFINE_DT(DT_GNU_LIBLISTSZ, 0x6FFFFDF7, \
"size of library list") \
_ELF_DEFINE_DT(DT_CHECKSUM, 0x6FFFFDF8, \
"checksum for the object") \
_ELF_DEFINE_DT(DT_PLTPADSZ, 0x6FFFFDF9, \
"size of PLT padding") \
_ELF_DEFINE_DT(DT_MOVEENT, 0x6FFFFDFA, \
"size of DT_MOVETAB entries") \
_ELF_DEFINE_DT(DT_MOVESZ, 0x6FFFFDFB, \
"total size of the MOVETAB table") \
_ELF_DEFINE_DT(DT_FEATURE, 0x6FFFFDFC, "feature values") \
_ELF_DEFINE_DT(DT_POSFLAG_1, 0x6FFFFDFD, \
"dynamic position flags") \
_ELF_DEFINE_DT(DT_SYMINSZ, 0x6FFFFDFE, \
"size of the DT_SYMINFO table") \
_ELF_DEFINE_DT(DT_SYMINENT, 0x6FFFFDFF, \
"size of a DT_SYMINFO entry") \
_ELF_DEFINE_DT(DT_VALRNGHI, 0x6FFFFDFF, \
"end of range using the d_val field") \
_ELF_DEFINE_DT(DT_ADDRRNGLO, 0x6FFFFE00, \
"start of range using the d_ptr field") \
_ELF_DEFINE_DT(DT_GNU_HASH, 0x6FFFFEF5, \
"GNU style hash tables") \
_ELF_DEFINE_DT(DT_GNU_CONFLICT, 0x6FFFFEF8, \
"address of conflict section") \
_ELF_DEFINE_DT(DT_GNU_LIBLIST, 0x6FFFFEF9, \
"address of conflict section") \
_ELF_DEFINE_DT(DT_CONFIG, 0x6FFFFEFA, \
"configuration file") \
_ELF_DEFINE_DT(DT_DEPAUDIT, 0x6FFFFEFB, \
"string defining audit libraries") \
_ELF_DEFINE_DT(DT_AUDIT, 0x6FFFFEFC, \
"string defining audit libraries") \
_ELF_DEFINE_DT(DT_PLTPAD, 0x6FFFFEFD, "PLT padding") \
_ELF_DEFINE_DT(DT_MOVETAB, 0x6FFFFEFE, \
"address of a move table") \
_ELF_DEFINE_DT(DT_SYMINFO, 0x6FFFFEFF, \
"address of the symbol information table") \
_ELF_DEFINE_DT(DT_ADDRRNGHI, 0x6FFFFEFF, \
"end of range using the d_ptr field") \
_ELF_DEFINE_DT(DT_VERSYM, 0x6FFFFFF0, \
"address of the version section") \
_ELF_DEFINE_DT(DT_RELACOUNT, 0x6FFFFFF9, \
"count of RELA relocations") \
_ELF_DEFINE_DT(DT_RELCOUNT, 0x6FFFFFFA, \
"count of REL relocations") \
_ELF_DEFINE_DT(DT_FLAGS_1, 0x6FFFFFFB, "flag values") \
_ELF_DEFINE_DT(DT_VERDEF, 0x6FFFFFFC, \
"address of the version definition segment") \
_ELF_DEFINE_DT(DT_VERDEFNUM, 0x6FFFFFFD, \
"the number of version definition entries") \
_ELF_DEFINE_DT(DT_VERNEED, 0x6FFFFFFE, \
"address of section with needed versions") \
_ELF_DEFINE_DT(DT_VERNEEDNUM, 0x6FFFFFFF, \
"the number of version needed entries") \
_ELF_DEFINE_DT(DT_LOPROC, 0x70000000, \
"start of processor-specific types") \
_ELF_DEFINE_DT(DT_ARM_SYMTABSZ, 0x70000001, \
"number of entries in the dynamic symbol table") \
_ELF_DEFINE_DT(DT_SPARC_REGISTER, 0x70000001, \
"index of an STT_SPARC_REGISTER symbol") \
_ELF_DEFINE_DT(DT_ARM_PREEMPTMAP, 0x70000002, \
"address of the preemption map") \
_ELF_DEFINE_DT(DT_MIPS_RLD_VERSION, 0x70000001, \
"version ID for runtime linker interface") \
_ELF_DEFINE_DT(DT_MIPS_TIME_STAMP, 0x70000002, \
"timestamp") \
_ELF_DEFINE_DT(DT_MIPS_ICHECKSUM, 0x70000003, \
"checksum of all external strings and common sizes") \
_ELF_DEFINE_DT(DT_MIPS_IVERSION, 0x70000004, \
"string table index of a version string") \
_ELF_DEFINE_DT(DT_MIPS_FLAGS, 0x70000005, \
"MIPS-specific flags") \
_ELF_DEFINE_DT(DT_MIPS_BASE_ADDRESS, 0x70000006, \
"base address for the executable/DSO") \
_ELF_DEFINE_DT(DT_MIPS_CONFLICT, 0x70000008, \
"address of .conflict section") \
_ELF_DEFINE_DT(DT_MIPS_LIBLIST, 0x70000009, \
"address of .liblist section") \
_ELF_DEFINE_DT(DT_MIPS_LOCAL_GOTNO, 0x7000000A, \
"number of local GOT entries") \
_ELF_DEFINE_DT(DT_MIPS_CONFLICTNO, 0x7000000B, \
"number of entries in the .conflict section") \
_ELF_DEFINE_DT(DT_MIPS_LIBLISTNO, 0x70000010, \
"number of entries in the .liblist section") \
_ELF_DEFINE_DT(DT_MIPS_SYMTABNO, 0x70000011, \
"number of entries in the .dynsym section") \
_ELF_DEFINE_DT(DT_MIPS_UNREFEXTNO, 0x70000012, \
"index of first external dynamic symbol not ref'ed locally") \
_ELF_DEFINE_DT(DT_MIPS_GOTSYM, 0x70000013, \
"index of first dynamic symbol corresponds to a GOT entry") \
_ELF_DEFINE_DT(DT_MIPS_HIPAGENO, 0x70000014, \
"number of page table entries in GOT") \
_ELF_DEFINE_DT(DT_MIPS_RLD_MAP, 0x70000016, \
"address of runtime linker map") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_CLASS, 0x70000017, \
"Delta C++ class definition") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_CLASS_NO, 0x70000018, \
"number of entries in DT_MIPS_DELTA_CLASS") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_INSTANCE, 0x70000019, \
"Delta C++ class instances") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_INSTANCE_NO, 0x7000001A, \
"number of entries in DT_MIPS_DELTA_INSTANCE") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_RELOC, 0x7000001B, \
"Delta relocations") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_RELOC_NO, 0x7000001C, \
"number of entries in DT_MIPS_DELTA_RELOC") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_SYM, 0x7000001D, \
"Delta symbols refered by Delta relocations") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_SYM_NO, 0x7000001E, \
"number of entries in DT_MIPS_DELTA_SYM") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_CLASSSYM, 0x70000020, \
"Delta symbols for class declarations") \
_ELF_DEFINE_DT(DT_MIPS_DELTA_CLASSSYM_NO, 0x70000021, \
"number of entries in DT_MIPS_DELTA_CLASSSYM") \
_ELF_DEFINE_DT(DT_MIPS_CXX_FLAGS, 0x70000022, \
"C++ flavor flags") \
_ELF_DEFINE_DT(DT_MIPS_PIXIE_INIT, 0x70000023, \
"address of an initialization routine created by pixie") \
_ELF_DEFINE_DT(DT_MIPS_SYMBOL_LIB, 0x70000024, \
"address of .MIPS.symlib section") \
_ELF_DEFINE_DT(DT_MIPS_LOCALPAGE_GOTIDX, 0x70000025, \
"GOT index of first page table entry for a segment") \
_ELF_DEFINE_DT(DT_MIPS_LOCAL_GOTIDX, 0x70000026, \
"GOT index of first page table entry for a local symbol") \
_ELF_DEFINE_DT(DT_MIPS_HIDDEN_GOTIDX, 0x70000027, \
"GOT index of first page table entry for a hidden symbol") \
_ELF_DEFINE_DT(DT_MIPS_PROTECTED_GOTIDX, 0x70000028, \
"GOT index of first page table entry for a protected symbol") \
_ELF_DEFINE_DT(DT_MIPS_OPTIONS, 0x70000029, \
"address of .MIPS.options section") \
_ELF_DEFINE_DT(DT_MIPS_INTERFACE, 0x7000002A, \
"address of .MIPS.interface section") \
_ELF_DEFINE_DT(DT_MIPS_DYNSTR_ALIGN, 0x7000002B, "???") \
_ELF_DEFINE_DT(DT_MIPS_INTERFACE_SIZE, 0x7000002C, \
"size of .MIPS.interface section") \
_ELF_DEFINE_DT(DT_MIPS_RLD_TEXT_RESOLVE_ADDR, 0x7000002D, \
"address of _rld_text_resolve in GOT") \
_ELF_DEFINE_DT(DT_MIPS_PERF_SUFFIX, 0x7000002E, \
"default suffix of DSO to be appended by dlopen") \
_ELF_DEFINE_DT(DT_MIPS_COMPACT_SIZE, 0x7000002F, \
"size of a ucode compact relocation record (o32)") \
_ELF_DEFINE_DT(DT_MIPS_GP_VALUE, 0x70000030, \
"GP value of a specified GP relative range") \
_ELF_DEFINE_DT(DT_MIPS_AUX_DYNAMIC, 0x70000031, \
"address of an auxiliary dynamic table") \
_ELF_DEFINE_DT(DT_MIPS_PLTGOT, 0x70000032, \
"address of the PLTGOT") \
_ELF_DEFINE_DT(DT_MIPS_RLD_OBJ_UPDATE, 0x70000033, \
"object list update callback") \
_ELF_DEFINE_DT(DT_MIPS_RWPLT, 0x70000034, \
"address of a writable PLT") \
_ELF_DEFINE_DT(DT_PPC_GOT, 0x70000000, \
"value of _GLOBAL_OFFSET_TABLE_") \
_ELF_DEFINE_DT(DT_PPC_TLSOPT, 0x70000001, \
"TLS descriptor should be optimized") \
_ELF_DEFINE_DT(DT_PPC64_GLINK, 0x70000000, \
"address of .glink section") \
_ELF_DEFINE_DT(DT_PPC64_OPD, 0x70000001, \
"address of .opd section") \
_ELF_DEFINE_DT(DT_PPC64_OPDSZ, 0x70000002, \
"size of .opd section") \
_ELF_DEFINE_DT(DT_PPC64_TLSOPT, 0x70000003, \
"TLS descriptor should be optimized") \
_ELF_DEFINE_DT(DT_AUXILIARY, 0x7FFFFFFD, \
"offset of string naming auxiliary filtees") \
_ELF_DEFINE_DT(DT_USED, 0x7FFFFFFE, "ignored") \
_ELF_DEFINE_DT(DT_FILTER, 0x7FFFFFFF, \
"index of string naming filtees") \
_ELF_DEFINE_DT(DT_HIPROC, 0x7FFFFFFF, \
"end of processor-specific types")
#undef _ELF_DEFINE_DT
#define _ELF_DEFINE_DT(N, V, DESCR) N = V ,
enum DynTypes {
_ELF_DEFINE_DYN_TYPES()
DT__LAST__ = DT_HIPROC
};
#define DT_DEPRECATED_SPARC_REGISTER DT_SPARC_REGISTER
//
// Flags used in the executable header (field: e_flags).
///
#define _ELF_DEFINE_EHDR_FLAGS() \
_ELF_DEFINE_EF(EF_ARM_RELEXEC, 0x00000001, \
"dynamic segment describes only how to relocate segments") \
_ELF_DEFINE_EF(EF_ARM_HASENTRY, 0x00000002, \
"e_entry contains a program entry point") \
_ELF_DEFINE_EF(EF_ARM_SYMSARESORTED, 0x00000004, \
"subsection of symbol table is sorted by symbol value") \
_ELF_DEFINE_EF(EF_ARM_DYNSYMSUSESEGIDX, 0x00000008, \
"dynamic symbol st_shndx = containing segment index + 1") \
_ELF_DEFINE_EF(EF_ARM_MAPSYMSFIRST, 0x00000010, \
"mapping symbols precede other local symbols in symtab") \
_ELF_DEFINE_EF(EF_ARM_BE8, 0x00800000, \
"file contains BE-8 code") \
_ELF_DEFINE_EF(EF_ARM_LE8, 0x00400000, \
"file contains LE-8 code") \
_ELF_DEFINE_EF(EF_ARM_EABIMASK, 0xFF000000, \
"mask for ARM EABI version number (0 denotes GNU or unknown)") \
_ELF_DEFINE_EF(EF_ARM_EABI_UNKNOWN, 0x00000000, \
"Unknown or GNU ARM EABI version number") \
_ELF_DEFINE_EF(EF_ARM_EABI_VER1, 0x01000000, \
"ARM EABI version 1") \
_ELF_DEFINE_EF(EF_ARM_EABI_VER2, 0x02000000, \
"ARM EABI version 2") \
_ELF_DEFINE_EF(EF_ARM_EABI_VER3, 0x03000000, \
"ARM EABI version 3") \
_ELF_DEFINE_EF(EF_ARM_EABI_VER4, 0x04000000, \
"ARM EABI version 4") \
_ELF_DEFINE_EF(EF_ARM_EABI_VER5, 0x05000000, \
"ARM EABI version 5") \
_ELF_DEFINE_EF(EF_ARM_INTERWORK, 0x00000004, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_ARM_APCS_26, 0x00000008, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_ARM_APCS_FLOAT, 0x00000010, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_ARM_PIC, 0x00000020, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_ARM_ALIGN8, 0x00000040, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_ARM_NEW_ABI, 0x00000080, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_ARM_OLD_ABI, 0x00000100, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_ARM_SOFT_FLOAT, 0x00000200, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_ARM_VFP_FLOAT, 0x00000400, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_ARM_MAVERICK_FLOAT, 0x00000800, \
"GNU EABI extension") \
_ELF_DEFINE_EF(EF_MIPS_NOREORDER, 0x00000001, \
"at least one .noreorder directive appeared in the source") \
_ELF_DEFINE_EF(EF_MIPS_PIC, 0x00000002, \
"file contains position independent code") \
_ELF_DEFINE_EF(EF_MIPS_CPIC, 0x00000004, \
"file's code uses standard conventions for calling PIC") \
_ELF_DEFINE_EF(EF_MIPS_UCODE, 0x00000010, \
"file contains UCODE (obsolete)") \
_ELF_DEFINE_EF(EF_MIPS_ABI2, 0x00000020, \
"file follows MIPS III 32-bit ABI") \
_ELF_DEFINE_EF(EF_MIPS_OPTIONS_FIRST, 0x00000080, \
"ld(1) should process .MIPS.options section first") \
_ELF_DEFINE_EF(EF_MIPS_ARCH_ASE, 0x0F000000, \
"file uses application-specific architectural extensions") \
_ELF_DEFINE_EF(EF_MIPS_ARCH_ASE_MDMX, 0x08000000, \
"file uses MDMX multimedia extensions") \
_ELF_DEFINE_EF(EF_MIPS_ARCH_ASE_M16, 0x04000000, \
"file uses MIPS-16 ISA extensions") \
_ELF_DEFINE_EF(EF_MIPS_ARCH, 0xF0000000, \
"4-bit MIPS architecture field") \
_ELF_DEFINE_EF(EF_PPC_EMB, 0x80000000, \
"Embedded PowerPC flag") \
_ELF_DEFINE_EF(EF_PPC_RELOCATABLE, 0x00010000, \
"-mrelocatable flag") \
_ELF_DEFINE_EF(EF_PPC_RELOCATABLE_LIB, 0x00008000, \
"-mrelocatable-lib flag") \
_ELF_DEFINE_EF(EF_SPARC_EXT_MASK, 0x00ffff00, \
"Vendor Extension mask") \
_ELF_DEFINE_EF(EF_SPARC_32PLUS, 0x00000100, \
"Generic V8+ features") \
_ELF_DEFINE_EF(EF_SPARC_SUN_US1, 0x00000200, \
"Sun UltraSPARCTM 1 Extensions") \
_ELF_DEFINE_EF(EF_SPARC_HAL_R1, 0x00000400, "HAL R1 Extensions") \
_ELF_DEFINE_EF(EF_SPARC_SUN_US3, 0x00000800, \
"Sun UltraSPARC 3 Extensions") \
_ELF_DEFINE_EF(EF_SPARCV9_MM, 0x00000003, \
"Mask for Memory Model") \
_ELF_DEFINE_EF(EF_SPARCV9_TSO, 0x00000000, \
"Total Store Ordering") \
_ELF_DEFINE_EF(EF_SPARCV9_PSO, 0x00000001, \
"Partial Store Ordering") \
_ELF_DEFINE_EF(EF_SPARCV9_RMO, 0x00000002, \
"Relaxed Memory Ordering")
#undef _ELF_DEFINE_EF
#define _ELF_DEFINE_EF(N, V, DESCR) N = V ,
enum EhdrFlags {
_ELF_DEFINE_EHDR_FLAGS()
EF__LAST__
};
//
// Offsets in the `ei_ident[]` field of an ELF executable header.
///
#define _ELF_DEFINE_EI_OFFSETS() \
_ELF_DEFINE_EI(EI_MAG0, 0, "magic number") \
_ELF_DEFINE_EI(EI_MAG1, 1, "magic number") \
_ELF_DEFINE_EI(EI_MAG2, 2, "magic number") \
_ELF_DEFINE_EI(EI_MAG3, 3, "magic number") \
_ELF_DEFINE_EI(EI_CLASS, 4, "file class") \
_ELF_DEFINE_EI(EI_DATA, 5, "data encoding") \
_ELF_DEFINE_EI(EI_VERSION, 6, "file version") \
_ELF_DEFINE_EI(EI_OSABI, 7, "OS ABI kind") \
_ELF_DEFINE_EI(EI_ABIVERSION, 8, "OS ABI version") \
_ELF_DEFINE_EI(EI_PAD, 9, "padding start") \
_ELF_DEFINE_EI(EI_NIDENT, 16, "total size")
#undef _ELF_DEFINE_EI
#define _ELF_DEFINE_EI(N, V, DESCR) N = V ,
enum EiOffset{
_ELF_DEFINE_EI_OFFSETS()
EI__LAST__
};
//
// The ELF class of an object.
///
#define _ELF_DEFINE_ELFCLASS() \
_ELF_DEFINE_EC(ELFCLASSNONE, 0, "Unknown ELF class") \
_ELF_DEFINE_EC(ELFCLASS32, 1, "32 bit objects") \
_ELF_DEFINE_EC(ELFCLASS64, 2, "64 bit objects")
#undef _ELF_DEFINE_EC
#define _ELF_DEFINE_EC(N, V, DESCR) N = V ,
enum ElfClass : unsigned char {
_ELF_DEFINE_ELFCLASS()
EC__LAST__
};
//
// Endianness of data in an ELF object.
///
#define _ELF_DEFINE_ELF_DATA_ENDIANNESS() \
_ELF_DEFINE_ED(ELFDATANONE, 0, "Unknown data endianness") \
_ELF_DEFINE_ED(ELFDATA2LSB, 1, "little endian") \
_ELF_DEFINE_ED(ELFDATA2MSB, 2, "big endian")
#undef _ELF_DEFINE_ED
#define _ELF_DEFINE_ED(N, V, DESCR) N = V ,
enum ElfDataEndianness : unsigned char {
_ELF_DEFINE_ELF_DATA_ENDIANNESS()
ED__LAST__
};
//
// Values of the magic numbers used in identification array.
///
#define _ELF_DEFINE_ELF_MAGIC() \
_ELF_DEFINE_EMAG(ELFMAG0, 0x7F) \
_ELF_DEFINE_EMAG(ELFMAG1, 'E') \
_ELF_DEFINE_EMAG(ELFMAG2, 'L') \
_ELF_DEFINE_EMAG(ELFMAG3, 'F')
#undef _ELF_DEFINE_EMAG
#define _ELF_DEFINE_EMAG(N, V) N = V ,
enum ElfMagic : unsigned char {
_ELF_DEFINE_ELF_MAGIC()
ELFMAG__LAST__
};
//
// ELF OS ABI field.
///
#define _ELF_DEFINE_ELF_OSABI() \
_ELF_DEFINE_EABI(ELFOSABI_NONE, 0, \
"No extensions or unspecified") \
_ELF_DEFINE_EABI(ELFOSABI_SYSV, 0, "SYSV") \
_ELF_DEFINE_EABI(ELFOSABI_HPUX, 1, "Hewlett-Packard HP-UX") \
_ELF_DEFINE_EABI(ELFOSABI_NETBSD, 2, "NetBSD") \
_ELF_DEFINE_EABI(ELFOSABI_GNU, 3, "GNU") \
_ELF_DEFINE_EABI(ELFOSABI_HURD, 4, "GNU/HURD") \
_ELF_DEFINE_EABI(ELFOSABI_86OPEN, 5, "86Open Common ABI") \
_ELF_DEFINE_EABI(ELFOSABI_SOLARIS, 6, "Sun Solaris") \
_ELF_DEFINE_EABI(ELFOSABI_AIX, 7, "AIX") \
_ELF_DEFINE_EABI(ELFOSABI_IRIX, 8, "IRIX") \
_ELF_DEFINE_EABI(ELFOSABI_FREEBSD, 9, "FreeBSD") \
_ELF_DEFINE_EABI(ELFOSABI_TRU64, 10, "Compaq TRU64 UNIX") \
_ELF_DEFINE_EABI(ELFOSABI_MODESTO, 11, "Novell Modesto") \
_ELF_DEFINE_EABI(ELFOSABI_OPENBSD, 12, "Open BSD") \
_ELF_DEFINE_EABI(ELFOSABI_OPENVMS, 13, "Open VMS") \
_ELF_DEFINE_EABI(ELFOSABI_NSK, 14, \
"Hewlett-Packard Non-Stop Kernel") \
_ELF_DEFINE_EABI(ELFOSABI_AROS, 15, "Amiga Research OS") \
_ELF_DEFINE_EABI(ELFOSABI_FENIXOS, 16, \
"The FenixOS highly scalable multi-core OS") \
_ELF_DEFINE_EABI(ELFOSABI_ARM_AEABI, 64, \
"ARM specific symbol versioning extensions") \
_ELF_DEFINE_EABI(ELFOSABI_ARM, 97, "ARM ABI") \
_ELF_DEFINE_EABI(ELFOSABI_STANDALONE, 255, \
"Standalone (embedded) application")
#undef _ELF_DEFINE_EABI
#define _ELF_DEFINE_EABI(N, V, DESCR) N = V ,
enum ElfOsabi : unsigned char {
_ELF_DEFINE_ELF_OSABI()
ELFOSABI__LAST__
};
#define ELFOSABI_LINUX ELFOSABI_GNU
//
// ELF Machine types: (EM_*).
///
#define _ELF_DEFINE_ELF_MACHINES() \
_ELF_DEFINE_EM(EM_NONE, 0, "No machine") \
_ELF_DEFINE_EM(EM_M32, 1, "AT&T WE 32100") \
_ELF_DEFINE_EM(EM_SPARC, 2, "SPARC") \
_ELF_DEFINE_EM(EM_386, 3, "Intel 80386") \
_ELF_DEFINE_EM(EM_68K, 4, "Motorola 68000") \
_ELF_DEFINE_EM(EM_88K, 5, "Motorola 88000") \
_ELF_DEFINE_EM(EM_IAMCU, 6, "Intel MCU") \
_ELF_DEFINE_EM(EM_860, 7, "Intel 80860") \
_ELF_DEFINE_EM(EM_MIPS, 8, "MIPS I Architecture") \
_ELF_DEFINE_EM(EM_S370, 9, "IBM System/370 Processor") \
_ELF_DEFINE_EM(EM_MIPS_RS3_LE, 10, "MIPS RS3000 Little-endian") \
_ELF_DEFINE_EM(EM_PARISC, 15, "Hewlett-Packard PA-RISC") \
_ELF_DEFINE_EM(EM_VPP500, 17, "Fujitsu VPP500") \
_ELF_DEFINE_EM(EM_SPARC32PLUS, 18, \
"Enhanced instruction set SPARC") \
_ELF_DEFINE_EM(EM_960, 19, "Intel 80960") \
_ELF_DEFINE_EM(EM_PPC, 20, "PowerPC") \
_ELF_DEFINE_EM(EM_PPC64, 21, "64-bit PowerPC") \
_ELF_DEFINE_EM(EM_S390, 22, "IBM System/390 Processor") \
_ELF_DEFINE_EM(EM_SPU, 23, "IBM SPU/SPC") \
_ELF_DEFINE_EM(EM_V800, 36, "NEC V800") \
_ELF_DEFINE_EM(EM_FR20, 37, "Fujitsu FR20") \
_ELF_DEFINE_EM(EM_RH32, 38, "TRW RH-32") \
_ELF_DEFINE_EM(EM_RCE, 39, "Motorola RCE") \
_ELF_DEFINE_EM(EM_ARM, 40, "Advanced RISC Machines ARM") \
_ELF_DEFINE_EM(EM_ALPHA, 41, "Digital Alpha") \
_ELF_DEFINE_EM(EM_SH, 42, "Hitachi SH") \
_ELF_DEFINE_EM(EM_SPARCV9, 43, "SPARC Version 9") \
_ELF_DEFINE_EM(EM_TRICORE, 44, \
"Siemens TriCore embedded processor") \
_ELF_DEFINE_EM(EM_ARC, 45, \
"Argonaut RISC Core, Argonaut Technologies Inc.") \
_ELF_DEFINE_EM(EM_H8_300, 46, "Hitachi H8/300") \
_ELF_DEFINE_EM(EM_H8_300H, 47, "Hitachi H8/300H") \
_ELF_DEFINE_EM(EM_H8S, 48, "Hitachi H8S") \
_ELF_DEFINE_EM(EM_H8_500, 49, "Hitachi H8/500") \
_ELF_DEFINE_EM(EM_IA_64, 50, \
"Intel IA-64 processor architecture") \
_ELF_DEFINE_EM(EM_MIPS_X, 51, "Stanford MIPS-X") \
_ELF_DEFINE_EM(EM_COLDFIRE, 52, "Motorola ColdFire") \
_ELF_DEFINE_EM(EM_68HC12, 53, "Motorola M68HC12") \
_ELF_DEFINE_EM(EM_MMA, 54, \
"Fujitsu MMA Multimedia Accelerator") \
_ELF_DEFINE_EM(EM_PCP, 55, "Siemens PCP") \
_ELF_DEFINE_EM(EM_NCPU, 56, \
"Sony nCPU embedded RISC processor") \
_ELF_DEFINE_EM(EM_NDR1, 57, "Denso NDR1 microprocessor") \
_ELF_DEFINE_EM(EM_STARCORE, 58, "Motorola Star*Core processor") \
_ELF_DEFINE_EM(EM_ME16, 59, "Toyota ME16 processor") \
_ELF_DEFINE_EM(EM_ST100, 60, \
"STMicroelectronics ST100 processor") \
_ELF_DEFINE_EM(EM_TINYJ, 61, \
"Advanced Logic Corp. TinyJ embedded processor family") \
_ELF_DEFINE_EM(EM_X86_64, 62, "AMD x86-64 architecture") \
_ELF_DEFINE_EM(EM_PDSP, 63, "Sony DSP Processor") \
_ELF_DEFINE_EM(EM_PDP10, 64, \
"Digital Equipment Corp. PDP-10") \
_ELF_DEFINE_EM(EM_PDP11, 65, \
"Digital Equipment Corp. PDP-11") \
_ELF_DEFINE_EM(EM_FX66, 66, "Siemens FX66 microcontroller") \
_ELF_DEFINE_EM(EM_ST9PLUS, 67, \
"STMicroelectronics ST9+ 8/16 bit microcontroller") \
_ELF_DEFINE_EM(EM_ST7, 68, \
"STMicroelectronics ST7 8-bit microcontroller") \
_ELF_DEFINE_EM(EM_68HC16, 69, \
"Motorola MC68HC16 Microcontroller") \
_ELF_DEFINE_EM(EM_68HC11, 70, \
"Motorola MC68HC11 Microcontroller") \
_ELF_DEFINE_EM(EM_68HC08, 71, \
"Motorola MC68HC08 Microcontroller") \
_ELF_DEFINE_EM(EM_68HC05, 72, \
"Motorola MC68HC05 Microcontroller") \
_ELF_DEFINE_EM(EM_SVX, 73, "Silicon Graphics SVx") \
_ELF_DEFINE_EM(EM_ST19, 74, \
"STMicroelectronics ST19 8-bit microcontroller") \
_ELF_DEFINE_EM(EM_VAX, 75, "Digital VAX") \
_ELF_DEFINE_EM(EM_CRIS, 76, \
"Axis Communications 32-bit embedded processor") \
_ELF_DEFINE_EM(EM_JAVELIN, 77, \
"Infineon Technologies 32-bit embedded processor") \
_ELF_DEFINE_EM(EM_FIREPATH, 78, \
"Element 14 64-bit DSP Processor") \
_ELF_DEFINE_EM(EM_ZSP, 79, \
"LSI Logic 16-bit DSP Processor") \
_ELF_DEFINE_EM(EM_MMIX, 80, \
"Donald Knuth's educational 64-bit processor") \
_ELF_DEFINE_EM(EM_HUANY, 81, \
"Harvard University machine-independent object files") \
_ELF_DEFINE_EM(EM_PRISM, 82, "SiTera Prism") \
_ELF_DEFINE_EM(EM_AVR, 83, \
"Atmel AVR 8-bit microcontroller") \
_ELF_DEFINE_EM(EM_FR30, 84, "Fujitsu FR30") \
_ELF_DEFINE_EM(EM_D10V, 85, "Mitsubishi D10V") \
_ELF_DEFINE_EM(EM_D30V, 86, "Mitsubishi D30V") \
_ELF_DEFINE_EM(EM_V850, 87, "NEC v850") \
_ELF_DEFINE_EM(EM_M32R, 88, "Mitsubishi M32R") \
_ELF_DEFINE_EM(EM_MN10300, 89, "Matsushita MN10300") \
_ELF_DEFINE_EM(EM_MN10200, 90, "Matsushita MN10200") \
_ELF_DEFINE_EM(EM_PJ, 91, "picoJava") \
_ELF_DEFINE_EM(EM_OPENRISC, 92, \
"OpenRISC 32-bit embedded processor") \
_ELF_DEFINE_EM(EM_ARC_COMPACT, 93, \
"ARC International ARCompact processor") \
_ELF_DEFINE_EM(EM_XTENSA, 94, \
"Tensilica Xtensa Architecture") \
_ELF_DEFINE_EM(EM_VIDEOCORE, 95, \
"Alphamosaic VideoCore processor") \
_ELF_DEFINE_EM(EM_TMM_GPP, 96, \
"Thompson Multimedia General Purpose Processor") \
_ELF_DEFINE_EM(EM_NS32K, 97, \
"National Semiconductor 32000 series") \
_ELF_DEFINE_EM(EM_TPC, 98, "Tenor Network TPC processor") \
_ELF_DEFINE_EM(EM_SNP1K, 99, "Trebia SNP 1000 processor") \
_ELF_DEFINE_EM(EM_ST200, 100, \
"STMicroelectronics (www.st.com) ST200 microcontroller") \
_ELF_DEFINE_EM(EM_IP2K, 101, \
"Ubicom IP2xxx microcontroller family") \
_ELF_DEFINE_EM(EM_MAX, 102, "MAX Processor") \
_ELF_DEFINE_EM(EM_CR, 103, \
"National Semiconductor CompactRISC microprocessor") \
_ELF_DEFINE_EM(EM_F2MC16, 104, "Fujitsu F2MC16") \
_ELF_DEFINE_EM(EM_MSP430, 105, \
"Texas Instruments embedded microcontroller msp430") \
_ELF_DEFINE_EM(EM_BLACKFIN, 106, \
"Analog Devices Blackfin (DSP) processor") \
_ELF_DEFINE_EM(EM_SE_C33, 107, \
"S1C33 Family of Seiko Epson processors") \
_ELF_DEFINE_EM(EM_SEP, 108, \
"Sharp embedded microprocessor") \
_ELF_DEFINE_EM(EM_ARCA, 109, "Arca RISC Microprocessor") \
_ELF_DEFINE_EM(EM_UNICORE, 110, \
"Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University") \
_ELF_DEFINE_EM(EM_EXCESS, 111, \
"eXcess: 16/32/64-bit configurable embedded CPU") \
_ELF_DEFINE_EM(EM_DXP, 112, \
"Icera Semiconductor Inc. Deep Execution Processor") \
_ELF_DEFINE_EM(EM_ALTERA_NIOS2, 113, \
"Altera Nios II soft-core processor") \
_ELF_DEFINE_EM(EM_CRX, 114, \
"National Semiconductor CompactRISC CRX microprocessor") \
_ELF_DEFINE_EM(EM_XGATE, 115, \
"Motorola XGATE embedded processor") \
_ELF_DEFINE_EM(EM_C166, 116, \
"Infineon C16x/XC16x processor") \
_ELF_DEFINE_EM(EM_M16C, 117, \
"Renesas M16C series microprocessors") \
_ELF_DEFINE_EM(EM_DSPIC30F, 118, \
"Microchip Technology dsPIC30F Digital Signal Controller") \
_ELF_DEFINE_EM(EM_CE, 119, \
"Freescale Communication Engine RISC core") \
_ELF_DEFINE_EM(EM_M32C, 120, \
"Renesas M32C series microprocessors") \
_ELF_DEFINE_EM(EM_TSK3000, 131, "Altium TSK3000 core") \
_ELF_DEFINE_EM(EM_RS08, 132, \
"Freescale RS08 embedded processor") \
_ELF_DEFINE_EM(EM_SHARC, 133, \
"Analog Devices SHARC family of 32-bit DSP processors") \
_ELF_DEFINE_EM(EM_ECOG2, 134, \
"Cyan Technology eCOG2 microprocessor") \
_ELF_DEFINE_EM(EM_SCORE7, 135, \
"Sunplus S+core7 RISC processor") \
_ELF_DEFINE_EM(EM_DSP24, 136, \
"New Japan Radio (NJR) 24-bit DSP Processor") \
_ELF_DEFINE_EM(EM_VIDEOCORE3, 137, \
"Broadcom VideoCore III processor") \
_ELF_DEFINE_EM(EM_LATTICEMICO32, 138, \
"RISC processor for Lattice FPGA architecture") \
_ELF_DEFINE_EM(EM_SE_C17, 139, "Seiko Epson C17 family") \
_ELF_DEFINE_EM(EM_TI_C6000, 140, \
"The Texas Instruments TMS320C6000 DSP family") \
_ELF_DEFINE_EM(EM_TI_C2000, 141, \
"The Texas Instruments TMS320C2000 DSP family") \
_ELF_DEFINE_EM(EM_TI_C5500, 142, \
"The Texas Instruments TMS320C55x DSP family") \
_ELF_DEFINE_EM(EM_MMDSP_PLUS, 160, \
"STMicroelectronics 64bit VLIW Data Signal Processor") \
_ELF_DEFINE_EM(EM_CYPRESS_M8C, 161, "Cypress M8C microprocessor") \
_ELF_DEFINE_EM(EM_R32C, 162, \
"Renesas R32C series microprocessors") \
_ELF_DEFINE_EM(EM_TRIMEDIA, 163, \
"NXP Semiconductors TriMedia architecture family") \
_ELF_DEFINE_EM(EM_QDSP6, 164, "QUALCOMM DSP6 Processor") \
_ELF_DEFINE_EM(EM_8051, 165, "Intel 8051 and variants") \
_ELF_DEFINE_EM(EM_STXP7X, 166, \
"STMicroelectronics STxP7x family of configurable and extensible RISC processors") \
_ELF_DEFINE_EM(EM_NDS32, 167, \
"Andes Technology compact code size embedded RISC processor family") \
_ELF_DEFINE_EM(EM_ECOG1, 168, \
"Cyan Technology eCOG1X family") \
_ELF_DEFINE_EM(EM_ECOG1X, 168, \
"Cyan Technology eCOG1X family") \
_ELF_DEFINE_EM(EM_MAXQ30, 169, \
"Dallas Semiconductor MAXQ30 Core Micro-controllers") \
_ELF_DEFINE_EM(EM_XIMO16, 170, \
"New Japan Radio (NJR) 16-bit DSP Processor") \
_ELF_DEFINE_EM(EM_MANIK, 171, \
"M2000 Reconfigurable RISC Microprocessor") \
_ELF_DEFINE_EM(EM_CRAYNV2, 172, \
"Cray Inc. NV2 vector architecture") \
_ELF_DEFINE_EM(EM_RX, 173, "Renesas RX family") \
_ELF_DEFINE_EM(EM_METAG, 174, \
"Imagination Technologies META processor architecture") \
_ELF_DEFINE_EM(EM_MCST_ELBRUS, 175, \
"MCST Elbrus general purpose hardware architecture") \
_ELF_DEFINE_EM(EM_ECOG16, 176, \
"Cyan Technology eCOG16 family") \
_ELF_DEFINE_EM(EM_CR16, 177, \
"National Semiconductor CompactRISC CR16 16-bit microprocessor") \
_ELF_DEFINE_EM(EM_ETPU, 178, \
"Freescale Extended Time Processing Unit") \
_ELF_DEFINE_EM(EM_SLE9X, 179, \
"Infineon Technologies SLE9X core") \
_ELF_DEFINE_EM(EM_AARCH64, 183, \
"AArch64 (64-bit ARM)") \
_ELF_DEFINE_EM(EM_AVR32, 185, \
"Atmel Corporation 32-bit microprocessor family") \
_ELF_DEFINE_EM(EM_STM8, 186, \
"STMicroeletronics STM8 8-bit microcontroller") \
_ELF_DEFINE_EM(EM_TILE64, 187, \
"Tilera TILE64 multicore architecture family") \
_ELF_DEFINE_EM(EM_TILEPRO, 188, \
"Tilera TILEPro multicore architecture family") \
_ELF_DEFINE_EM(EM_MICROBLAZE, 189, \
"Xilinx MicroBlaze 32-bit RISC soft processor core") \
_ELF_DEFINE_EM(EM_CUDA, 190, "NVIDIA CUDA architecture") \
_ELF_DEFINE_EM(EM_TILEGX, 191, \
"Tilera TILE-Gx multicore architecture family") \
_ELF_DEFINE_EM(EM_CLOUDSHIELD, 192, \
"CloudShield architecture family") \
_ELF_DEFINE_EM(EM_COREA_1ST, 193, \
"KIPO-KAIST Core-A 1st generation processor family") \
_ELF_DEFINE_EM(EM_COREA_2ND, 194, \
"KIPO-KAIST Core-A 2nd generation processor family") \
_ELF_DEFINE_EM(EM_ARC_COMPACT2, 195, "Synopsys ARCompact V2") \
_ELF_DEFINE_EM(EM_OPEN8, 196, \
"Open8 8-bit RISC soft processor core") \
_ELF_DEFINE_EM(EM_RL78, 197, "Renesas RL78 family") \
_ELF_DEFINE_EM(EM_VIDEOCORE5, 198, "Broadcom VideoCore V processor") \
_ELF_DEFINE_EM(EM_78KOR, 199, "Renesas 78KOR family") \
_ELF_DEFINE_EM(EM_56800EX, 200, \
"Freescale 56800EX Digital Signal Controller") \
_ELF_DEFINE_EM(EM_BA1, 201, "Beyond BA1 CPU architecture") \
_ELF_DEFINE_EM(EM_BA2, 202, "Beyond BA2 CPU architecture") \
_ELF_DEFINE_EM(EM_XCORE, 203, "XMOS xCORE processor family") \
_ELF_DEFINE_EM(EM_MCHP_PIC, 204, "Microchip 8-bit PIC(r) family") \
_ELF_DEFINE_EM(EM_INTEL205, 205, "Reserved by Intel") \
_ELF_DEFINE_EM(EM_INTEL206, 206, "Reserved by Intel") \
_ELF_DEFINE_EM(EM_INTEL207, 207, "Reserved by Intel") \
_ELF_DEFINE_EM(EM_INTEL208, 208, "Reserved by Intel") \
_ELF_DEFINE_EM(EM_INTEL209, 209, "Reserved by Intel") \
_ELF_DEFINE_EM(EM_KM32, 210, "KM211 KM32 32-bit processor") \
_ELF_DEFINE_EM(EM_KMX32, 211, "KM211 KMX32 32-bit processor") \
_ELF_DEFINE_EM(EM_KMX16, 212, "KM211 KMX16 16-bit processor") \
_ELF_DEFINE_EM(EM_KMX8, 213, "KM211 KMX8 8-bit processor") \
_ELF_DEFINE_EM(EM_KVARC, 214, "KM211 KMX32 KVARC processor") \
_ELF_DEFINE_EM(EM_RISCV, 243, "RISC-V")
#undef _ELF_DEFINE_EM
#define _ELF_DEFINE_EM(N, V, DESCR) N = V ,
enum ElfMachines : unsigned short {
_ELF_DEFINE_ELF_MACHINES()
EM__LAST__
};
// Other synonyms.///
#define EM_AMD64 EM_X86_64
#define EM_ARC_A5 EM_ARC_COMPACT
//
// ELF file types: (ET_*).
//
#define _ELF_DEFINE_ELF_TYPES() \
_ELF_DEFINE_ET(ET_NONE, 0, "No file type") \
_ELF_DEFINE_ET(ET_REL, 1, "Relocatable object") \
_ELF_DEFINE_ET(ET_EXEC, 2, "Executable") \
_ELF_DEFINE_ET(ET_DYN, 3, "Shared object") \
_ELF_DEFINE_ET(ET_CORE, 4, "Core file") \
_ELF_DEFINE_ET(ET_LOOS, 0xFE00, "Begin OS-specific range") \
_ELF_DEFINE_ET(ET_HIOS, 0xFEFF, "End OS-specific range") \
_ELF_DEFINE_ET(ET_LOPROC, 0xFF00, "Begin processor-specific range") \
_ELF_DEFINE_ET(ET_HIPROC, 0xFFFF, "End processor-specific range")
#undef _ELF_DEFINE_ET
#define _ELF_DEFINE_ET(N, V, DESCR) N = V ,
enum ElfTypes : unsigned short {
_ELF_DEFINE_ELF_TYPES()
ET__LAST__
};
// ELF file format version numbers.///
#define EV_NONE 0
#define EV_CURRENT 1
//
// Flags for section groups.
///
#define GRP_COMDAT 0x1 // COMDAT semantics///
#define GRP_MASKOS 0x0ff00000 // OS-specific flags///
#define GRP_MASKPROC 0xf0000000 // processor-specific flags///
//
// Flags / mask for .gnu.versym sections.
///
#define VERSYM_VERSION 0x7fff
#define VERSYM_HIDDEN 0x8000
//
// Flags used by program header table entries.
///
#define _ELF_DEFINE_PHDR_FLAGS() \
_ELF_DEFINE_PF(PF_X, 0x1, "Execute") \
_ELF_DEFINE_PF(PF_W, 0x2, "Write") \
_ELF_DEFINE_PF(PF_R, 0x4, "Read") \
_ELF_DEFINE_PF(PF_MASKOS, 0x0ff00000, "OS-specific flags") \
_ELF_DEFINE_PF(PF_MASKPROC, 0xf0000000, "Processor-specific flags") \
_ELF_DEFINE_PF(PF_ARM_SB, 0x10000000, \
"segment contains the location addressed by the static base") \
_ELF_DEFINE_PF(PF_ARM_PI, 0x20000000, \
"segment is position-independent") \
_ELF_DEFINE_PF(PF_ARM_ABS, 0x40000000, \
"segment must be loaded at its base address")
#undef _ELF_DEFINE_PF
#define _ELF_DEFINE_PF(N, V, DESCR) N = V ,
enum PhdrFlags{
_ELF_DEFINE_PHDR_FLAGS()
PF__LAST__
};
//
// Types of program header table entries.
///
#define _ELF_DEFINE_PHDR_TYPES() \
_ELF_DEFINE_PT(PT_NULL, 0, "ignored entry") \
_ELF_DEFINE_PT(PT_LOAD, 1, "loadable segment") \
_ELF_DEFINE_PT(PT_DYNAMIC, 2, \
"contains dynamic linking information") \
_ELF_DEFINE_PT(PT_INTERP, 3, "names an interpreter") \
_ELF_DEFINE_PT(PT_NOTE, 4, "auxiliary information") \
_ELF_DEFINE_PT(PT_SHLIB, 5, "reserved") \
_ELF_DEFINE_PT(PT_PHDR, 6, \
"describes the program header itself") \
_ELF_DEFINE_PT(PT_TLS, 7, "thread local storage") \
_ELF_DEFINE_PT(PT_LOOS, 0x60000000, \
"start of OS-specific range") \
_ELF_DEFINE_PT(PT_SUNW_UNWIND, 0x6464E550, \
"Solaris/amd64 stack unwind tables") \
_ELF_DEFINE_PT(PT_GNU_EH_FRAME, 0x6474E550, \
"GCC generated .eh_frame_hdr segment") \
_ELF_DEFINE_PT(PT_GNU_STACK, 0x6474E551, \
"Stack flags") \
_ELF_DEFINE_PT(PT_GNU_RELRO, 0x6474E552, \
"Segment becomes read-only after relocation") \
_ELF_DEFINE_PT(PT_SUNWBSS, 0x6FFFFFFA, \
"A Solaris .SUNW_bss section") \
_ELF_DEFINE_PT(PT_SUNWSTACK, 0x6FFFFFFB, \
"A Solaris process stack") \
_ELF_DEFINE_PT(PT_SUNWDTRACE, 0x6FFFFFFC, \
"Used by dtrace(1)") \
_ELF_DEFINE_PT(PT_SUNWCAP, 0x6FFFFFFD, \
"Special hardware capability requirements") \
_ELF_DEFINE_PT(PT_HIOS, 0x6FFFFFFF, \
"end of OS-specific range") \
_ELF_DEFINE_PT(PT_LOPROC, 0x70000000, \
"start of processor-specific range") \
_ELF_DEFINE_PT(PT_ARM_ARCHEXT, 0x70000000, \
"platform architecture compatibility information") \
_ELF_DEFINE_PT(PT_ARM_EXIDX, 0x70000001, \
"exception unwind tables") \
_ELF_DEFINE_PT(PT_MIPS_REGINFO, 0x70000000, \
"register usage information") \
_ELF_DEFINE_PT(PT_MIPS_RTPROC, 0x70000001, \
"runtime procedure table") \
_ELF_DEFINE_PT(PT_MIPS_OPTIONS, 0x70000002, \
"options segment") \
_ELF_DEFINE_PT(PT_HIPROC, 0x7FFFFFFF, \
"end of processor-specific range")
#undef _ELF_DEFINE_PT
#define _ELF_DEFINE_PT(N, V, DESCR) N = V ,
enum PhdrTypes {
_ELF_DEFINE_PHDR_TYPES()
PT__LAST__ = PT_HIPROC
};
// synonyms.///
#define PT_ARM_UNWIND PT_ARM_EXIDX
#define PT_HISUNW PT_HIOS
#define PT_LOSUNW PT_SUNWBSS
//
// Section flags.
///
#define _ELF_DEFINE_SECTION_FLAGS() \
_ELF_DEFINE_SHF(SHF_WRITE, 0x1, \
"writable during program execution") \
_ELF_DEFINE_SHF(SHF_ALLOC, 0x2, \
"occupies memory during program execution") \
_ELF_DEFINE_SHF(SHF_EXECINSTR, 0x4, "executable instructions") \
_ELF_DEFINE_SHF(SHF_MERGE, 0x10, \
"may be merged to prevent duplication") \
_ELF_DEFINE_SHF(SHF_STRINGS, 0x20, \
"NUL-terminated character strings") \
_ELF_DEFINE_SHF(SHF_INFO_LINK, 0x40, \
"the sh_info field holds a link") \
_ELF_DEFINE_SHF(SHF_LINK_ORDER, 0x80, \
"special ordering requirements during linking") \
_ELF_DEFINE_SHF(SHF_OS_NONCONFORMING, 0x100, \
"requires OS-specific processing during linking") \
_ELF_DEFINE_SHF(SHF_GROUP, 0x200, \
"member of a section group") \
_ELF_DEFINE_SHF(SHF_TLS, 0x400, \
"holds thread-local storage") \
_ELF_DEFINE_SHF(SHF_COMPRESSED, 0x800, \
"holds compressed data") \
_ELF_DEFINE_SHF(SHF_MASKOS, 0x0FF00000, \
"bits reserved for OS-specific semantics") \
_ELF_DEFINE_SHF(SHF_AMD64_LARGE, 0x10000000, \
"section uses large code model") \
_ELF_DEFINE_SHF(SHF_ENTRYSECT, 0x10000000, \
"section contains an entry point (ARM)") \
_ELF_DEFINE_SHF(SHF_COMDEF, 0x80000000, \
"section may be multiply defined in input to link step (ARM)") \
_ELF_DEFINE_SHF(SHF_MIPS_GPREL, 0x10000000, \
"section must be part of global data area") \
_ELF_DEFINE_SHF(SHF_MIPS_MERGE, 0x20000000, \
"section data should be merged to eliminate duplication") \
_ELF_DEFINE_SHF(SHF_MIPS_ADDR, 0x40000000, \
"section data is addressed by default") \
_ELF_DEFINE_SHF(SHF_MIPS_STRING, 0x80000000, \
"section data is string data by default") \
_ELF_DEFINE_SHF(SHF_MIPS_NOSTRIP, 0x08000000, \
"section data may not be stripped") \
_ELF_DEFINE_SHF(SHF_MIPS_LOCAL, 0x04000000, \
"section data local to process") \
_ELF_DEFINE_SHF(SHF_MIPS_NAMES, 0x02000000, \
"linker must generate implicit hidden weak names") \
_ELF_DEFINE_SHF(SHF_MIPS_NODUPE, 0x01000000, \
"linker must retain only one copy") \
_ELF_DEFINE_SHF(SHF_ORDERED, 0x40000000, \
"section is ordered with respect to other sections") \
_ELF_DEFINE_SHF(SHF_EXCLUDE, 0x80000000, \
"section is excluded from executables and shared objects") \
_ELF_DEFINE_SHF(SHF_MASKPROC, 0xF0000000, \
"bits reserved for processor-specific semantics")