Repository navigation
Commit e30baa6
committed
Keep the artifact loadable on musl when built with a current toolchain
Motivation:
Built on a current distro (Debian 13 here) instead of the CentOS release
images, the artifact imports glibc-only symbols. It still loads on Alpine
under the JVM, which binds lazily, but `ldd`, LD_BIND_NOW and
docker/musl-verify fail. Building with an empty musl_compat.c and asking
Alpine's loader what is missing gives six symbols:
- __isoc23_strtol (APR), __isoc23_strtoul (static libstdc++),
__isoc23_strtoull (BoringSSL): glibc 2.38 redirects strtol and friends
there under _GNU_SOURCE, and no -D switches it off.
- __libc_single_threaded: static libstdc++, glibc 2.32+.
- _dl_find_object: libgcc_eh.a from gcc 12, glibc 2.35+.
- arc4random: libstdc++'s std::random_device, glibc 2.36+, dragged in by the
FIPS profile's newer BoringSSL. Nothing calls it.
Modifications:
- FIPS link line: -Wl,--gc-sections. The linker drops the unreachable
random_device code and the arc4random import with it; the library gets
117 KB smaller and the FIPS integrity check still passes.
- Weak fallbacks in musl_compat.c for the other five, which sit in live code.
The strto* ones reach the plain symbols through asm labels, since a literal
strtol() there would be redirected too and recurse on musl. `__restrict`,
not `restrict`: Debian 7's GCC 4.9 is gnu90.
- scripts/check_musl_compat.sh asserts the fallbacks are defined, and knows
the __isoc99_* scanf names musl does export.
Result:
Artifacts built on Debian 13 resolve completely on Alpine. No-op on the CentOS
release images, whose glibc predates all of these.1 parent 10883d9 commit e30baa6
4 files changed
Lines changed: 64 additions & 2 deletions
File tree
- boringssl-static
- docs
- openssl-dynamic/src/main/c
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
447 | 450 | | |
448 | 451 | | |
449 | 452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
438 | 441 | | |
439 | 442 | | |
440 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
441 | 447 | | |
442 | 448 | | |
443 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 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 | + | |
150 | 201 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | | - | |
| 106 | + | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
| |||
0 commit comments