Invalid libefivar.so generated when building with clang-15.
Closed this issue · 1 comments
nvinson commented
description
When building with clang-15, the generated libefivar.so library is broken. The broken library causes applications to link to it to segfault on start.
steps to reproduce
- run
CFLAGS="-march=native -O2 -pipe -ggdb" CXXFLAGS="-march=native -O2 -pipe -ggdb" CC=clang LD=ld.lld LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind" make
- write test.c
- run
clang -Wl,-rpath,$PWD/src -Lsrc/ test.c -o test -lefivar
- run test
Expected results
the test binary returns the libefivar version number.
Actual results
the test binary segfaults.
Additional notes
test.c:
#include<stdio.h>
#include<efivar/efivar.h>
int main()
{
printf("%d\n", efi_get_libefivar_version());
return 0;
}
clang -v
clang version 15.0.2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/15/bin
Configuration file: /etc/clang/clang.cfg
System configuration file directory: /etc/clang
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
ld.lld -v
LLD 15.0.2 (compatible with GNU linkers)
tpgxyz commented
Hi, just to confirm that with this PR i'm able to compile efivar with LLVM/clang-15.0.3.
One thing i did not verified is does efivar without that PR is the culprit of segfault of sytemd-boot on my aarch64.
Will drop a line here after upate to systemd-252 with efivar+PR234