Commit 42cea7d
Merge #753
753: Add scripts to validate target info. r=Emilgardis a=Alexhuszagh
Attempts to recreate the table present in README.md, which
can extract the target information for a single target
or for all targets.
Should currently support the following targets:
- Android
- glibc
- musl
- MinGW
- FreeBSD
- NetBSD
- newlib
Closes #686.
This produces the following table:
| Target | libc | GCC | C++ | QEMU |
|:-:|:-:|:-:|:-:|:-:|
| `aarch64-linux-android` | 9.0.8 | 9.0.8 | ✓ | 5.1.0 |
| `aarch64-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `aarch64-unknown-linux-musl` | 1.2.0 | 9.2.0 | ✓ | 5.1.0 |
| `arm-linux-androideabi` | 9.0.8 | 9.0.8 | ✓ | 5.1.0 |
| `arm-unknown-linux-gnueabi` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `arm-unknown-linux-gnueabihf` | 2.17 | 8.3.0 | ✓ | 5.1.0 |
| `arm-unknown-linux-musleabi` | 1.2.0 | 9.2.0 | ✓ | 5.1.0 |
| `arm-unknown-linux-musleabihf` | 1.2.0 | 9.2.0 | ✓ | 5.1.0 |
| `armv5te-unknown-linux-gnueabi` | 2.27 | 7.5.0 | ✓ | 5.1.0 |
| `armv5te-unknown-linux-musleabi` | 1.2.0 | 9.2.0 | ✓ | 5.1.0 |
| `armv7-linux-androideabi` | 9.0.8 | 9.0.8 | ✓ | 5.1.0 |
| `armv7-unknown-linux-gnueabihf` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `armv7-unknown-linux-musleabihf` | 1.2.0 | 9.2.0 | ✓ | 5.1.0 |
| `i586-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | N/A |
| `i586-unknown-linux-musl` | 1.2.0 | 9.2.0 | ✓ | N/A |
| `i686-linux-android` | 9.0.8 | 9.0.8 | ✓ | 5.1.0 |
| `i686-pc-windows-gnu` | N/A | 7.5 | ✓ | N/A |
| `i686-unknown-freebsd` | 1.5 | 6.4.0 | ✓ | N/A |
| `i686-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `i686-unknown-linux-musl` | 1.2.0 | 9.2.0 | ✓ | N/A |
| `mips-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `mips-unknown-linux-musl` | 1.2.0 | 9.2.0 | ✓ | 5.1.0 |
| `mips64-unknown-linux-gnuabi64` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `mips64el-unknown-linux-gnuabi64` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `mipsel-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `mipsel-unknown-linux-musl` | 1.2.0 | 9.2.0 | ✓ | 5.1.0 |
| `powerpc-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `powerpc64-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `powerpc64le-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | N/A |
| `riscv64gc-unknown-linux-gnu` | 2.27 | 7.5.0 | ✓ | 5.1.0 |
| `s390x-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `sparc64-unknown-linux-gnu` | 2.23 | 5.4.0 | ✓ | 5.1.0 |
| `thumbv6m-none-eabi` | 2.2.0 | 4.9.3 | | N/A |
| `thumbv7em-none-eabi` | 2.2.0 | 4.9.3 | | N/A |
| `thumbv7em-none-eabihf` | 2.2.0 | 4.9.3 | | N/A |
| `thumbv7m-none-eabi` | 2.2.0 | 4.9.3 | | N/A |
| `x86_64-linux-android` | 9.0.8 | 9.0.8 | ✓ | 5.1.0 |
| `x86_64-pc-windows-gnu` | N/A | 7.3 | ✓ | N/A |
| `x86_64-unknown-freebsd` | 1.5 | 6.4.0 | ✓ | N/A |
| `x86_64-unknown-linux-gnu` | 2.17 | 4.8.5 | ✓ | 4.2.1 |
| `x86_64-unknown-linux-musl` | 1.2.0 | 9.2.0 | ✓ | N/A |
| `x86_64-unknown-netbsd` | 9.2.0 | 9.4.0 | ✓ | N/A |
There's a few mild differences here, but I think they're correct:
- FreeBSD uses the [symbol versioning](https://wiki.freebsd.org/SymbolVersioning) for libc.
- Android libc uses the LLVM version, and the compiler version isn't the native GCC toolchain either.
A few notes on how this works:
- C++ support is checked by there being a C++ executable, and it can compile a simple program (see below):
- Compiler version is detected by the output of GCC or Clang by a regular expression.
- Qemu version is detected by the presence of a Qemu binary and extracted via a regular expression.
- libc verson is quite intricate, but interesting:
- If Android, the libc version is just the compiler version (Clang == LLVM).
- If musl, we execute the binary and extract the version via a regular expression.
- If glibc, we use the versioned filenames to get the version (`libc-2.17.so`).
- If newlib, we use `dpkg` to get the package version which has the newlib version.
- For FreeBSD, we wrote the FreeBSD version to file, and then match that to the libc version.
- For NetBSD, we can read the version from the `libc.so` symbols, grepped for `NetBSD`.
- For Windows, intentional passthrough.
**C++ Program**
This may fail in the case we cannot compile a C program to begin with (AKA, newlib, which we have missing startfiles, etc.). This really doesn't matter right now, since none of these bare-metal targets support C++, although in the future we may want to add `-nostartfiles` during compilation.
```cpp
#include <iostream>
int main() {
std::cout << "Testing this" << std::endl;
}
```
Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>2 files changed
Lines changed: 392 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments