]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/architecture.h
4 This file is part of systemd.
6 Copyright 2014 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
27 /* A cleaned up architecture definition. We don't want to get lost in
28 * processor features, models, generations or even ABIs. Hence we
29 * focus on general family, and distinguish word width and
38 ARCHITECTURE_PPC64_LE
,
41 ARCHITECTURE_PARISC64
,
49 ARCHITECTURE_MIPS64_LE
,
54 ARCHITECTURE_ARM64_BE
,
61 _ARCHITECTURE_INVALID
= -1
64 int uname_architecture(void);
67 * LIB_ARCH_TUPLE should resolve to the local library path
68 * architecture tuple systemd is built for, according to the Debian
71 * https://wiki.debian.org/Multiarch/Tuples
73 * This is used in library search paths that should understand
74 * Debian's paths on all distributions.
77 #if defined(__x86_64__)
78 # define native_architecture() ARCHITECTURE_X86_64
79 # define LIB_ARCH_TUPLE "x86_64-linux-gnu"
80 # define SECONDARY_ARCHITECTURE ARCHITECTURE_X86
81 #elif defined(__i386__)
82 # define native_architecture() ARCHITECTURE_X86
83 # define LIB_ARCH_TUPLE "i386-linux-gnu"
84 #elif defined(__powerpc64__)
85 # if __BYTE_ORDER == __BIG_ENDIAN
86 # define native_architecture() ARCHITECTURE_PPC64
87 # define LIB_ARCH_TUPLE "ppc64-linux-gnu"
88 # define SECONDARY_ARCHITECTURE ARCHITECTURE_PPC
90 # define native_architecture() ARCHITECTURE_PPC64_LE
91 # define LIB_ARCH_TUPLE "powerpc64le-linux-gnu"
92 # define SECONDARY_ARCHITECTURE ARCHITECTURE_PPC_LE
94 #elif defined(__powerpc__)
95 # if __BYTE_ORDER == __BIG_ENDIAN
96 # define native_architecture() ARCHITECTURE_PPC
97 # define LIB_ARCH_TUPLE "powerpc-linux-gnu"
99 # define native_architecture() ARCHITECTURE_PPC_LE
100 # error "Missing LIB_ARCH_TUPLE for PPCLE"
102 #elif defined(__ia64__)
103 # define native_architecture() ARCHITECTURE_IA64
104 # define LIB_ARCH_TUPLE "ia64-linux-gnu"
105 #elif defined(__hppa64__)
106 # define native_architecture() ARCHITECTURE_PARISC64
107 # error "Missing LIB_ARCH_TUPLE for HPPA64"
108 #elif defined(__hppa__)
109 # define native_architecture() ARCHITECTURE_PARISC
110 # define LIB_ARCH_TUPLE "hppa‑linux‑gnu"
111 #elif defined(__s390x__)
112 # define native_architecture() ARCHITECTURE_S390X
113 # define LIB_ARCH_TUPLE "s390x-linux-gnu"
114 # define SECONDARY_ARCHITECTURE ARCHITECTURE_S390
115 #elif defined(__s390__)
116 # define native_architecture() ARCHITECTURE_S390
117 # define LIB_ARCH_TUPLE "s390-linux-gnu"
118 #elif defined(__sparc64__)
119 # define native_architecture() ARCHITECTURE_SPARC64
120 # define LIB_ARCH_TUPLE "sparc64-linux-gnu"
121 #elif defined(__sparc__)
122 # define native_architecture() ARCHITECTURE_SPARC
123 # define LIB_ARCH_TUPLE "sparc-linux-gnu"
124 #elif defined(__mips64__)
125 # if __BYTE_ORDER == __BIG_ENDIAN
126 # define native_architecture() ARCHITECTURE_MIPS64
127 # error "Missing LIB_ARCH_TUPLE for MIPS64"
129 # define native_architecture() ARCHITECTURE_MIPS64_LE
130 # error "Missing LIB_ARCH_TUPLE for MIPS64_LE"
132 #elif defined(__mips__)
133 # if __BYTE_ORDER == __BIG_ENDIAN
134 # define native_architecture() ARCHITECTURE_MIPS
135 # define LIB_ARCH_TUPLE "mips-linux-gnu"
137 # define native_architecture() ARCHITECTURE_MIPS_LE
138 # define LIB_ARCH_TUPLE "mipsel-linux-gnu"
140 #elif defined(__alpha__)
141 # define native_architecture() ARCHITECTURE_ALPHA
142 # define LIB_ARCH_TUPLE "alpha-linux-gnu"
143 #elif defined(__aarch64__)
144 # if __BYTE_ORDER == __BIG_ENDIAN
145 # define native_architecture() ARCHITECTURE_ARM64_BE
146 # define LIB_ARCH_TUPLE "aarch64_be-linux-gnu"
148 # define native_architecture() ARCHITECTURE_ARM64
149 # define LIB_ARCH_TUPLE "aarch64-linux-gnu"
151 #elif defined(__arm__)
152 # if __BYTE_ORDER == __BIG_ENDIAN
153 # define native_architecture() ARCHITECTURE_ARM_BE
154 # if defined(__ARM_EABI__)
155 # if defined(__ARM_PCS_VFP)
156 # define LIB_ARCH_TUPLE "armeb-linux-gnueabihf"
158 # define LIB_ARCH_TUPLE "armeb-linux-gnueabi"
161 # define LIB_ARCH_TUPLE "armeb-linux-gnu"
164 # define native_architecture() ARCHITECTURE_ARM
165 # if defined(__ARM_EABI__)
166 # if defined(__ARM_PCS_VFP)
167 # define LIB_ARCH_TUPLE "arm-linux-gnueabihf"
169 # define LIB_ARCH_TUPLE "arm-linux-gnueabi"
172 # define LIB_ARCH_TUPLE "arm-linux-gnu"
175 #elif defined(__sh64__)
176 # define native_architecture() ARCHITECTURE_SH64
177 # error "Missing LIB_ARCH_TUPLE for SH64"
178 #elif defined(__sh__)
179 # define native_architecture() ARCHITECTURE_SH
180 # define LIB_ARCH_TUPLE "sh4-linux-gnu"
181 #elif defined(__m68k__)
182 # define native_architecture() ARCHITECTURE_M68K
183 # define LIB_ARCH_TUPLE "m68k-linux-gnu"
184 #elif defined(__tilegx__)
185 # define native_architecture() ARCHITECTURE_TILEGX
186 # error "Missing LIB_ARCH_TUPLE for TILEGX"
187 #elif defined(__cris__)
188 # define native_architecture() ARCHITECTURE_CRIS
189 # error "Missing LIB_ARCH_TUPLE for CRIS"
191 # error "Please register your architecture here!"
194 const char *architecture_to_string(int a
) _const_
;
195 int architecture_from_string(const char *s
) _pure_
;