seL4_libs icon indicating copy to clipboard operation
seL4_libs copied to clipboard

sel4test: Handle retain attr issue in build args

Open kent-mcleod opened this issue 7 months ago • 3 comments

It seems that detecting support for the right keywords used to instruct the linker to retain symbols is pretty unstable. Alternative approach is to move conditional check into the build script and pick behavior based on the toolchains selected.

An approach to address https://github.com/seL4/seL4_libs/issues/97

kent-mcleod avatar May 22 '25 23:05 kent-mcleod

With GCC this gets rid of the errors for retain, I now run into https://github.com/seL4/sel4test/issues/137.

With LLVM (../init-build.sh -DPLATFORM=qemu-arm-virt -DTRIPLE=aarch64-none-elf) I get:

ld.lld: error: unable to find library -lgcc
ld.lld: warning: apps/sel4test-driver/musllibc/build-temp/stage/lib/libc.a: archive member '/' is neither ET_REL nor LLVM bitcode
ld.lld: warning: apps/sel4test-driver/musllibc/build-temp/stage/lib/libc.a: archive member '//' is neither ET_REL nor LLVM bitcode
clang++: error: ld.lld command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Ivan-Velickovic avatar May 23 '25 00:05 Ivan-Velickovic

Adding "-fno-lto" should fix Ivan's Clang warning. I think we should disable link time optimisation by default for both clan and gcc.

Edit: Created PR #103 that limits retain for Clang at compile time, keeping the existing has attribute check.

Indanz avatar May 23 '25 07:05 Indanz

With GCC this gets rid of the errors for retain, I now run into seL4/sel4test#137.

With LLVM (../init-build.sh -DPLATFORM=qemu-arm-virt -DTRIPLE=aarch64-none-elf) I get:

ld.lld: error: unable to find library -lgcc

If you're using LLVM/Clang to build, and unlike GCC/ld.bfd, you'll need to manually tell your linker (ld.lld) where to find -lgcc (or ideally compiler_rt). You can do this by passing the GCC's libgcc.a directory e.g., -DCMAKE_EXE_LINKER_FLAGS="-Wl,-L$GCC_LIB_PATH when you're configuring sel4test

heshamelmatary avatar May 29 '25 10:05 heshamelmatary