xref: /openbmc/openbmc/poky/meta/lib/oe/elf.py (revision 864cc43b)
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: GPL-2.0-only
5#
6
7def machine_dict(d):
8#           TARGET_OS  TARGET_ARCH   MACHINE, OSABI, ABIVERSION, Little Endian, 32bit?
9    machdata = {
10            "darwin9" : {
11                        "arm" :       (40,     0,    0,          True,          32),
12                      },
13            "eabi" : {
14                        "arm" :       (40,     0,    0,          True,          32),
15                      },
16            "elf" : {
17                        "aarch64" :   (183,    0,    0,          True,          64),
18                        "aarch64_be" :(183,    0,    0,          False,         64),
19                        "i586" :      (3,      0,    0,          True,          32),
20                        "i686" :      (3,      0,    0,          True,          32),
21                        "x86_64":     (62,     0,    0,          True,          64),
22                        "epiphany":   (4643,   0,    0,          True,          32),
23                        "lm32":       (138,    0,    0,          False,         32),
24                        "loongarch64":(258,    0,    0,          True,          64),
25                        "mips":       ( 8,     0,    0,          False,         32),
26                        "mipsel":     ( 8,     0,    0,          True,          32),
27                        "microblaze":  (189,   0,    0,          False,         32),
28                        "microblazeel":(189,   0,    0,          True,          32),
29                        "powerpc":    (20,     0,    0,          False,         32),
30                        "riscv32":    (243,    0,    0,          True,          32),
31                        "riscv64":    (243,    0,    0,          True,          64),
32                      },
33            "linux" : {
34                        "aarch64" :   (183,    0,    0,          True,          64),
35                        "aarch64_be" :(183,    0,    0,          False,         64),
36                        "arm" :       (40,    97,    0,          True,          32),
37                        "armeb":      (40,    97,    0,          False,         32),
38                        "powerpc":    (20,     0,    0,          False,         32),
39                        "powerpc64":  (21,     0,    0,          False,         64),
40                        "powerpc64le":  (21,     0,    0,          True,         64),
41                        "i386":       ( 3,     0,    0,          True,          32),
42                        "i486":       ( 3,     0,    0,          True,          32),
43                        "i586":       ( 3,     0,    0,          True,          32),
44                        "i686":       ( 3,     0,    0,          True,          32),
45                        "x86_64":     (62,     0,    0,          True,          64),
46                        "ia64":       (50,     0,    0,          True,          64),
47                        "alpha":      (36902,  0,    0,          True,          64),
48                        "hppa":       (15,     3,    0,          False,         32),
49                        "loongarch64":(258,    0,    0,          True,          64),
50                        "m68k":       ( 4,     0,    0,          False,         32),
51                        "mips":       ( 8,     0,    0,          False,         32),
52                        "mipsel":     ( 8,     0,    0,          True,          32),
53                        "mips64":     ( 8,     0,    0,          False,         64),
54                        "mips64el":   ( 8,     0,    0,          True,          64),
55                        "mipsisa32r6":   ( 8,  0,    0,          False,         32),
56                        "mipsisa32r6el": ( 8,  0,    0,          True,          32),
57                        "mipsisa64r6":   ( 8,  0,    0,          False,         64),
58                        "mipsisa64r6el": ( 8,  0,    0,          True,          64),
59                        "nios2":      (113,    0,    0,          True,          32),
60                        "riscv32":    (243,    0,    0,          True,          32),
61                        "riscv64":    (243,    0,    0,          True,          64),
62                        "s390":       (22,     0,    0,          False,         32),
63                        "sh4":        (42,     0,    0,          True,          32),
64                        "sparc":      ( 2,     0,    0,          False,         32),
65                        "microblaze":  (189,   0,    0,          False,         32),
66                        "microblazeel":(189,   0,    0,          True,          32),
67                      },
68            "linux-android" : {
69                        "aarch64" :   (183,    0,    0,          True,          64),
70                        "i686":       ( 3,     0,    0,          True,          32),
71                        "x86_64":     (62,     0,    0,          True,          64),
72                      },
73            "linux-androideabi" : {
74                        "arm" :       (40,    97,    0,          True,          32),
75                      },
76            "linux-musl" : {
77                        "aarch64" :   (183,    0,    0,            True,          64),
78                        "aarch64_be" :(183,    0,    0,            False,         64),
79                        "arm" :       (  40,    97,    0,          True,          32),
80                        "armeb":      (  40,    97,    0,          False,         32),
81                        "powerpc":    (  20,     0,    0,          False,         32),
82                        "powerpc64":  (  21,     0,    0,          False,         64),
83                        "powerpc64le":  (21,     0,    0,          True,         64),
84                        "i386":       (   3,     0,    0,          True,          32),
85                        "i486":       (   3,     0,    0,          True,          32),
86                        "i586":       (   3,     0,    0,          True,          32),
87                        "i686":       (   3,     0,    0,          True,          32),
88                        "x86_64":     (  62,     0,    0,          True,          64),
89                        "mips":       (   8,     0,    0,          False,         32),
90                        "mipsel":     (   8,     0,    0,          True,          32),
91                        "mips64":     (   8,     0,    0,          False,         64),
92                        "mips64el":   (   8,     0,    0,          True,          64),
93                        "microblaze":  (189,     0,    0,          False,         32),
94                        "microblazeel":(189,     0,    0,          True,          32),
95                        "riscv32":    (243,      0,    0,          True,          32),
96                        "riscv64":    (243,      0,    0,          True,          64),
97                        "sh4":        (  42,     0,    0,          True,          32),
98                      },
99            "uclinux-uclibc" : {
100                        "bfin":       ( 106,     0,    0,          True,         32),
101                      },
102            "linux-gnueabi" : {
103                        "arm" :       (40,     0,    0,          True,          32),
104                        "armeb" :     (40,     0,    0,          False,         32),
105                      },
106            "linux-musleabi" : {
107                        "arm" :       (40,     0,    0,          True,          32),
108                        "armeb" :     (40,     0,    0,          False,         32),
109                      },
110            "linux-gnuspe" : {
111                        "powerpc":    (20,     0,    0,          False,         32),
112                      },
113            "linux-muslspe" : {
114                        "powerpc":    (20,     0,    0,          False,         32),
115                      },
116            "linux-gnu" :       {
117                        "powerpc":    (20,     0,    0,          False,         32),
118                        "sh4":        (42,     0,    0,          True,          32),
119                      },
120            "linux-gnu_ilp32" :     {
121                        "aarch64" :   (183,    0,    0,          True,          32),
122                      },
123            "linux-gnux32" :       {
124                        "x86_64":     (62,     0,    0,          True,          32),
125                      },
126            "linux-muslx32" :       {
127                        "x86_64":     (62,     0,    0,          True,          32),
128                      },
129            "linux-gnun32" :       {
130                        "mips64":       ( 8,     0,    0,          False,         32),
131                        "mips64el":     ( 8,     0,    0,          True,          32),
132                        "mipsisa64r6":  ( 8,     0,    0,          False,         32),
133                        "mipsisa64r6el":( 8,     0,    0,          True,          32),
134                      },
135        }
136
137    # Add in any extra user supplied data which may come from a BSP layer, removing the
138    # need to always change this class directly
139    extra_machdata = (d and d.getVar("PACKAGEQA_EXTRA_MACHDEFFUNCS" or None) or "").split()
140    for m in extra_machdata:
141        call = m + "(machdata, d)"
142        locs = { "machdata" : machdata, "d" : d}
143        machdata = bb.utils.better_eval(call, locs)
144
145    return machdata
146