aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/include/generic-netbsd/sys/elfdefinitions.h
blob: 366ffb3240b6bc735226338e5a8973166cf97c20 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
/*-
 * Copyright (c) 2010,2021 Joseph Koshy
 * 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.
 */

/*
 * WARNING: GENERATED FILE.  DO NOT MODIFY.
 *
 *  GENERATED FROM: Id: elfdefinitions.m4 3984 2022-05-06 11:22:42Z jkoshy
 *  GENERATED FROM: Id: elfconstants.m4 3980 2022-05-02 19:50:00Z jkoshy
 */

/*
 * 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, powerpc, and RISC-V processors.
 * - The "Linkers and Libraries Guide", from Sun Microsystems.
 */

#ifndef _SYS_ELFDEFINITIONS_H_
#define _SYS_ELFDEFINITIONS_H_

/*
 * Types of capabilities.
 */

#define	CA_SUNW_NULL	0
#define	CA_SUNW_HW_1	1
#define	CA_SUNW_SW_1	2

/*
 * Flags used with dynamic linking entries.
 */

#define	DF_ORIGIN	0x1
#define	DF_SYMBOLIC	0x2
#define	DF_TEXTREL	0x4
#define	DF_BIND_NOW	0x8
#define	DF_STATIC_TLS	0x10
#define	DF_1_BIND_NOW	0x1
#define	DF_1_GLOBAL	0x2
#define	DF_1_GROUP	0x4
#define	DF_1_NODELETE	0x8
#define	DF_1_LOADFLTR	0x10
#define	DF_1_INITFIRST	0x20
#define	DF_1_NOOPEN	0x40
#define	DF_1_ORIGIN	0x80
#define	DF_1_DIRECT	0x100
#define	DF_1_INTERPOSE	0x400
#define	DF_1_NODEFLIB	0x800
#define	DF_1_NODUMP	0x1000
#define	DF_1_CONFALT	0x2000
#define	DF_1_ENDFILTEE	0x4000
#define	DF_1_DISPRELDNE	0x8000
#define	DF_1_DISPRELPND	0x10000

/*
 * Dynamic linking entry types.
 */

#define	DT_NULL		0
#define	DT_NEEDED	1
#define	DT_PLTRELSZ	2
#define	DT_PLTGOT	3
#define	DT_HASH		4
#define	DT_STRTAB	5
#define	DT_SYMTAB	6
#define	DT_RELA		7
#define	DT_RELASZ	8
#define	DT_RELAENT	9
#define	DT_STRSZ	10
#define	DT_SYMENT	11
#define	DT_INIT		12
#define	DT_FINI		13
#define	DT_SONAME	14
#define	DT_RPATH	15
#define	DT_SYMBOLIC	16
#define	DT_REL		17
#define	DT_RELSZ	18
#define	DT_RELENT	19
#define	DT_PLTREL	20
#define	DT_DEBUG	21
#define	DT_TEXTREL	22
#define	DT_JMPREL	23
#define	DT_BIND_NOW	24
#define	DT_INIT_ARRAY	25
#define	DT_FINI_ARRAY	26
#define	DT_INIT_ARRAYSZ	27
#define	DT_FINI_ARRAYSZ	28
#define	DT_RUNPATH	29
#define	DT_FLAGS	30
#define	DT_ENCODING	32
#define	DT_PREINIT_ARRAY	32
#define	DT_PREINIT_ARRAYSZ	33
#define	DT_MAXPOSTAGS	34
#define	DT_LOOS		0x6000000DUL
#define	DT_SUNW_AUXILIARY	0x6000000DUL
#define	DT_SUNW_RTLDINF	0x6000000EUL
#define	DT_SUNW_FILTER	0x6000000FUL
#define	DT_SUNW_CAP	0x60000010UL
#define	DT_SUNW_ASLR	0x60000023UL
#define	DT_HIOS		0x6FFFF000UL
#define	DT_VALRNGLO	0x6FFFFD00UL
#define	DT_GNU_PRELINKED	0x6FFFFDF5UL
#define	DT_GNU_CONFLICTSZ	0x6FFFFDF6UL
#define	DT_GNU_LIBLISTSZ	0x6FFFFDF7UL
#define	DT_CHECKSUM	0x6FFFFDF8UL
#define	DT_PLTPADSZ	0x6FFFFDF9UL
#define	DT_MOVEENT	0x6FFFFDFAUL
#define	DT_MOVESZ	0x6FFFFDFBUL
#define	DT_FEATURE	0x6FFFFDFCUL
#define	DT_POSFLAG_1	0x6FFFFDFDUL
#define	DT_SYMINSZ	0x6FFFFDFEUL
#define	DT_SYMINENT	0x6FFFFDFFUL
#define	DT_VALRNGHI	0x6FFFFDFFUL
#define	DT_ADDRRNGLO	0x6FFFFE00UL
#define	DT_GNU_HASH	0x6FFFFEF5UL
#define	DT_TLSDESC_PLT	0x6FFFFEF6UL
#define	DT_TLSDESC_GOT	0x6FFFFEF7UL
#define	DT_GNU_CONFLICT	0x6FFFFEF8UL
#define	DT_GNU_LIBLIST	0x6FFFFEF9UL
#define	DT_CONFIG	0x6FFFFEFAUL
#define	DT_DEPAUDIT	0x6FFFFEFBUL
#define	DT_AUDIT	0x6FFFFEFCUL
#define	DT_PLTPAD	0x6FFFFEFDUL
#define	DT_MOVETAB	0x6FFFFEFEUL
#define	DT_SYMINFO	0x6FFFFEFFUL
#define	DT_ADDRRNGHI	0x6FFFFEFFUL
#define	DT_VERSYM	0x6FFFFFF0UL
#define	DT_RELACOUNT	0x6FFFFFF9UL
#define	DT_RELCOUNT	0x6FFFFFFAUL
#define	DT_FLAGS_1	0x6FFFFFFBUL
#define	DT_VERDEF	0x6FFFFFFCUL
#define	DT_VERDEFNUM	0x6FFFFFFDUL
#define	DT_VERNEED	0x6FFFFFFEUL
#define	DT_VERNEEDNUM	0x6FFFFFFFUL
#define	DT_LOPROC	0x70000000UL
#define	DT_ARM_SYMTABSZ	0x70000001UL
#define	DT_SPARC_REGISTER	0x70000001UL
#define	DT_ARM_PREEMPTMAP	0x70000002UL
#define	DT_MIPS_RLD_VERSION	0x70000001UL
#define	DT_MIPS_TIME_STAMP	0x70000002UL
#define	DT_MIPS_ICHECKSUM	0x70000003UL
#define	DT_MIPS_IVERSION	0x70000004UL
#define	DT_MIPS_FLAGS	0x70000005UL
#define	DT_MIPS_BASE_ADDRESS	0x70000006UL
#define	DT_MIPS_CONFLICT	0x70000008UL
#define	DT_MIPS_LIBLIST	0x70000009UL
#define	DT_MIPS_LOCAL_GOTNO	0x7000000AUL
#define	DT_MIPS_CONFLICTNO	0x7000000BUL
#define	DT_MIPS_LIBLISTNO	0x70000010UL
#define	DT_MIPS_SYMTABNO	0x70000011UL
#define	DT_MIPS_UNREFEXTNO	0x70000012UL
#define	DT_MIPS_GOTSYM	0x70000013UL
#define	DT_MIPS_HIPAGENO	0x70000014UL
#define	DT_MIPS_RLD_MAP	0x70000016UL
#define	DT_MIPS_DELTA_CLASS	0x70000017UL
#define	DT_MIPS_DELTA_CLASS_NO	0x70000018UL
#define	DT_MIPS_DELTA_INSTANCE	0x70000019UL
#define	DT_MIPS_DELTA_INSTANCE_NO	0x7000001AUL
#define	DT_MIPS_DELTA_RELOC	0x7000001BUL
#define	DT_MIPS_DELTA_RELOC_NO	0x7000001CUL
#define	DT_MIPS_DELTA_SYM	0x7000001DUL
#define	DT_MIPS_DELTA_SYM_NO	0x7000001EUL
#define	DT_MIPS_DELTA_CLASSSYM	0x70000020UL
#define	DT_MIPS_DELTA_CLASSSYM_NO	0x70000021UL
#define	DT_MIPS_CXX_FLAGS	0x70000022UL
#define	DT_MIPS_PIXIE_INIT	0x70000023UL
#define	DT_MIPS_SYMBOL_LIB	0x70000024UL
#define	DT_MIPS_LOCALPAGE_GOTIDX	0x70000025UL
#define	DT_MIPS_LOCAL_GOTIDX	0x70000026UL
#define	DT_MIPS_HIDDEN_GOTIDX	0x70000027UL
#define	DT_MIPS_PROTECTED_GOTIDX	0x70000028UL
#define	DT_MIPS_OPTIONS	0x70000029UL
#define	DT_MIPS_INTERFACE	0x7000002AUL
#define	DT_MIPS_DYNSTR_ALIGN	0x7000002BUL
#define	DT_MIPS_INTERFACE_SIZE	0x7000002CUL
#define	DT_MIPS_RLD_TEXT_RESOLVE_ADDR	0x7000002DUL
#define	DT_MIPS_PERF_SUFFIX	0x7000002EUL
#define	DT_MIPS_COMPACT_SIZE	0x7000002FUL
#define	DT_MIPS_GP_VALUE	0x70000030UL
#define	DT_MIPS_AUX_DYNAMIC	0x70000031UL
#define	DT_MIPS_PLTGOT	0x70000032UL
#define	DT_MIPS_RLD_OBJ_UPDATE	0x70000033UL
#define	DT_MIPS_RWPLT	0x70000034UL
#define	DT_PPC_GOT	0x70000000UL
#define	DT_PPC_TLSOPT	0x70000001UL
#define	DT_PPC64_GLINK	0x70000000UL
#define	DT_PPC64_OPD	0x70000001UL
#define	DT_PPC64_OPDSZ	0x70000002UL
#define	DT_PPC64_TLSOPT	0x70000003UL
#define	DT_AUXILIARY	0x7FFFFFFDUL
#define	DT_USED		0x7FFFFFFEUL
#define	DT_FILTER	0x7FFFFFFFUL
#define	DT_HIPROC	0x7FFFFFFFUL


/* Aliases for dynamic linking entry symbols. */

#define	DT_DEPRECATED_SPARC_REGISTER	DT_SPARC_REGISTER


/*
 * Flags used in the executable header (field: e_flags).
 */

#define	EF_ARM_RELEXEC	0x00000001UL
#define	EF_ARM_HASENTRY	0x00000002UL
#define	EF_ARM_SYMSARESORTED	0x00000004UL
#define	EF_ARM_DYNSYMSUSESEGIDX	0x00000008UL
#define	EF_ARM_MAPSYMSFIRST	0x00000010UL
#define	EF_ARM_BE8	0x00800000UL
#define	EF_ARM_LE8	0x00400000UL
#define	EF_ARM_EABIMASK	0xFF000000UL
#define	EF_ARM_EABI_UNKNOWN	0x00000000UL
#define	EF_ARM_EABI_VER1	0x01000000UL
#define	EF_ARM_EABI_VER2	0x02000000UL
#define	EF_ARM_EABI_VER3	0x03000000UL
#define	EF_ARM_EABI_VER4	0x04000000UL
#define	EF_ARM_EABI_VER5	0x05000000UL
#define	EF_ARM_INTERWORK	0x00000004UL
#define	EF_ARM_APCS_26	0x00000008UL
#define	EF_ARM_APCS_FLOAT	0x00000010UL
#define	EF_ARM_PIC	0x00000020UL
#define	EF_ARM_ALIGN8	0x00000040UL
#define	EF_ARM_NEW_ABI	0x00000080UL
#define	EF_ARM_OLD_ABI	0x00000100UL
#define	EF_ARM_SOFT_FLOAT	0x00000200UL
#define	EF_ARM_VFP_FLOAT	0x00000400UL
#define	EF_ARM_MAVERICK_FLOAT	0x00000800UL
#define	EF_MIPS_NOREORDER	0x00000001UL
#define	EF_MIPS_PIC	0x00000002UL
#define	EF_MIPS_CPIC	0x00000004UL
#define	EF_MIPS_UCODE	0x00000010UL
#define	EF_MIPS_ABI	0x00007000UL
#define	EF_MIPS_ABI2	0x00000020UL
#define	EF_MIPS_OPTIONS_FIRST	0x00000080UL
#define	EF_MIPS_ARCH_ASE	0x0F000000UL
#define	EF_MIPS_ARCH_ASE_MDMX	0x08000000UL
#define	EF_MIPS_ARCH_ASE_M16	0x04000000UL
#define	EF_MIPS_ARCH_ASE_MICROMIPS	0x02000000UL
#define	EF_MIPS_ARCH	0xF0000000UL
#define	EF_MIPS_ARCH_1	0x00000000UL
#define	EF_MIPS_ARCH_2	0x10000000UL
#define	EF_MIPS_ARCH_3	0x20000000UL
#define	EF_MIPS_ARCH_4	0x30000000UL
#define	EF_MIPS_ARCH_5	0x40000000UL
#define	EF_MIPS_ARCH_32	0x50000000UL
#define	EF_MIPS_ARCH_64	0x60000000UL
#define	EF_MIPS_ARCH_32R2	0x70000000UL
#define	EF_MIPS_ARCH_64R2	0x80000000UL
#define	EF_PPC_EMB	0x80000000UL
#define	EF_PPC_RELOCATABLE	0x00010000UL
#define	EF_PPC_RELOCATABLE_LIB	0x00008000UL
#define	EF_RISCV_RVC	0x00000001UL
#define	EF_RISCV_FLOAT_ABI_MASK	0x00000006UL
#define	EF_RISCV_FLOAT_ABI_SOFT	0x00000000UL
#define	EF_RISCV_FLOAT_ABI_SINGLE	0x00000002UL
#define	EF_RISCV_FLOAT_ABI_DOUBLE	0x00000004UL
#define	EF_RISCV_FLOAT_ABI_QUAD	0x00000006UL
#define	EF_RISCV_RVE	0x00000008UL
#define	EF_RISCV_TSO	0x00000010UL
#define	EF_SPARC_EXT_MASK	0x00ffff00UL
#define	EF_SPARC_32PLUS	0x00000100UL
#define	EF_SPARC_SUN_US1	0x00000200UL
#define	EF_SPARC_HAL_R1	0x00000400UL
#define	EF_SPARC_SUN_US3	0x00000800UL
#define	EF_SPARCV9_MM	0x00000003UL
#define	EF_SPARCV9_TSO	0x00000000UL
#define	EF_SPARCV9_PSO	0x00000001UL
#define	EF_SPARCV9_RMO	0x00000002UL


/*
 * Offsets in the ei_ident[] field of an ELF executable header.
 */

#define	EI_MAG0		0
#define	EI_MAG1		1
#define	EI_MAG2		2
#define	EI_MAG3		3
#define	EI_CLASS	4
#define	EI_DATA		5
#define	EI_VERSION	6
#define	EI_OSABI	7
#define	EI_ABIVERSION	8
#define	EI_PAD		9
#define	EI_NIDENT	16


/*
 * The ELF class of an object.
 */

#define	ELFCLASSNONE	0
#define	ELFCLASS32	1
#define	ELFCLASS64	2


/*
 * Endianness of data in an ELF object.
 */

#define	ELFDATANONE	0
#define	ELFDATA2LSB	1
#define	ELFDATA2MSB	2


/*
 * The magic numbers used in the initial four bytes of an ELF object.
 *
 * These numbers are: 0x7F, 'E', 'L' and 'F'.
 */

#define	ELFMAG0		0x7FU
#define	ELFMAG1		0x45U
#define	ELFMAG2		0x4CU
#define	ELFMAG3		0x46U

/* Additional magic-related constants. */

#define	ELFMAG		"\177ELF"
#define	SELFMAG		4


/*
 * ELF OS ABI field.
 */

#define	ELFOSABI_NONE	0
#define	ELFOSABI_SYSV	0
#define	ELFOSABI_HPUX	1
#define	ELFOSABI_NETBSD	2
#define	ELFOSABI_GNU	3
#define	ELFOSABI_HURD	4
#define	ELFOSABI_86OPEN	5
#define	ELFOSABI_SOLARIS	6
#define	ELFOSABI_AIX	7
#define	ELFOSABI_IRIX	8
#define	ELFOSABI_FREEBSD	9
#define	ELFOSABI_TRU64	10
#define	ELFOSABI_MODESTO	11
#define	ELFOSABI_OPENBSD	12
#define	ELFOSABI_OPENVMS	13
#define	ELFOSABI_NSK	14
#define	ELFOSABI_AROS	15
#define	ELFOSABI_FENIXOS	16
#define	ELFOSABI_CLOUDABI	17
#define	ELFOSABI_OPENVOS	18
#define	ELFOSABI_ARM_AEABI	64
#define	ELFOSABI_ARM	97
#define	ELFOSABI_STANDALONE	255


/* OS ABI Aliases. */

#define	ELFOSABI_LINUX	ELFOSABI_GNU


/*
 * ELF Machine types: (EM_*).
 */

#define	EM_NONE		0
#define	EM_M32		1
#define	EM_SPARC	2
#define	EM_386		3
#define	EM_68K		4
#define	EM_88K		5
#define	EM_IAMCU	6
#define	EM_860		7
#define	EM_MIPS		8
#define	EM_S370		9
#define	EM_MIPS_RS3_LE	10
#define	EM_PARISC	15
#define	EM_VPP500	17
#define	EM_SPARC32PLUS	18
#define	EM_960		19
#define	EM_PPC		20
#define	EM_PPC64	21
#define	EM_S390		22
#define	EM_SPU		23
#define	EM_V800		36
#define	EM_FR20		37
#define	EM_RH32		38
#define	EM_RCE		39
#define	EM_ARM		40
#define	EM_ALPHA	41
#define	EM_SH		42
#define	EM_SPARCV9	43
#define	EM_TRICORE	44
#define	EM_ARC		45
#define	EM_H8_300	46
#define	EM_H8_300H	47
#define	EM_H8S		48
#define	EM_H8_500	49
#define	EM_IA_64	50
#define	EM_MIPS_X	51
#define	EM_COLDFIRE	52
#define	EM_68HC12	53
#define	EM_MMA		54
#define	EM_PCP		55
#define	EM_NCPU		56
#define	EM_NDR1		57
#define	EM_STARCORE	58
#define	EM_ME16		59
#define	EM_ST100	60
#define	EM_TINYJ	61
#define	EM_X86_64	62
#define	EM_PDSP		63
#define	EM_PDP10	64
#define	EM_PDP11	65
#define	EM_FX66		66
#define	EM_ST9PLUS	67
#define	EM_ST7		68
#define	EM_68HC16	69
#define	EM_68HC11	70
#define	EM_68HC08	71
#define	EM_68HC05	72
#define	EM_SVX		73
#define	EM_ST19		74
#define	EM_VAX		75
#define	EM_CRIS		76
#define	EM_JAVELIN	77
#define	EM_FIREPATH	78
#define	EM_ZSP		79
#define	EM_MMIX		80
#define	EM_HUANY	81
#define	EM_PRISM	82
#define	EM_AVR		83
#define	EM_FR30		84
#define	EM_D10V		85
#define	EM_D30V		86
#define	EM_V850		87
#define	EM_M32R		88
#define	EM_MN10300	89
#define	EM_MN10200	90
#define	EM_PJ		91
#define	EM_OPENRISC	92
#define	EM_ARC_COMPACT	93
#define	EM_XTENSA	94
#define	EM_VIDEOCORE	95
#define	EM_TMM_GPP	96
#define	EM_NS32K	97
#define	EM_TPC		98
#define	EM_SNP1K	99
#define	EM_ST200	100
#define	EM_IP2K		101
#define	EM_MAX		102
#define	EM_CR		103
#define	EM_F2MC16	104
#define	EM_MSP430	105
#define	EM_BLACKFIN	106
#define	EM_SE_C33	107
#define	EM_SEP		108
#define	EM_ARCA		109
#define	EM_UNICORE	110
#define	EM_EXCESS	111
#define	EM_DXP		112
#define	EM_ALTERA_NIOS2	113
#define	EM_CRX		114
#define	EM_XGATE	115
#define	EM_C166		116
#define	EM_M16C		117
#define	EM_DSPIC30F	118
#define	EM_CE		119
#define	EM_M32C		120
#define	EM_TSK3000	131
#define	EM_RS08		132
#define	EM_SHARC	133
#define	EM_ECOG2	134
#define	EM_SCORE7	135
#define	EM_DSP24	136
#define	EM_VIDEOCORE3	137
#define	EM_LATTICEMICO32	138
#define	EM_SE_C17	139
#define	EM_TI_C6000	140
#define	EM_TI_C2000	141
#define	EM_TI_C5500	142
#define	EM_MMDSP_PLUS	160
#define	EM_CYPRESS_M8C	161
#define	EM_R32C		162
#define	EM_TRIMEDIA	163
#define	EM_QDSP6	164
#define	EM_8051		165
#define	EM_STXP7X	166
#define	EM_NDS32	167
#define	EM_ECOG1	168
#define	EM_ECOG1X	168
#define	EM_MAXQ30	169
#define	EM_XIMO16	170
#define	EM_MANIK	171
#define	EM_CRAYNV2	172
#define	EM_RX		173
#define	EM_METAG	174
#define	EM_MCST_ELBRUS	175
#define	EM_ECOG16	176
#define	EM_CR16		177
#define	EM_ETPU		178
#define	EM_SLE9X	179
#define	EM_AARCH64	183
#define	EM_AVR32	185
#define	EM_STM8		186
#define	EM_TILE64	187
#define	EM_TILEPRO	188
#define	EM_MICROBLAZE	189
#define	EM_CUDA		190
#define	EM_TILEGX	191
#define	EM_CLOUDSHIELD	192
#define	EM_COREA_1ST	193
#define	EM_COREA_2ND	194
#define	EM_ARC_COMPACT2	195
#define	EM_OPEN8	196
#define	EM_RL78		197
#define	EM_VIDEOCORE5	198
#define	EM_78KOR	199
#define	EM_56800EX	200
#define	EM_BA1		201
#define	EM_BA2		202
#define	EM_XCORE	203
#define	EM_MCHP_PIC	204
#define	EM_INTELGT	205
#define	EM_INTEL206	206
#define	EM_INTEL207	207
#define	EM_INTEL208	208
#define	EM_INTEL209	209
#define	EM_KM32		210
#define	EM_KMX32	211
#define	EM_KMX16	212
#define	EM_KMX8		213
#define	EM_KVARC	214
#define	EM_CDP		215
#define	EM_COGE		216
#define	EM_COOL		217
#define	EM_NORC		218
#define	EM_CSR_KALIMBA	219
#define	EM_Z80		220
#define	EM_VISIUM	221
#define	EM_FT32		222
#define	EM_MOXIE	223
#define	EM_AMDGPU	224
#define	EM_RISCV	243
#define	EM_LANAI	244
#define	EM_CEVA		245
#define	EM_CEVA_X2	246
#define	EM_BPF		247
#define	EM_GRAPHCORE_IPU	248
#define	EM_IMG1		249
#define	EM_NFP		250
#define	EM_CSKY		252
#define	EM_65816	257
#define	EM_KF32		259

/* Other synonyms. */

#define	EM_AMD64	EM_X86_64
#define	EM_ARC_A5	EM_ARC_COMPACT


/*
 * ELF file types: (ET_*).
 */

#define	ET_NONE		0
#define	ET_REL		1
#define	ET_EXEC		2
#define	ET_DYN		3
#define	ET_CORE		4
#define	ET_LOOS		0xFE00U
#define	ET_HIOS		0xFEFFU
#define	ET_LOPROC	0xFF00U
#define	ET_HIPROC	0xFFFFU


/* ELF file format version numbers. */

#define	EV_NONE		0
#define	EV_CURRENT	1


/*
 * Flags for section groups.
 */

#define	GRP_COMDAT	0x1
#define	GRP_MASKOS	0x0ff00000
#define	GRP_MASKPROC	0xf0000000


/*
 * Flags / mask for .gnu.versym sections.
 */

#define	VERSYM_VERSION	0x7fff
#define	VERSYM_HIDDEN	0x8000


/*
 * Flags used by program header table entries.
 */

#define	PF_X		0x1
#define	PF_W		0x2
#define	PF_R		0x4
#define	PF_MASKOS	0x0ff00000
#define	PF_MASKPROC	0xf0000000
#define	PF_ARM_SB	0x10000000
#define	PF_ARM_PI	0x20000000
#define	PF_ARM_ABS	0x40000000


/*
 * Types of program header table entries.
 */

#define	PT_NULL		0UL
#define	PT_LOAD		1UL
#define	PT_DYNAMIC	2UL
#define	PT_INTERP	3UL
#define	PT_NOTE		4UL
#define	PT_SHLIB	5UL
#define	PT_PHDR		6UL
#define	PT_TLS		7UL
#define	PT_LOOS		0x60000000UL
#define	PT_SUNW_UNWIND	0x6464E550UL
#define	PT_GNU_EH_FRAME	0x6474E550UL
#define	PT_GNU_STACK	0x6474E551UL
#define	PT_GNU_RELRO	0x6474E552UL
#define	PT_OPENBSD_RANDOMIZE	0x65A3DBE6UL
#define	PT_OPENBSD_WXNEEDED	0x65A3DBE7UL
#define	PT_OPENBSD_BOOTDATA	0x65A41BE6UL
#define	PT_SUNWBSS	0x6FFFFFFAUL
#define	PT_SUNWSTACK	0x6FFFFFFBUL
#define	PT_SUNWDTRACE	0x6FFFFFFCUL
#define	PT_SUNWCAP	0x6FFFFFFDUL
#define	PT_HIOS		0x6FFFFFFFUL
#define	PT_LOPROC	0x70000000UL
#define	PT_ARM_ARCHEXT	0x70000000UL
#define	PT_ARM_EXIDX	0x70000001UL
#define	PT_MIPS_REGINFO	0x70000000UL
#define	PT_MIPS_RTPROC	0x70000001UL
#define	PT_MIPS_OPTIONS	0x70000002UL
#define	PT_HIPROC	0x7FFFFFFFUL

/* synonyms. */

#define	PT_ARM_UNWIND	PT_ARM_EXIDX
#define	PT_HISUNW	PT_HIOS
#define	PT_LOSUNW	PT_SUNWBSS


/*
 * Section flags.
 */

#define	SHF_WRITE	0x1
#define	SHF_ALLOC	0x2
#define	SHF_EXECINSTR	0x4
#define	SHF_MERGE	0x10
#define	SHF_STRINGS	0x20
#define	SHF_INFO_LINK	0x40
#define	SHF_LINK_ORDER	0x80
#define	SHF_OS_NONCONFORMING	0x100
#define	SHF_GROUP	0x200
#define	SHF_TLS		0x400
#define	SHF_COMPRESSED	0x800
#define	SHF_MASKOS	0x0FF00000UL
#define	SHF_AMD64_LARGE	0x10000000UL
#define	SHF_ENTRYSECT	0x10000000UL
#define	SHF_COMDEF	0x80000000UL
#define	SHF_MIPS_GPREL	0x10000000UL
#define	SHF_MIPS_MERGE	0x20000000UL
#define	SHF_MIPS_ADDR	0x40000000UL
#define	SHF_MIPS_STRING	0x80000000UL
#define	SHF_MIPS_NOSTRIP	0x08000000UL
#define	SHF_MIPS_LOCAL	0x04000000UL
#define	SHF_MIPS_NAMES	0x02000000UL
#define	SHF_MIPS_NODUPE	0x01000000UL
#define	SHF_ORDERED	0x40000000UL
#define	SHF_EXCLUDE	0x80000000UL
#define	SHF_MASKPROC	0xF0000000UL


/*
 * Special section indices.
 */

#define	SHN_UNDEF	0
#define	SHN_LORESERVE	0xFF00U
#define	SHN_LOPROC	0xFF00U
#define	SHN_BEFORE	0xFF00U
#define	SHN_AFTER	0xFF01U
#define	SHN_AMD64_LCOMMON	0xFF02U
#define	SHN_MIPS_ACOMMON	0xFF00U
#define	SHN_MIPS_TEXT	0xFF01U
#define	SHN_MIPS_DATA	0xFF02U
#define	SHN_MIPS_SCOMMON	0xFF03U
#define	SHN_MIPS_SUNDEFINED	0xFF04U
#define	SHN_MIPS_LCOMMON	0xFF05U
#define	SHN_MIPS_LUNDEFINED	0xFF06U
#define	SHN_HIPROC	0xFF1FU
#define	SHN_LOOS	0xFF20U
#define	SHN_SUNW_IGNORE	0xFF3FU
#define	SHN_HIOS	0xFF3FU
#define	SHN_ABS		0xFFF1U
#define	SHN_COMMON	0xFFF2U
#define	SHN_XINDEX	0xFFFFU
#define	SHN_HIRESERVE	0xFFFFU


/*
 * Section types.
 */

#define	SHT_NULL	0
#define	SHT_PROGBITS	1
#define	SHT_SYMTAB	2
#define	SHT_STRTAB	3
#define	SHT_RELA	4
#define	SHT_HASH	5
#define	SHT_DYNAMIC	6
#define	SHT_NOTE	7
#define	SHT_NOBITS	8
#define	SHT_REL		9
#define	SHT_SHLIB	10
#define	SHT_DYNSYM	11
#define	SHT_INIT_ARRAY	14
#define	SHT_FINI_ARRAY	15
#define	SHT_PREINIT_ARRAY	16
#define	SHT_GROUP	17
#define	SHT_SYMTAB_SHNDX	18
#define	SHT_LOOS	0x60000000UL
#define	SHT_SUNW_dof	0x6FFFFFF4UL
#define	SHT_SUNW_cap	0x6FFFFFF5UL
#define	SHT_GNU_ATTRIBUTES	0x6FFFFFF5UL
#define	SHT_SUNW_SIGNATURE	0x6FFFFFF6UL
#define	SHT_GNU_HASH	0x6FFFFFF6UL
#define	SHT_GNU_LIBLIST	0x6FFFFFF7UL
#define	SHT_SUNW_ANNOTATE	0x6FFFFFF7UL
#define	SHT_SUNW_DEBUGSTR	0x6FFFFFF8UL
#define	SHT_CHECKSUM	0x6FFFFFF8UL
#define	SHT_SUNW_DEBUG	0x6FFFFFF9UL
#define	SHT_SUNW_move	0x6FFFFFFAUL
#define	SHT_SUNW_COMDAT	0x6FFFFFFBUL
#define	SHT_SUNW_syminfo	0x6FFFFFFCUL
#define	SHT_SUNW_verdef	0x6FFFFFFDUL
#define	SHT_SUNW_verneed	0x6FFFFFFEUL
#define	SHT_SUNW_versym	0x6FFFFFFFUL
#define	SHT_HIOS	0x6FFFFFFFUL
#define	SHT_LOPROC	0x70000000UL
#define	SHT_ARM_EXIDX	0x70000001UL
#define	SHT_ARM_PREEMPTMAP	0x70000002UL
#define	SHT_ARM_ATTRIBUTES	0x70000003UL
#define	SHT_ARM_DEBUGOVERLAY	0x70000004UL
#define	SHT_ARM_OVERLAYSECTION	0x70000005UL
#define	SHT_MIPS_LIBLIST	0x70000000UL
#define	SHT_MIPS_MSYM	0x70000001UL
#define	SHT_MIPS_CONFLICT	0x70000002UL
#define	SHT_MIPS_GPTAB	0x70000003UL
#define	SHT_MIPS_UCODE	0x70000004UL
#define	SHT_MIPS_DEBUG	0x70000005UL
#define	SHT_MIPS_REGINFO	0x70000006UL
#define	SHT_MIPS_PACKAGE	0x70000007UL
#define	SHT_MIPS_PACKSYM	0x70000008UL
#define	SHT_MIPS_RELD	0x70000009UL
#define	SHT_MIPS_IFACE	0x7000000BUL
#define	SHT_MIPS_CONTENT	0x7000000CUL
#define	SHT_MIPS_OPTIONS	0x7000000DUL
#define	SHT_MIPS_DELTASYM	0x7000001BUL
#define	SHT_MIPS_DELTAINST	0x7000001CUL
#define	SHT_MIPS_DELTACLASS	0x7000001DUL
#define	SHT_MIPS_DWARF	0x7000001EUL
#define	SHT_MIPS_DELTADECL	0x7000001FUL
#define	SHT_MIPS_SYMBOL_LIB	0x70000020UL
#define	SHT_MIPS_EVENTS	0x70000021UL
#define	SHT_MIPS_TRANSLATE	0x70000022UL
#define	SHT_MIPS_PIXIE	0x70000023UL
#define	SHT_MIPS_XLATE	0x70000024UL
#define	SHT_MIPS_XLATE_DEBUG	0x70000025UL
#define	SHT_MIPS_WHIRL	0x70000026UL
#define	SHT_MIPS_EH_REGION	0x70000027UL
#define	SHT_MIPS_XLATE_OLD	0x70000028UL
#define	SHT_MIPS_PDR_EXCEPTION	0x70000029UL
#define	SHT_MIPS_ABIFLAGS	0x7000002AUL
#define	SHT_SPARC_GOTDATA	0x70000000UL
#define	SHT_X86_64_UNWIND	0x70000001UL
#define	SHT_ORDERED	0x7FFFFFFFUL
#define	SHT_HIPROC	0x7FFFFFFFUL
#define	SHT_LOUSER	0x80000000UL
#define	SHT_HIUSER	0xFFFFFFFFUL

/* Aliases for section types. */

#define	SHT_AMD64_UNWIND	SHT_X86_64_UNWIND
#define	SHT_GNU_verdef	SHT_SUNW_verdef
#define	SHT_GNU_verneed	SHT_SUNW_verneed
#define	SHT_GNU_versym	SHT_SUNW_versym


#define	PN_XNUM			0xFFFFU /* Use extended section numbering. */

/*
 * Symbol binding information.
 */

#define	STB_LOCAL	0
#define	STB_GLOBAL	1
#define	STB_WEAK	2
#define	STB_LOOS	10
#define	STB_GNU_UNIQUE	10
#define	STB_HIOS	12
#define	STB_LOPROC	13
#define	STB_HIPROC	15


/*
 * Symbol types
 */

#define	STT_NOTYPE	0
#define	STT_OBJECT	1
#define	STT_FUNC	2
#define	STT_SECTION	3
#define	STT_FILE	4
#define	STT_COMMON	5
#define	STT_TLS		6
#define	STT_LOOS	10
#define	STT_GNU_IFUNC	10
#define	STT_HIOS	12
#define	STT_LOPROC	13
#define	STT_ARM_TFUNC	13
#define	STT_ARM_16BIT	15
#define	STT_SPARC_REGISTER	13
#define	STT_HIPROC	15

/* Additional constants related to symbol types. */

#define	STT_NUM		7


/*
 * Symbol binding.
 */

#define	SYMINFO_BT_SELF	0xFFFFU
#define	SYMINFO_BT_PARENT	0xFFFEU
#define	SYMINFO_BT_NONE	0xFFFDU


/*
 * Symbol visibility.
 */

#define	STV_DEFAULT	0
#define	STV_INTERNAL	1
#define	STV_HIDDEN	2
#define	STV_PROTECTED	3


/*
 * Symbol flags.
 */

#define	SYMINFO_FLG_DIRECT	0x01
#define	SYMINFO_FLG_COPY	0x04
#define	SYMINFO_FLG_LAZYLOAD	0x08
#define	SYMINFO_FLG_DIRECTBIND	0x10
#define	SYMINFO_FLG_NOEXTDIRECT	0x20


/*
 * Versioning dependencies.
 */

#define	VER_NDX_LOCAL	0
#define	VER_NDX_GLOBAL	1


/*
 * Versioning flags.
 */

#define	VER_FLG_BASE	0x1
#define	VER_FLG_WEAK	0x2


/*
 * Versioning needs
 */

#define	VER_NEED_NONE	0
#define	VER_NEED_CURRENT	1


/*
 * Versioning numbers.
 */

#define	VER_DEF_NONE	0
#define	VER_DEF_CURRENT	1


/**
 ** Relocation types.
 **/


#define	R_386_NONE	0
#define	R_386_32	1
#define	R_386_PC32	2
#define	R_386_GOT32	3
#define	R_386_PLT32	4
#define	R_386_COPY	5
#define	R_386_GLOB_DAT	6
#define	R_386_JUMP_SLOT	7
#define	R_386_RELATIVE	8
#define	R_386_GOTOFF	9
#define	R_386_GOTPC	10
#define	R_386_32PLT	11
#define	R_386_TLS_TPOFF	14
#define	R_386_TLS_IE	15
#define	R_386_TLS_GOTIE	16
#define	R_386_TLS_LE	17
#define	R_386_TLS_GD	18
#define	R_386_TLS_LDM	19
#define	R_386_16	20
#define	R_386_PC16	21
#define	R_386_8		22
#define	R_386_PC8	23
#define	R_386_TLS_GD_32	24
#define	R_386_TLS_GD_PUSH	25
#define	R_386_TLS_GD_CALL	26
#define	R_386_TLS_GD_POP	27
#define	R_386_TLS_LDM_32	28
#define	R_386_TLS_LDM_PUSH	29
#define	R_386_TLS_LDM_CALL	30
#define	R_386_TLS_LDM_POP	31
#define	R_386_TLS_LDO_32	32
#define	R_386_TLS_IE_32	33
#define	R_386_TLS_LE_32	34
#define	R_386_TLS_DTPMOD32	35
#define	R_386_TLS_DTPOFF32	36
#define	R_386_TLS_TPOFF32	37
#define	R_386_SIZE32	38
#define	R_386_TLS_GOTDESC	39
#define	R_386_TLS_DESC_CALL	40
#define	R_386_TLS_DESC	41
#define	R_386_IRELATIVE	42
#define	R_386_GOT32X	43


#define	R_AARCH64_NONE	0
#define	R_AARCH64_ABS64	257
#define	R_AARCH64_ABS32	258
#define	R_AARCH64_ABS16	259
#define	R_AARCH64_PREL64	260
#define	R_AARCH64_PREL32	261
#define	R_AARCH64_PREL16	262
#define	R_AARCH64_MOVW_UABS_G0	263
#define	R_AARCH64_MOVW_UABS_G0_NC	264
#define	R_AARCH64_MOVW_UABS_G1	265
#define	R_AARCH64_MOVW_UABS_G1_NC	266
#define	R_AARCH64_MOVW_UABS_G2	267
#define	R_AARCH64_MOVW_UABS_G2_NC	268
#define	R_AARCH64_MOVW_UABS_G3	269
#define	R_AARCH64_MOVW_SABS_G0	270
#define	R_AARCH64_MOVW_SABS_G1	271
#define	R_AARCH64_MOVW_SABS_G2	272
#define	R_AARCH64_LD_PREL_LO19	273
#define	R_AARCH64_ADR_PREL_LO21	274
#define	R_AARCH64_ADR_PREL_PG_HI21	275
#define	R_AARCH64_ADR_PREL_PG_HI21_NC	276
#define	R_AARCH64_ADD_ABS_LO12_NC	277
#define	R_AARCH64_LDST8_ABS_LO12_NC	278
#define	R_AARCH64_TSTBR14	279
#define	R_AARCH64_CONDBR19	280
#define	R_AARCH64_JUMP26	282
#define	R_AARCH64_CALL26	283
#define	R_AARCH64_LDST16_ABS_LO12_NC	284
#define	R_AARCH64_LDST32_ABS_LO12_NC	285
#define	R_AARCH64_LDST64_ABS_LO12_NC	286
#define	R_AARCH64_MOVW_PREL_G0	287
#define	R_AARCH64_MOVW_PREL_G0_NC	288
#define	R_AARCH64_MOVW_PREL_G1	289
#define	R_AARCH64_MOVW_PREL_G1_NC	290
#define	R_AARCH64_MOVW_PREL_G2	291
#define	R_AARCH64_MOVW_PREL_G2_NC	292
#define	R_AARCH64_MOVW_PREL_G3	293
#define	R_AARCH64_LDST128_ABS_LO12_NC	299
#define	R_AARCH64_MOVW_GOTOFF_G0	300
#define	R_AARCH64_MOVW_GOTOFF_G0_NC	301
#define	R_AARCH64_MOVW_GOTOFF_G1	302
#define	R_AARCH64_MOVW_GOTOFF_G1_NC	303
#define	R_AARCH64_MOVW_GOTOFF_G2	304
#define	R_AARCH64_MOVW_GOTOFF_G2_NC	305
#define	R_AARCH64_MOVW_GOTOFF_G3	306
#define	R_AARCH64_GOTREL64	307
#define	R_AARCH64_GOTREL32	308
#define	R_AARCH64_GOT_LD_PREL19	309
#define	R_AARCH64_LD64_GOTOFF_LO15	310
#define	R_AARCH64_ADR_GOT_PAGE	311
#define	R_AARCH64_LD64_GOT_LO12_NC	312
#define	R_AARCH64_LD64_GOTPAGE_LO15	313
#define	R_AARCH64_TLSGD_ADR_PREL21	512
#define	R_AARCH64_TLSGD_ADR_PAGE21	513
#define	R_AARCH64_TLSGD_ADD_LO12_NC	514
#define	R_AARCH64_TLSGD_MOVW_G1	515
#define	R_AARCH64_TLSGD_MOVW_G0_NC	516
#define	R_AARCH64_TLSLD_ADR_PREL21	517
#define	R_AARCH64_TLSLD_ADR_PAGE21	518
#define	R_AARCH64_TLSLD_ADD_LO12_NC	519
#define	R_AARCH64_TLSLD_MOVW_G1	520
#define	R_AARCH64_TLSLD_MOVW_G0_NC	521
#define	R_AARCH64_TLSLD_LD_PREL19	522
#define	R_AARCH64_TLSLD_MOVW_DTPREL_G2	523
#define	R_AARCH64_TLSLD_MOVW_DTPREL_G1	524
#define	R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC	525
#define	R_AARCH64_TLSLD_MOVW_DTPREL_G0	526
#define	R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC	527
#define	R_AARCH64_TLSLD_ADD_DTPREL_HI12	529
#define	R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC	530
#define	R_AARCH64_TLSLD_LDST8_DTPREL_LO12	531
#define	R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC	532
#define	R_AARCH64_TLSLD_LDST16_DTPREL_LO12	533
#define	R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC	534
#define	R_AARCH64_TLSLD_LDST32_DTPREL_LO12	535
#define	R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC	536
#define	R_AARCH64_TLSLD_LDST64_DTPREL_LO12	537
#define	R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC	538
#define	R_AARCH64_TLSIE_MOVW_GOTTPREL_G1	539
#define	R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC	540
#define	R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21	541
#define	R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC	542
#define	R_AARCH64_TLSIE_LD_GOTTPREL_PREL19	543
#define	R_AARCH64_TLSLE_MOVW_TPREL_G2	544
#define	R_AARCH64_TLSLE_MOVW_TPREL_G1	545
#define	R_AARCH64_TLSLE_MOVW_TPREL_G1_NC	546
#define	R_AARCH64_TLSLE_MOVW_TPREL_G0	547
#define	R_AARCH64_TLSLE_MOVW_TPREL_G0_NC	548
#define	R_AARCH64_TLSLE_ADD_TPREL_HI12	549
#define	R_AARCH64_TLSLE_ADD_TPREL_LO12	550
#define	R_AARCH64_TLSLE_ADD_TPREL_LO12_NC	551
#define	R_AARCH64_TLSLE_LDST8_TPREL_LO12	552
#define	R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC	553
#define	R_AARCH64_TLSLE_LDST16_TPREL_LO12	554
#define	R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC	555
#define	R_AARCH64_TLSLE_LDST32_TPREL_LO12	556
#define	R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC	557
#define	R_AARCH64_TLSLE_LDST64_TPREL_LO12	558
#define	R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC	559
#define	R_AARCH64_TLSDESC_LD_PREL19	560
#define	R_AARCH64_TLSDESC_ADR_PREL21	561
#define	R_AARCH64_TLSDESC_ADR_PAGE21	562
#define	R_AARCH64_TLSDESC_LD64_LO12	563
#define	R_AARCH64_TLSDESC_ADD_LO12	564
#define	R_AARCH64_TLSDESC_OFF_G1	565
#define	R_AARCH64_TLSDESC_OFF_G0_NC	566
#define	R_AARCH64_TLSDESC_LDR	567
#define	R_AARCH64_TLSDESC_ADD	568
#define	R_AARCH64_TLSDESC_CALL	569
#define	R_AARCH64_TLSLE_LDST128_TPREL_LO12	570
#define	R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC	571
#define	R_AARCH64_TLSLD_LDST128_DTPREL_LO12	572
#define	R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC	573
#define	R_AARCH64_COPY	1024
#define	R_AARCH64_GLOB_DAT	1025
#define	R_AARCH64_JUMP_SLOT	1026
#define	R_AARCH64_RELATIVE	1027
#define	R_AARCH64_TLS_DTPREL64	1028
#define	R_AARCH64_TLS_DTPMOD64	1029
#define	R_AARCH64_TLS_TPREL64	1030
#define	R_AARCH64_TLSDESC	1031
#define	R_AARCH64_IRELATIVE	1032


#define	R_AMD64_NONE	0
#define	R_AMD64_64	1
#define	R_AMD64_PC32	2
#define	R_AMD64_GOT32	3
#define	R_AMD64_PLT32	4
#define	R_AMD64_COPY	5
#define	R_AMD64_GLOB_DAT	6
#define	R_AMD64_JUMP_SLOT	7
#define	R_AMD64_RELATIVE	8
#define	R_AMD64_GOTPCREL	9
#define	R_AMD64_32	10
#define	R_AMD64_32S	11
#define	R_AMD64_16	12
#define	R_AMD64_PC16	13
#define	R_AMD64_8	14
#define	R_AMD64_PC8	15
#define	R_AMD64_PC64	24
#define	R_AMD64_GOTOFF64	25
#define	R_AMD64_GOTPC32	26


#define	R_ARM_NONE	0
#define	R_ARM_PC24	1
#define	R_ARM_ABS32	2
#define	R_ARM_REL32	3
#define	R_ARM_LDR_PC_G0	4
#define	R_ARM_ABS16	5
#define	R_ARM_ABS12	6
#define	R_ARM_THM_ABS5	7
#define	R_ARM_ABS8	8
#define	R_ARM_SBREL32	9
#define	R_ARM_THM_CALL	10
#define	R_ARM_THM_PC8	11
#define	R_ARM_BREL_ADJ	12
#define	R_ARM_SWI24	13
#define	R_ARM_TLS_DESC	13
#define	R_ARM_THM_SWI8	14
#define	R_ARM_XPC25	15
#define	R_ARM_THM_XPC22	16
#define	R_ARM_TLS_DTPMOD32	17
#define	R_ARM_TLS_DTPOFF32	18
#define	R_ARM_TLS_TPOFF32	19
#define	R_ARM_COPY	20
#define	R_ARM_GLOB_DAT	21
#define	R_ARM_JUMP_SLOT	22
#define	R_ARM_RELATIVE	23
#define	R_ARM_GOTOFF32	24
#define	R_ARM_BASE_PREL	25
#define	R_ARM_GOT_BREL	26
#define	R_ARM_PLT32	27
#define	R_ARM_CALL	28
#define	R_ARM_JUMP24	29
#define	R_ARM_THM_JUMP24	30
#define	R_ARM_BASE_ABS	31
#define	R_ARM_ALU_PCREL_7_0	32
#define	R_ARM_ALU_PCREL_15_8	33
#define	R_ARM_ALU_PCREL_23_15	34
#define	R_ARM_LDR_SBREL_11_0_NC	35
#define	R_ARM_ALU_SBREL_19_12_NC	36
#define	R_ARM_ALU_SBREL_27_20_CK	37
#define	R_ARM_TARGET1	38
#define	R_ARM_SBREL31	39
#define	R_ARM_V4BX	40
#define	R_ARM_TARGET2	41
#define	R_ARM_PREL31	42
#define	R_ARM_MOVW_ABS_NC	43
#define	R_ARM_MOVT_ABS	44
#define	R_ARM_MOVW_PREL_NC	45
#define	R_ARM_MOVT_PREL	46
#define	R_ARM_THM_MOVW_ABS_NC	47
#define	R_ARM_THM_MOVT_ABS	48
#define	R_ARM_THM_MOVW_PREL_NC	49
#define	R_ARM_THM_MOVT_PREL	50
#define	R_ARM_THM_JUMP19	51
#define	R_ARM_THM_JUMP6	52
#define	R_ARM_THM_ALU_PREL_11_0	53
#define	R_ARM_THM_PC12	54
#define	R_ARM_ABS32_NOI	55
#define	R_ARM_REL32_NOI	56
#define	R_ARM_ALU_PC_G0_NC	57
#define	R_ARM_ALU_PC_G0	58
#define	R_ARM_ALU_PC_G1_NC	59
#define	R_ARM_ALU_PC_G1	60
#define	R_ARM_ALU_PC_G2	61
#define	R_ARM_LDR_PC_G1	62
#define	R_ARM_LDR_PC_G2	63
#define	R_ARM_LDRS_PC_G0	64
#define	R_ARM_LDRS_PC_G1	65
#define	R_ARM_LDRS_PC_G2	66
#define	R_ARM_LDC_PC_G0	67
#define	R_ARM_LDC_PC_G1	68
#define	R_ARM_LDC_PC_G2	69
#define	R_ARM_ALU_SB_G0_NC	70
#define	R_ARM_ALU_SB_G0	71
#define	R_ARM_ALU_SB_G1_NC	72
#define	R_ARM_ALU_SB_G1	73
#define	R_ARM_ALU_SB_G2	74
#define	R_ARM_LDR_SB_G0	75
#define	R_ARM_LDR_SB_G1	76
#define	R_ARM_LDR_SB_G2	77
#define	R_ARM_LDRS_SB_G0	78
#define	R_ARM_LDRS_SB_G1	79
#define	R_ARM_LDRS_SB_G2	80
#define	R_ARM_LDC_SB_G0	81
#define	R_ARM_LDC_SB_G1	82
#define	R_ARM_LDC_SB_G2	83
#define	R_ARM_MOVW_BREL_NC	84
#define	R_ARM_MOVT_BREL	85
#define	R_ARM_MOVW_BREL	86
#define	R_ARM_THM_MOVW_BREL_NC	87
#define	R_ARM_THM_MOVT_BREL	88
#define	R_ARM_THM_MOVW_BREL	89
#define	R_ARM_TLS_GOTDESC	90
#define	R_ARM_TLS_CALL	91
#define	R_ARM_TLS_DESCSEQ	92
#define	R_ARM_THM_TLS_CALL	93
#define	R_ARM_PLT32_ABS	94
#define	R_ARM_GOT_ABS	95
#define	R_ARM_GOT_PREL	96
#define	R_ARM_GOT_BREL12	97
#define	R_ARM_GOTOFF12	98
#define	R_ARM_GOTRELAX	99
#define	R_ARM_GNU_VTENTRY	100
#define	R_ARM_GNU_VTINHERIT	101
#define	R_ARM_THM_JUMP11	102
#define	R_ARM_THM_JUMP8	103
#define	R_ARM_TLS_GD32	104
#define	R_ARM_TLS_LDM32	105
#define	R_ARM_TLS_LDO32	106
#define	R_ARM_TLS_IE32	107
#define	R_ARM_TLS_LE32	108
#define	R_ARM_TLS_LDO12	109
#define	R_ARM_TLS_LE12	110
#define	R_ARM_TLS_IE12GP	111
#define	R_ARM_PRIVATE_0	112
#define	R_ARM_PRIVATE_1	113
#define	R_ARM_PRIVATE_2	114
#define	R_ARM_PRIVATE_3	115
#define	R_ARM_PRIVATE_4	116
#define	R_ARM_PRIVATE_5	117
#define	R_ARM_PRIVATE_6	118
#define	R_ARM_PRIVATE_7	119
#define	R_ARM_PRIVATE_8	120
#define	R_ARM_PRIVATE_9	121
#define	R_ARM_PRIVATE_10	122
#define	R_ARM_PRIVATE_11	123
#define	R_ARM_PRIVATE_12	124
#define	R_ARM_PRIVATE_13	125
#define	R_ARM_PRIVATE_14	126
#define	R_ARM_PRIVATE_15	127
#define	R_ARM_ME_TOO	128
#define	R_ARM_THM_TLS_DESCSEQ16	129
#define	R_ARM_THM_TLS_DESCSEQ32	130
#define	R_ARM_THM_GOT_BREL12	131
#define	R_ARM_IRELATIVE	140


#define	R_IA_64_NONE	0
#define	R_IA_64_IMM14	0x21
#define	R_IA_64_IMM22	0x22
#define	R_IA_64_IMM64	0x23
#define	R_IA_64_DIR32MSB	0x24
#define	R_IA_64_DIR32LSB	0x25
#define	R_IA_64_DIR64MSB	0x26
#define	R_IA_64_DIR64LSB	0x27
#define	R_IA_64_GPREL22	0x2a
#define	R_IA_64_GPREL64I	0x2b
#define	R_IA_64_GPREL32MSB	0x2c
#define	R_IA_64_GPREL32LSB	0x2d
#define	R_IA_64_GPREL64MSB	0x2e
#define	R_IA_64_GPREL64LSB	0x2f
#define	R_IA_64_LTOFF22	0x32
#define	R_IA_64_LTOFF64I	0x33
#define	R_IA_64_PLTOFF22	0x3a
#define	R_IA_64_PLTOFF64I	0x3b
#define	R_IA_64_PLTOFF64MSB	0x3e
#define	R_IA_64_PLTOFF64LSB	0x3f
#define	R_IA_64_FPTR64I	0x43
#define	R_IA_64_FPTR32MSB	0x44
#define	R_IA_64_FPTR32LSB	0x45
#define	R_IA_64_FPTR64MSB	0x46
#define	R_IA_64_FPTR64LSB	0x47
#define	R_IA_64_PCREL60B	0x48
#define	R_IA_64_PCREL21B	0x49
#define	R_IA_64_PCREL21M	0x4a
#define	R_IA_64_PCREL21F	0x4b
#define	R_IA_64_PCREL32MSB	0x4c
#define	R_IA_64_PCREL32LSB	0x4d
#define	R_IA_64_PCREL64MSB	0x4e
#define	R_IA_64_PCREL64LSB	0x4f
#define	R_IA_64_LTOFF_FPTR22	0x52
#define	R_IA_64_LTOFF_FPTR64I	0x53
#define	R_IA_64_LTOFF_FPTR32MSB	0x54
#define	R_IA_64_LTOFF_FPTR32LSB	0x55
#define	R_IA_64_LTOFF_FPTR64MSB	0x56
#define	R_IA_64_LTOFF_FPTR64LSB	0x57
#define	R_IA_64_SEGREL32MSB	0x5c
#define	R_IA_64_SEGREL32LSB	0x5d
#define	R_IA_64_SEGREL64MSB	0x5e
#define	R_IA_64_SEGREL64LSB	0x5f
#define	R_IA_64_SECREL32MSB	0x64
#define	R_IA_64_SECREL32LSB	0x65
#define	R_IA_64_SECREL64MSB	0x66
#define	R_IA_64_SECREL64LSB	0x67
#define	R_IA_64_REL32MSB	0x6c
#define	R_IA_64_REL32LSB	0x6d
#define	R_IA_64_REL64MSB	0x6e
#define	R_IA_64_REL64LSB	0x6f
#define	R_IA_64_LTV32MSB	0x74
#define	R_IA_64_LTV32LSB	0x75
#define	R_IA_64_LTV64MSB	0x76
#define	R_IA_64_LTV64LSB	0x77
#define	R_IA_64_PCREL21BI	0x79
#define	R_IA_64_PCREL22	0x7A
#define	R_IA_64_PCREL64I	0x7B
#define	R_IA_64_IPLTMSB	0x80
#define	R_IA_64_IPLTLSB	0x81
#define	R_IA_64_SUB	0x85
#define	R_IA_64_LTOFF22X	0x86
#define	R_IA_64_LDXMOV	0x87
#define	R_IA_64_TPREL14	0x91
#define	R_IA_64_TPREL22	0x92
#define	R_IA_64_TPREL64I	0x93
#define	R_IA_64_TPREL64MSB	0x96
#define	R_IA_64_TPREL64LSB	0x97
#define	R_IA_64_LTOFF_TPREL22	0x9A
#define	R_IA_64_DTPMOD64MSB	0xA6
#define	R_IA_64_DTPMOD64LSB	0xA7
#define	R_IA_64_LTOFF_DTPMOD22	0xAA
#define	R_IA_64_DTPREL14	0xB1
#define	R_IA_64_DTPREL22	0xB2
#define	R_IA_64_DTPREL64I	0xB3
#define	R_IA_64_DTPREL32MSB	0xB4
#define	R_IA_64_DTPREL32LSB	0xB5
#define	R_IA_64_DTPREL64MSB	0xB6
#define	R_IA_64_DTPREL64LSB	0xB7
#define	R_IA_64_LTOFF_DTPREL22	0xBA


#define	R_MIPS_NONE	0
#define	R_MIPS_16	1
#define	R_MIPS_32	2
#define	R_MIPS_REL32	3
#define	R_MIPS_26	4
#define	R_MIPS_HI16	5
#define	R_MIPS_LO16	6
#define	R_MIPS_GPREL16	7
#define	R_MIPS_LITERAL	8
#define	R_MIPS_GOT16	9
#define	R_MIPS_PC16	10
#define	R_MIPS_CALL16	11
#define	R_MIPS_GPREL32	12
#define	R_MIPS_SHIFT5	16
#define	R_MIPS_SHIFT6	17
#define	R_MIPS_64	18
#define	R_MIPS_GOT_DISP	19
#define	R_MIPS_GOT_PAGE	20
#define	R_MIPS_GOT_OFST	21
#define	R_MIPS_GOT_HI16	22
#define	R_MIPS_GOT_LO16	23
#define	R_MIPS_SUB	24
#define	R_MIPS_CALLHI16	30
#define	R_MIPS_CALLLO16	31
#define	R_MIPS_JALR	37
#define	R_MIPS_TLS_DTPMOD32	38
#define	R_MIPS_TLS_DTPREL32	39
#define	R_MIPS_TLS_DTPMOD64	40
#define	R_MIPS_TLS_DTPREL64	41
#define	R_MIPS_TLS_GD	42
#define	R_MIPS_TLS_LDM	43
#define	R_MIPS_TLS_DTPREL_HI16	44
#define	R_MIPS_TLS_DTPREL_LO16	45
#define	R_MIPS_TLS_GOTTPREL	46
#define	R_MIPS_TLS_TPREL32	47
#define	R_MIPS_TLS_TPREL64	48
#define	R_MIPS_TLS_TPREL_HI16	49
#define	R_MIPS_TLS_TPREL_LO16	50


#define	R_PPC_NONE	0
#define	R_PPC_ADDR32	1
#define	R_PPC_ADDR24	2
#define	R_PPC_ADDR16	3
#define	R_PPC_ADDR16_LO	4
#define	R_PPC_ADDR16_HI	5
#define	R_PPC_ADDR16_HA	6
#define	R_PPC_ADDR14	7
#define	R_PPC_ADDR14_BRTAKEN	8
#define	R_PPC_ADDR14_BRNTAKEN	9
#define	R_PPC_REL24	10
#define	R_PPC_REL14	11
#define	R_PPC_REL14_BRTAKEN	12
#define	R_PPC_REL14_BRNTAKEN	13
#define	R_PPC_GOT16	14
#define	R_PPC_GOT16_LO	15
#define	R_PPC_GOT16_HI	16
#define	R_PPC_GOT16_HA	17
#define	R_PPC_PLTREL24	18
#define	R_PPC_COPY	19
#define	R_PPC_GLOB_DAT	20
#define	R_PPC_JMP_SLOT	21
#define	R_PPC_RELATIVE	22
#define	R_PPC_LOCAL24PC	23
#define	R_PPC_UADDR32	24
#define	R_PPC_UADDR16	25
#define	R_PPC_REL32	26
#define	R_PPC_PLT32	27
#define	R_PPC_PLTREL32	28
#define	R_PPC_PLT16_LO	29
#define	R_PPC_PLT16_HI	30
#define	R_PPC_PLT16_HA	31
#define	R_PPC_SDAREL16	32
#define	R_PPC_SECTOFF	33
#define	R_PPC_SECTOFF_LO	34
#define	R_PPC_SECTOFF_HI	35
#define	R_PPC_SECTOFF_HA	36
#define	R_PPC_ADDR30	37
#define	R_PPC_TLS	67
#define	R_PPC_DTPMOD32	68
#define	R_PPC_TPREL16	69
#define	R_PPC_TPREL16_LO	70
#define	R_PPC_TPREL16_HI	71
#define	R_PPC_TPREL16_HA	72
#define	R_PPC_TPREL32	73
#define	R_PPC_DTPREL16	74
#define	R_PPC_DTPREL16_LO	75
#define	R_PPC_DTPREL16_HI	76
#define	R_PPC_DTPREL16_HA	77
#define	R_PPC_DTPREL32	78
#define	R_PPC_GOT_TLSGD16	79
#define	R_PPC_GOT_TLSGD16_LO	80
#define	R_PPC_GOT_TLSGD16_HI	81
#define	R_PPC_GOT_TLSGD16_HA	82
#define	R_PPC_GOT_TLSLD16	83
#define	R_PPC_GOT_TLSLD16_LO	84
#define	R_PPC_GOT_TLSLD16_HI	85
#define	R_PPC_GOT_TLSLD16_HA	86
#define	R_PPC_GOT_TPREL16	87
#define	R_PPC_GOT_TPREL16_LO	88
#define	R_PPC_GOT_TPREL16_HI	89
#define	R_PPC_GOT_TPREL16_HA	90
#define	R_PPC_GOT_DTPREL16	91
#define	R_PPC_GOT_DTPREL16_LO	92
#define	R_PPC_GOT_DTPREL16_HI	93
#define	R_PPC_GOT_DTPREL16_HA	94
#define	R_PPC_TLSGD	95
#define	R_PPC_TLSLD	96
#define	R_PPC_EMB_NADDR32	101
#define	R_PPC_EMB_NADDR16	102
#define	R_PPC_EMB_NADDR16_LO	103
#define	R_PPC_EMB_NADDR16_HI	104
#define	R_PPC_EMB_NADDR16_HA	105
#define	R_PPC_EMB_SDAI16	106
#define	R_PPC_EMB_SDA2I16	107
#define	R_PPC_EMB_SDA2REL	108
#define	R_PPC_EMB_SDA21	109
#define	R_PPC_EMB_MRKREF	110
#define	R_PPC_EMB_RELSEC16	111
#define	R_PPC_EMB_RELST_LO	112
#define	R_PPC_EMB_RELST_HI	113
#define	R_PPC_EMB_RELST_HA	114
#define	R_PPC_EMB_BIT_FLD	115
#define	R_PPC_EMB_RELSDA	116


#define	R_PPC64_NONE	0
#define	R_PPC64_ADDR32	1
#define	R_PPC64_ADDR24	2
#define	R_PPC64_ADDR16	3
#define	R_PPC64_ADDR16_LO	4
#define	R_PPC64_ADDR16_HI	5
#define	R_PPC64_ADDR16_HA	6
#define	R_PPC64_ADDR14	7
#define	R_PPC64_ADDR14_BRTAKEN	8
#define	R_PPC64_ADDR14_BRNTAKEN	9
#define	R_PPC64_REL24	10
#define	R_PPC64_REL14	11
#define	R_PPC64_REL14_BRTAKEN	12
#define	R_PPC64_REL14_BRNTAKEN	13
#define	R_PPC64_GOT16	14
#define	R_PPC64_GOT16_LO	15
#define	R_PPC64_GOT16_HI	16
#define	R_PPC64_GOT16_HA	17
#define	R_PPC64_COPY	19
#define	R_PPC64_GLOB_DAT	20
#define	R_PPC64_JMP_SLOT	21
#define	R_PPC64_RELATIVE	22
#define	R_PPC64_UADDR32	24
#define	R_PPC64_UADDR16	25
#define	R_PPC64_REL32	26
#define	R_PPC64_PLT32	27
#define	R_PPC64_PLTREL32	28
#define	R_PPC64_PLT16_LO	29
#define	R_PPC64_PLT16_HI	30
#define	R_PPC64_PLT16_HA	31
#define	R_PPC64_SECTOFF	33
#define	R_PPC64_SECTOFF_LO	34
#define	R_PPC64_SECTOFF_HI	35
#define	R_PPC64_SECTOFF_HA	36
#define	R_PPC64_ADDR30	37
#define	R_PPC64_ADDR64	38
#define	R_PPC64_ADDR16_HIGHER	39
#define	R_PPC64_ADDR16_HIGHERA	40
#define	R_PPC64_ADDR16_HIGHEST	41
#define	R_PPC64_ADDR16_HIGHESTA	42
#define	R_PPC64_UADDR64	43
#define	R_PPC64_REL64	44
#define	R_PPC64_PLT64	45
#define	R_PPC64_PLTREL64	46
#define	R_PPC64_TOC16	47
#define	R_PPC64_TOC16_LO	48
#define	R_PPC64_TOC16_HI	49
#define	R_PPC64_TOC16_HA	50
#define	R_PPC64_TOC	51
#define	R_PPC64_PLTGOT16	52
#define	R_PPC64_PLTGOT16_LO	53
#define	R_PPC64_PLTGOT16_HI	54
#define	R_PPC64_PLTGOT16_HA	55
#define	R_PPC64_ADDR16_DS	56
#define	R_PPC64_ADDR16_LO_DS	57
#define	R_PPC64_GOT16_DS	58
#define	R_PPC64_GOT16_LO_DS	59
#define	R_PPC64_PLT16_LO_DS	60
#define	R_PPC64_SECTOFF_DS	61
#define	R_PPC64_SECTOFF_LO_DS	62
#define	R_PPC64_TOC16_DS	63
#define	R_PPC64_TOC16_LO_DS	64
#define	R_PPC64_PLTGOT16_DS	65
#define	R_PPC64_PLTGOT16_LO_DS	66
#define	R_PPC64_TLS	67
#define	R_PPC64_DTPMOD64	68
#define	R_PPC64_TPREL16	69
#define	R_PPC64_TPREL16_LO	60
#define	R_PPC64_TPREL16_HI	71
#define	R_PPC64_TPREL16_HA	72
#define	R_PPC64_TPREL64	73
#define	R_PPC64_DTPREL16	74
#define	R_PPC64_DTPREL16_LO	75
#define	R_PPC64_DTPREL16_HI	76
#define	R_PPC64_DTPREL16_HA	77
#define	R_PPC64_DTPREL64	78
#define	R_PPC64_GOT_TLSGD16	79
#define	R_PPC64_GOT_TLSGD16_LO	80
#define	R_PPC64_GOT_TLSGD16_HI	81
#define	R_PPC64_GOT_TLSGD16_HA	82
#define	R_PPC64_GOT_TLSLD16	83
#define	R_PPC64_GOT_TLSLD16_LO	84
#define	R_PPC64_GOT_TLSLD16_HI	85
#define	R_PPC64_GOT_TLSLD16_HA	86
#define	R_PPC64_GOT_TPREL16_DS	87
#define	R_PPC64_GOT_TPREL16_LO_DS	88
#define	R_PPC64_GOT_TPREL16_HI	89
#define	R_PPC64_GOT_TPREL16_HA	90
#define	R_PPC64_GOT_DTPREL16_DS	91
#define	R_PPC64_GOT_DTPREL16_LO_DS	92
#define	R_PPC64_GOT_DTPREL16_HI	93
#define	R_PPC64_GOT_DTPREL16_HA	94
#define	R_PPC64_TPREL16_DS	95
#define	R_PPC64_TPREL16_LO_DS	96
#define	R_PPC64_TPREL16_HIGHER	97
#define	R_PPC64_TPREL16_HIGHERA	98
#define	R_PPC64_TPREL16_HIGHEST	99
#define	R_PPC64_TPREL16_HIGHESTA	100
#define	R_PPC64_DTPREL16_DS	101
#define	R_PPC64_DTPREL16_LO_DS	102
#define	R_PPC64_DTPREL16_HIGHER	103
#define	R_PPC64_DTPREL16_HIGHERA	104
#define	R_PPC64_DTPREL16_HIGHEST	105
#define	R_PPC64_DTPREL16_HIGHESTA	106
#define	R_PPC64_TLSGD	107
#define	R_PPC64_TLSLD	108


#define	R_RISCV_NONE	0
#define	R_RISCV_32	1
#define	R_RISCV_64	2
#define	R_RISCV_RELATIVE	3
#define	R_RISCV_COPY	4
#define	R_RISCV_JUMP_SLOT	5
#define	R_RISCV_TLS_DTPMOD32	6
#define	R_RISCV_TLS_DTPMOD64	7
#define	R_RISCV_TLS_DTPREL32	8
#define	R_RISCV_TLS_DTPREL64	9
#define	R_RISCV_TLS_TPREL32	10
#define	R_RISCV_TLS_TPREL64	11
#define	R_RISCV_BRANCH	16
#define	R_RISCV_JAL	17
#define	R_RISCV_CALL	18
#define	R_RISCV_CALL_PLT	19
#define	R_RISCV_GOT_HI20	20
#define	R_RISCV_TLS_GOT_HI20	21
#define	R_RISCV_TLS_GD_HI20	22
#define	R_RISCV_PCREL_HI20	23
#define	R_RISCV_PCREL_LO12_I	24
#define	R_RISCV_PCREL_LO12_S	25
#define	R_RISCV_HI20	26
#define	R_RISCV_LO12_I	27
#define	R_RISCV_LO12_S	28
#define	R_RISCV_TPREL_HI20	29
#define	R_RISCV_TPREL_LO12_I	30
#define	R_RISCV_TPREL_LO12_S	31
#define	R_RISCV_TPREL_ADD	32
#define	R_RISCV_ADD8	33
#define	R_RISCV_ADD16	34
#define	R_RISCV_ADD32	35
#define	R_RISCV_ADD64	36
#define	R_RISCV_SUB8	37
#define	R_RISCV_SUB16	38
#define	R_RISCV_SUB32	39
#define	R_RISCV_SUB64	40
#define	R_RISCV_GNU_VTINHERIT	41
#define	R_RISCV_GNU_VTENTRY	42
#define	R_RISCV_ALIGN	43
#define	R_RISCV_RVC_BRANCH	44
#define	R_RISCV_RVC_JUMP	45
#define	R_RISCV_RVC_LUI	46
#define	R_RISCV_GPREL_I	47
#define	R_RISCV_GPREL_S	48
#define	R_RISCV_TPREL_I	49
#define	R_RISCV_TPREL_S	50
#define	R_RISCV_RELAX	51
#define	R_RISCV_SUB6	52
#define	R_RISCV_SET6	53
#define	R_RISCV_SET8	54
#define	R_RISCV_SET16	55
#define	R_RISCV_SET32	56
#define	R_RISCV_32_PCREL	57
#define	R_RISCV_IRELATIVE	58


#define	R_SPARC_NONE	0
#define	R_SPARC_8	1
#define	R_SPARC_16	2
#define	R_SPARC_32	3
#define	R_SPARC_DISP8	4
#define	R_SPARC_DISP16	5
#define	R_SPARC_DISP32	6
#define	R_SPARC_WDISP30	7
#define	R_SPARC_WDISP22	8
#define	R_SPARC_HI22	9
#define	R_SPARC_22	10
#define	R_SPARC_13	11
#define	R_SPARC_LO10	12
#define	R_SPARC_GOT10	13
#define	R_SPARC_GOT13	14
#define	R_SPARC_GOT22	15
#define	R_SPARC_PC10	16
#define	R_SPARC_PC22	17
#define	R_SPARC_WPLT30	18
#define	R_SPARC_COPY	19
#define	R_SPARC_GLOB_DAT	20
#define	R_SPARC_JMP_SLOT	21
#define	R_SPARC_RELATIVE	22
#define	R_SPARC_UA32	23
#define	R_SPARC_PLT32	24
#define	R_SPARC_HIPLT22	25
#define	R_SPARC_LOPLT10	26
#define	R_SPARC_PCPLT32	27
#define	R_SPARC_PCPLT22	28
#define	R_SPARC_PCPLT10	29
#define	R_SPARC_10	30
#define	R_SPARC_11	31
#define	R_SPARC_64	32
#define	R_SPARC_OLO10	33
#define	R_SPARC_HH22	34
#define	R_SPARC_HM10	35
#define	R_SPARC_LM22	36
#define	R_SPARC_PC_HH22	37
#define	R_SPARC_PC_HM10	38
#define	R_SPARC_PC_LM22	39
#define	R_SPARC_WDISP16	40
#define	R_SPARC_WDISP19	41
#define	R_SPARC_GLOB_JMP	42
#define	R_SPARC_7	43
#define	R_SPARC_5	44
#define	R_SPARC_6	45
#define	R_SPARC_DISP64	46
#define	R_SPARC_PLT64	47
#define	R_SPARC_HIX22	48
#define	R_SPARC_LOX10	49
#define	R_SPARC_H44	50
#define	R_SPARC_M44	51
#define	R_SPARC_L44	52
#define	R_SPARC_REGISTER	53
#define	R_SPARC_UA64	54
#define	R_SPARC_UA16	55
#define	R_SPARC_TLS_GD_HI22	56
#define	R_SPARC_TLS_GD_LO10	57
#define	R_SPARC_TLS_GD_ADD	58
#define	R_SPARC_TLS_GD_CALL	59
#define	R_SPARC_TLS_LDM_HI22	60
#define	R_SPARC_TLS_LDM_LO10	61
#define	R_SPARC_TLS_LDM_ADD	62
#define	R_SPARC_TLS_LDM_CALL	63
#define	R_SPARC_TLS_LDO_HIX22	64
#define	R_SPARC_TLS_LDO_LOX10	65
#define	R_SPARC_TLS_LDO_ADD	66
#define	R_SPARC_TLS_IE_HI22	67
#define	R_SPARC_TLS_IE_LO10	68
#define	R_SPARC_TLS_IE_LD	69
#define	R_SPARC_TLS_IE_LDX	70
#define	R_SPARC_TLS_IE_ADD	71
#define	R_SPARC_TLS_LE_HIX22	72
#define	R_SPARC_TLS_LE_LOX10	73
#define	R_SPARC_TLS_DTPMOD32	74
#define	R_SPARC_TLS_DTPMOD64	75
#define	R_SPARC_TLS_DTPOFF32	76
#define	R_SPARC_TLS_DTPOFF64	77
#define	R_SPARC_TLS_TPOFF32	78
#define	R_SPARC_TLS_TPOFF64	79
#define	R_SPARC_GOTDATA_HIX22	80
#define	R_SPARC_GOTDATA_LOX10	81
#define	R_SPARC_GOTDATA_OP_HIX22	82
#define	R_SPARC_GOTDATA_OP_LOX10	83
#define	R_SPARC_GOTDATA_OP	84
#define	R_SPARC_H34	85


#define	R_X86_64_NONE	0
#define	R_X86_64_64	1
#define	R_X86_64_PC32	2
#define	R_X86_64_GOT32	3
#define	R_X86_64_PLT32	4
#define	R_X86_64_COPY	5
#define	R_X86_64_GLOB_DAT	6
#define	R_X86_64_JUMP_SLOT	7
#define	R_X86_64_RELATIVE	8
#define	R_X86_64_GOTPCREL	9
#define	R_X86_64_32	10
#define	R_X86_64_32S	11
#define	R_X86_64_16	12
#define	R_X86_64_PC16	13
#define	R_X86_64_8	14
#define	R_X86_64_PC8	15
#define	R_X86_64_DTPMOD64	16
#define	R_X86_64_DTPOFF64	17
#define	R_X86_64_TPOFF64	18
#define	R_X86_64_TLSGD	19
#define	R_X86_64_TLSLD	20
#define	R_X86_64_DTPOFF32	21
#define	R_X86_64_GOTTPOFF	22
#define	R_X86_64_TPOFF32	23
#define	R_X86_64_PC64	24
#define	R_X86_64_GOTOFF64	25
#define	R_X86_64_GOTPC32	26
#define	R_X86_64_GOT64	27
#define	R_X86_64_GOTPCREL64	28
#define	R_X86_64_GOTPC64	29
#define	R_X86_64_GOTPLT64	30
#define	R_X86_64_PLTOFF64	31
#define	R_X86_64_SIZE32	32
#define	R_X86_64_SIZE64	33
#define	R_X86_64_GOTPC32_TLSDESC	34
#define	R_X86_64_TLSDESC_CALL	35
#define	R_X86_64_TLSDESC	36
#define	R_X86_64_IRELATIVE	37
#define	R_X86_64_RELATIVE64	38
#define	R_X86_64_GOTPCRELX	41
#define	R_X86_64_REX_GOTPCRELX	42



/*
 * MIPS ABI related.
 */

#define	E_MIPS_ABI_O32	0x00001000
#define	E_MIPS_ABI_O64	0x00002000
#define	E_MIPS_ABI_EABI32	0x00003000
#define	E_MIPS_ABI_EABI64	0x00004000


/**
 ** ELF Types.
 **/

typedef uint32_t	Elf32_Addr;	/* Program address. */
typedef uint8_t		Elf32_Byte;	/* Unsigned tiny integer. */
typedef uint16_t	Elf32_Half;	/* Unsigned medium integer. */
typedef uint32_t	Elf32_Off;	/* File offset. */
typedef uint16_t	Elf32_Section;	/* Section index. */
typedef int32_t		Elf32_Sword;	/* Signed integer. */
typedef uint32_t	Elf32_Word;	/* Unsigned integer. */
typedef uint64_t	Elf32_Lword;	/* Unsigned long integer. */

typedef uint64_t	Elf64_Addr;	/* Program address. */
typedef uint8_t		Elf64_Byte;	/* Unsigned tiny integer. */
typedef uint16_t	Elf64_Half;	/* Unsigned medium integer. */
typedef uint64_t	Elf64_Off;	/* File offset. */
typedef uint16_t	Elf64_Section;	/* Section index. */
typedef int32_t		Elf64_Sword;	/* Signed integer. */
typedef uint32_t	Elf64_Word;	/* Unsigned integer. */
typedef uint64_t	Elf64_Lword;	/* Unsigned long integer. */
typedef uint64_t	Elf64_Xword;	/* Unsigned long integer. */
typedef int64_t		Elf64_Sxword;	/* Signed long integer. */


/*
 * Capability descriptors.
 */

/* 32-bit capability descriptor. */
typedef struct {
	Elf32_Word	c_tag;	     /* Type of entry. */
	union {
		Elf32_Word	c_val; /* Integer value. */
		Elf32_Addr	c_ptr; /* Pointer value. */
	} c_un;
} Elf32_Cap;

/* 64-bit capability descriptor. */
typedef struct {
	Elf64_Xword	c_tag;	     /* Type of entry. */
	union {
		Elf64_Xword	c_val; /* Integer value. */
		Elf64_Addr	c_ptr; /* Pointer value. */
	} c_un;
} Elf64_Cap;

/*
 * MIPS .conflict section entries.
 */

/* 32-bit entry. */
typedef struct {
	Elf32_Addr	c_index;
} Elf32_Conflict;

/* 64-bit entry. */
typedef struct {
	Elf64_Addr	c_index;
} Elf64_Conflict;

/*
 * Dynamic section entries.
 */

/* 32-bit entry. */
typedef struct {
	Elf32_Sword	d_tag;	     /* Type of entry. */
	union {
		Elf32_Word	d_val; /* Integer value. */
		Elf32_Addr	d_ptr; /* Pointer value. */
	} d_un;
} Elf32_Dyn;

/* 64-bit entry. */
typedef struct {
	Elf64_Sxword	d_tag;	     /* Type of entry. */
	union {
		Elf64_Xword	d_val; /* Integer value. */
		Elf64_Addr	d_ptr; /* Pointer value; */
	} d_un;
} Elf64_Dyn;


/*
 * The executable header (EHDR).
 */

/* 32 bit EHDR. */
typedef struct {
	unsigned char   e_ident[EI_NIDENT]; /* ELF identification. */
	Elf32_Half      e_type;	     /* Object file type (ET_*). */
	Elf32_Half      e_machine;   /* Machine type (EM_*). */
	Elf32_Word      e_version;   /* File format version (EV_*). */
	Elf32_Addr      e_entry;     /* Start address. */
	Elf32_Off       e_phoff;     /* File offset to the PHDR table. */
	Elf32_Off       e_shoff;     /* File offset to the SHDRheader. */
	Elf32_Word      e_flags;     /* Flags (EF_*). */
	Elf32_Half      e_ehsize;    /* Elf header size in bytes. */
	Elf32_Half      e_phentsize; /* PHDR table entry size in bytes. */
	Elf32_Half      e_phnum;     /* Number of PHDR entries. */
	Elf32_Half      e_shentsize; /* SHDR table entry size in bytes. */
	Elf32_Half      e_shnum;     /* Number of SHDR entries. */
	Elf32_Half      e_shstrndx;  /* Index of section name string table. */
} Elf32_Ehdr;


/* 64 bit EHDR. */
typedef struct {
	unsigned char   e_ident[EI_NIDENT]; /* ELF identification. */
	Elf64_Half      e_type;	     /* Object file type (ET_*). */
	Elf64_Half      e_machine;   /* Machine type (EM_*). */
	Elf64_Word      e_version;   /* File format version (EV_*). */
	Elf64_Addr      e_entry;     /* Start address. */
	Elf64_Off       e_phoff;     /* File offset to the PHDR table. */
	Elf64_Off       e_shoff;     /* File offset to the SHDRheader. */
	Elf64_Word      e_flags;     /* Flags (EF_*). */
	Elf64_Half      e_ehsize;    /* Elf header size in bytes. */
	Elf64_Half      e_phentsize; /* PHDR table entry size in bytes. */
	Elf64_Half      e_phnum;     /* Number of PHDR entries. */
	Elf64_Half      e_shentsize; /* SHDR table entry size in bytes. */
	Elf64_Half      e_shnum;     /* Number of SHDR entries. */
	Elf64_Half      e_shstrndx;  /* Index of section name string table. */
} Elf64_Ehdr;


/*
 * Shared object information.
 */

/* 32-bit entry. */
typedef struct {
	Elf32_Word l_name;	     /* The name of a shared object. */
	Elf32_Word l_time_stamp;     /* 32-bit timestamp. */
	Elf32_Word l_checksum;	     /* Checksum of visible symbols, sizes. */
	Elf32_Word l_version;	     /* Interface version string index. */
	Elf32_Word l_flags;	     /* Flags (LL_*). */
} Elf32_Lib;

/* 64-bit entry. */
typedef struct {
	Elf64_Word l_name;	     /* The name of a shared object. */
	Elf64_Word l_time_stamp;     /* 32-bit timestamp. */
	Elf64_Word l_checksum;	     /* Checksum of visible symbols, sizes. */
	Elf64_Word l_version;	     /* Interface version string index. */
	Elf64_Word l_flags;	     /* Flags (LL_*). */
} Elf64_Lib;


#define	LL_NONE		0
#define	LL_EXACT_MATCH	0x1
#define	LL_IGNORE_INT_VER	0x2
#define	LL_REQUIRE_MINOR	0x4
#define	LL_EXPORTS	0x8
#define	LL_DELAY_LOAD	0x10
#define	LL_DELTA	0x20


/*
 * Note tags
 */

#define	NT_ABI_TAG	1
#define	NT_GNU_HWCAP	2
#define	NT_GNU_BUILD_ID	3
#define	NT_GNU_GOLD_VERSION	4
#define	NT_PRSTATUS	1
#define	NT_FPREGSET	2
#define	NT_PRPSINFO	3
#define	NT_AUXV		6
#define	NT_PRXFPREG	0x46E62B7FUL
#define	NT_PSTATUS	10
#define	NT_FPREGS	12
#define	NT_PSINFO	13
#define	NT_LWPSTATUS	16
#define	NT_LWPSINFO	17
#define	NT_FREEBSD_NOINIT_TAG	2
#define	NT_FREEBSD_ARCH_TAG	3
#define	NT_FREEBSD_FEATURE_CTL	4

/* Aliases for the ABI tag. */

#define	NT_FREEBSD_ABI_TAG	NT_ABI_TAG
#define	NT_GNU_ABI_TAG	NT_ABI_TAG
#define	NT_NETBSD_IDENT	NT_ABI_TAG
#define	NT_OPENBSD_IDENT	NT_ABI_TAG


/*
 * Note descriptors.
 */

typedef	struct {
	uint32_t	n_namesz;    /* Length of note's name. */
	uint32_t	n_descsz;    /* Length of note's value. */
	uint32_t	n_type;	     /* Type of note. */
} Elf_Note;

typedef Elf_Note Elf32_Nhdr;	     /* 32-bit note header. */
typedef Elf_Note Elf64_Nhdr;	     /* 64-bit note header. */

/*
 * MIPS ELF options descriptor header.
 */

typedef struct {
	Elf64_Byte	kind;        /* Type of options. */
	Elf64_Byte     	size;	     /* Size of option descriptor. */
	Elf64_Half	section;     /* Index of section affected. */
	Elf64_Word	info;        /* Kind-specific information. */
} Elf_Options;

/*
 * Option kinds.
 */

#define	ODK_NULL	0
#define	ODK_REGINFO	1
#define	ODK_EXCEPTIONS	2
#define	ODK_PAD		3
#define	ODK_HWPATCH	4
#define	ODK_FILL	5
#define	ODK_TAGS	6
#define	ODK_HWAND	7
#define	ODK_HWOR	8
#define	ODK_GP_GROUP	9
#define	ODK_IDENT	10
#define	ODK_PAGESIZE	11


/*
 * ODK_EXCEPTIONS info field masks.
 */

#define	OEX_FPU_MIN	0x0000001FUL
#define	OEX_FPU_MAX	0x00001F00UL
#define	OEX_PAGE0	0x00010000UL
#define	OEX_SMM		0x00020000UL
#define	OEX_PRECISEFP	0x00040000UL
#define	OEX_DISMISS	0x00080000UL


/*
 * ODK_PAD info field masks.
 */

#define	OPAD_PREFIX	0x0001
#define	OPAD_POSTFIX	0x0002
#define	OPAD_SYMBOL	0x0004


/*
 * ODK_HWPATCH info field masks and ODK_HWAND/ODK_HWOR info field
 * and hwp_flags[12] masks.
 */

#define	OHW_R4KEOP	0x00000001UL
#define	OHW_R8KPFETCH	0x00000002UL
#define	OHW_R5KEOP	0x00000004UL
#define	OHW_R5KCVTL	0x00000008UL
#define	OHW_R10KLDL	0x00000010UL
#define	OHWA0_R4KEOP_CHECKED	0x00000001UL
#define	OHWA0_R4KEOP_CLEAN	0x00000002UL
#define	OHWO0_FIXADE	0x00000001UL


/*
 * ODK_IDENT/ODK_GP_GROUP info field masks.
 */

#define	OGP_GROUP	0x0000FFFFUL
#define	OGP_SELF	0x00010000UL


/*
 * MIPS ELF register info descriptor.
 */

/* 32 bit RegInfo entry. */
typedef struct {
	Elf32_Word	ri_gprmask;  /* Mask of general register used. */
	Elf32_Word	ri_cprmask[4]; /* Mask of coprocessor register used. */
	Elf32_Addr	ri_gp_value; /* GP register value. */
} Elf32_RegInfo;

/* 64 bit RegInfo entry. */
typedef struct {
	Elf64_Word	ri_gprmask;  /* Mask of general register used. */
	Elf64_Word	ri_pad;	     /* Padding. */
	Elf64_Word	ri_cprmask[4]; /* Mask of coprocessor register used. */
	Elf64_Addr	ri_gp_value; /* GP register value. */
} Elf64_RegInfo;

/*
 * Program Header Table (PHDR) entries.
 */

/* 32 bit PHDR entry. */
typedef struct {
	Elf32_Word	p_type;	     /* Type of segment. */
	Elf32_Off	p_offset;    /* File offset to segment. */
	Elf32_Addr	p_vaddr;     /* Virtual address in memory. */
	Elf32_Addr	p_paddr;     /* Physical address (if relevant). */
	Elf32_Word	p_filesz;    /* Size of segment in file. */
	Elf32_Word	p_memsz;     /* Size of segment in memory. */
	Elf32_Word	p_flags;     /* Segment flags. */
	Elf32_Word	p_align;     /* Alignment constraints. */
} Elf32_Phdr;

/* 64 bit PHDR entry. */
typedef struct {
	Elf64_Word	p_type;	     /* Type of segment. */
	Elf64_Word	p_flags;     /* Segment flags. */
	Elf64_Off	p_offset;    /* File offset to segment. */
	Elf64_Addr	p_vaddr;     /* Virtual address in memory. */
	Elf64_Addr	p_paddr;     /* Physical address (if relevant). */
	Elf64_Xword	p_filesz;    /* Size of segment in file. */
	Elf64_Xword	p_memsz;     /* Size of segment in memory. */
	Elf64_Xword	p_align;     /* Alignment constraints. */
} Elf64_Phdr;


/*
 * Move entries, for describing data in COMMON blocks in a compact
 * manner.
 */

/* 32-bit move entry. */
typedef struct {
	Elf32_Lword	m_value;     /* Initialization value. */
	Elf32_Word 	m_info;	     /* Encoded size and index. */
	Elf32_Word	m_poffset;   /* Offset relative to symbol. */
	Elf32_Half	m_repeat;    /* Repeat count. */
	Elf32_Half	m_stride;    /* Number of units to skip. */
} Elf32_Move;

/* 64-bit move entry. */
typedef struct {
	Elf64_Lword	m_value;     /* Initialization value. */
	Elf64_Xword 	m_info;	     /* Encoded size and index. */
	Elf64_Xword	m_poffset;   /* Offset relative to symbol. */
	Elf64_Half	m_repeat;    /* Repeat count. */
	Elf64_Half	m_stride;    /* Number of units to skip. */
} Elf64_Move;

#define ELF32_M_SYM(I)		((I) >> 8)
#define ELF32_M_SIZE(I)		((unsigned char) (I))
#define ELF32_M_INFO(M, S)	(((M) << 8) + (unsigned char) (S))

#define ELF64_M_SYM(I)		((I) >> 8)
#define ELF64_M_SIZE(I)		((unsigned char) (I))
#define ELF64_M_INFO(M, S)	(((M) << 8) + (unsigned char) (S))

/*
 * Section Header Table (SHDR) entries.
 */

/* 32 bit SHDR */
typedef struct {
	Elf32_Word	sh_name;     /* index of section name */
	Elf32_Word	sh_type;     /* section type */
	Elf32_Word	sh_flags;    /* section flags */
	Elf32_Addr	sh_addr;     /* in-memory address of section */
	Elf32_Off	sh_offset;   /* file offset of section */
	Elf32_Word	sh_size;     /* section size in bytes */
	Elf32_Word	sh_link;     /* section header table link */
	Elf32_Word	sh_info;     /* extra information */
	Elf32_Word	sh_addralign; /* alignment constraint */
	Elf32_Word	sh_entsize;   /* size for fixed-size entries */
} Elf32_Shdr;

/* 64 bit SHDR */
typedef struct {
	Elf64_Word	sh_name;     /* index of section name */
	Elf64_Word	sh_type;     /* section type */
	Elf64_Xword	sh_flags;    /* section flags */
	Elf64_Addr	sh_addr;     /* in-memory address of section */
	Elf64_Off	sh_offset;   /* file offset of section */
	Elf64_Xword	sh_size;     /* section size in bytes */
	Elf64_Word	sh_link;     /* section header table link */
	Elf64_Word	sh_info;     /* extra information */
	Elf64_Xword	sh_addralign; /* alignment constraint */
	Elf64_Xword	sh_entsize;  /* size for fixed-size entries */
} Elf64_Shdr;


/*
 * Symbol table entries.
 */

typedef struct {
	Elf32_Word	st_name;     /* index of symbol's name */
	Elf32_Addr	st_value;    /* value for the symbol */
	Elf32_Word	st_size;     /* size of associated data */
	unsigned char	st_info;     /* type and binding attributes */
	unsigned char	st_other;    /* visibility */
	Elf32_Half	st_shndx;    /* index of related section */
} Elf32_Sym;

typedef struct {
	Elf64_Word	st_name;     /* index of symbol's name */
	unsigned char	st_info;     /* type and binding attributes */
	unsigned char	st_other;    /* visibility */
	Elf64_Half	st_shndx;    /* index of related section */
	Elf64_Addr	st_value;    /* value for the symbol */
	Elf64_Xword	st_size;     /* size of associated data */
} Elf64_Sym;

#define ELF32_ST_BIND(I)	((I) >> 4)
#define ELF32_ST_TYPE(I)	((I) & 0xFU)
#define ELF32_ST_INFO(B,T)	(((B) << 4) + ((T) & 0xF))

#define ELF64_ST_BIND(I)	((I) >> 4)
#define ELF64_ST_TYPE(I)	((I) & 0xFU)
#define ELF64_ST_INFO(B,T)	(((B) << 4) + ((T) & 0xF))

#define ELF32_ST_VISIBILITY(O)	((O) & 0x3)
#define ELF64_ST_VISIBILITY(O)	((O) & 0x3)

/*
 * Syminfo descriptors, containing additional symbol information.
 */

/* 32-bit entry. */
typedef struct {
	Elf32_Half	si_boundto;  /* Entry index with additional flags. */
	Elf32_Half	si_flags;    /* Flags. */
} Elf32_Syminfo;

/* 64-bit entry. */
typedef struct {
	Elf64_Half	si_boundto;  /* Entry index with additional flags. */
	Elf64_Half	si_flags;    /* Flags. */
} Elf64_Syminfo;

/*
 * Relocation descriptors.
 */

typedef struct {
	Elf32_Addr	r_offset;    /* location to apply relocation to */
	Elf32_Word	r_info;	     /* type+section for relocation */
} Elf32_Rel;

typedef struct {
	Elf32_Addr	r_offset;    /* location to apply relocation to */
	Elf32_Word	r_info;      /* type+section for relocation */
	Elf32_Sword	r_addend;    /* constant addend */
} Elf32_Rela;

typedef struct {
	Elf64_Addr	r_offset;    /* location to apply relocation to */
	Elf64_Xword	r_info;      /* type+section for relocation */
} Elf64_Rel;

typedef struct {
	Elf64_Addr	r_offset;    /* location to apply relocation to */
	Elf64_Xword	r_info;      /* type+section for relocation */
	Elf64_Sxword	r_addend;    /* constant addend */
} Elf64_Rela;


#define ELF32_R_SYM(I)		((I) >> 8)
#define ELF32_R_TYPE(I)		((unsigned char) (I))
#define ELF32_R_INFO(S,T)	(((S) << 8) + (unsigned char) (T))

#define ELF64_R_SYM(I)		((I) >> 32)
#define ELF64_R_TYPE(I)		((I) & 0xFFFFFFFFUL)
#define ELF64_R_INFO(S,T)	\
	(((Elf64_Xword) (S) << 32) + ((T) & 0xFFFFFFFFUL))

/*
 * Symbol versioning structures.
 */

/* 32-bit structures. */
typedef struct
{
	Elf32_Word	vda_name;    /* Index to name. */
	Elf32_Word	vda_next;    /* Offset to next entry. */
} Elf32_Verdaux;

typedef struct
{
	Elf32_Word	vna_hash;    /* Hash value of dependency name. */
	Elf32_Half	vna_flags;   /* Flags. */
	Elf32_Half	vna_other;   /* Unused. */
	Elf32_Word	vna_name;    /* Offset to dependency name. */
	Elf32_Word	vna_next;    /* Offset to next vernaux entry. */
} Elf32_Vernaux;

typedef struct
{
	Elf32_Half	vd_version;  /* Version information. */
	Elf32_Half	vd_flags;    /* Flags. */
	Elf32_Half	vd_ndx;	     /* Index into the versym section. */
	Elf32_Half	vd_cnt;	     /* Number of aux entries. */
	Elf32_Word	vd_hash;     /* Hash value of name. */
	Elf32_Word	vd_aux;	     /* Offset to aux entries. */
	Elf32_Word	vd_next;     /* Offset to next version definition. */
} Elf32_Verdef;

typedef struct
{
	Elf32_Half	vn_version;  /* Version number. */
	Elf32_Half	vn_cnt;	     /* Number of aux entries. */
	Elf32_Word	vn_file;     /* Offset of associated file name. */
	Elf32_Word	vn_aux;	     /* Offset of vernaux array. */
	Elf32_Word	vn_next;     /* Offset of next verneed entry. */
} Elf32_Verneed;

typedef Elf32_Half	Elf32_Versym;

/* 64-bit structures. */

typedef struct {
	Elf64_Word	vda_name;    /* Index to name. */
	Elf64_Word	vda_next;    /* Offset to next entry. */
} Elf64_Verdaux;

typedef struct {
	Elf64_Word	vna_hash;    /* Hash value of dependency name. */
	Elf64_Half	vna_flags;   /* Flags. */
	Elf64_Half	vna_other;   /* Unused. */
	Elf64_Word	vna_name;    /* Offset to dependency name. */
	Elf64_Word	vna_next;    /* Offset to next vernaux entry. */
} Elf64_Vernaux;

typedef struct {
	Elf64_Half	vd_version;  /* Version information. */
	Elf64_Half	vd_flags;    /* Flags. */
	Elf64_Half	vd_ndx;	     /* Index into the versym section. */
	Elf64_Half	vd_cnt;	     /* Number of aux entries. */
	Elf64_Word	vd_hash;     /* Hash value of name. */
	Elf64_Word	vd_aux;	     /* Offset to aux entries. */
	Elf64_Word	vd_next;     /* Offset to next version definition. */
} Elf64_Verdef;

typedef struct {
	Elf64_Half	vn_version;  /* Version number. */
	Elf64_Half	vn_cnt;	     /* Number of aux entries. */
	Elf64_Word	vn_file;     /* Offset of associated file name. */
	Elf64_Word	vn_aux;	     /* Offset of vernaux array. */
	Elf64_Word	vn_next;     /* Offset of next verneed entry. */
} Elf64_Verneed;

typedef Elf64_Half	Elf64_Versym;


/*
 * The header for GNU-style hash sections.
 */

typedef struct {
	uint32_t	gh_nbuckets;	/* Number of hash buckets. */
	uint32_t	gh_symndx;	/* First visible symbol in .dynsym. */
	uint32_t	gh_maskwords;	/* #maskwords used in bloom filter. */
	uint32_t	gh_shift2;	/* Bloom filter  count. */
} Elf_GNU_Hash_Header;

#endif	/* _SYS_ELFDEFINITIONS_H_ */