sel4test: Handle retain attr issue in build args
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
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.
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.
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