Commit 8d5eac2
Jesus Checa Hidalgo
tests: Fix cdylib-export-c-library-symbols to work with LTO-enabled CFLAGS
The test fails on systems where default CFLAGS include LTO flags
(e.g., `-flto=auto -ffat-lto-objects`), which is common in RHEL,
Fedora, and CentOS distributions.
The issue occurs because `build_native_static_lib()` recompiles the
C source using system CFLAGS, which may include LTO. When rustc tries
to process this static library with the `+export-symbols` modifier,
it correctly rejects it as LTO objects in C static libraries are not
supported.
Fix by manually compiling the C code with `-fno-lto` to override
system defaults, then using llvm-ar directly to create the static
library. This ensures the test validates the `+export-symbols`
feature rather than LTO compatibility.1 parent f53b654 commit 8d5eac2
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
0 commit comments