rhboot/efivar

efivar-38: ld.lld: error: unknown argument '--add-needed'

telans opened this issue · 4 comments

The new release fails to build with ld.lld due to --add-needed. This option has been deprecated from GNU ld in favour of --copy-dt-needed-entries (ld (1)), but that still isn't supported by lld.

Build log:

make -j16
make[1]: Entering directory '/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src'
clang -march=znver2 -O3 -glldb -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -pipe -rtlib=compiler-rt -unwindlib=libunwind -Qunused-arguments -Wno-gnu-static-float-init -std=gnu11 -funsigned-char -fvisibility=hidden   -std=gnu11 -funsigned-char -fvisibility=hidden    -fPIC  -DLIBEFIVAR_VERSION=38 -D_GNU_SOURCE -I/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/ -DEFIVAR_BUILD_ENVIRONMENT -c -o makeguids.o makeguids.c
clang -march=znver2 -O3 -glldb -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -pipe -rtlib=compiler-rt -unwindlib=libunwind -Qunused-arguments -Wno-gnu-static-float-init -std=gnu11 -funsigned-char -fvisibility=hidden   -std=gnu11 -funsigned-char -fvisibility=hidden    -fPIC  -DLIBEFIVAR_VERSION=38 -D_GNU_SOURCE -I/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/ -DEFIVAR_BUILD_ENVIRONMENT -c -o util.o util.c
clang -march=znver2 -O3 -glldb -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -pipe -rtlib=compiler-rt -unwindlib=libunwind -Qunused-arguments -Wno-gnu-static-float-init -std=gnu11 -funsigned-char -fvisibility=hidden   -std=gnu11 -funsigned-char -fvisibility=hidden    -L.   -Wl,--add-needed -Wl,--build-id -Wl,--no-allow-shlib-undefined -Wl,-z,now -Wl,-z,muldefs -Wl,--fatal-warnings,-z,relro -rtlib=compiler-rt    -DLIBEFIVAR_VERSION=38 -D_GNU_SOURCE -I/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/ -DEFIVAR_BUILD_ENVIRONMENT -o makeguids makeguids.o util.o -ldl
ld.lld: error: unknown argument '--add-needed'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/rules.mk:32: makeguids] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src'
make: *** [Makefile:14: prep] Error 2

Downstream report: https://bugs.gentoo.org/831472

Do you mind elaborating as to why --add-needed is required? It seems like a rarely used option that might work well as a drop-in for --as-needed?

I can't reproduce this with clang-14, closing.

Well it does do that for me on clang 14.

make[1]: Entering directory '/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src'
clang -O2 -pipe -march=znver1 -std=gnu11 -funsigned-char -fvisibility=hidden   -std=gnu11 -funsigned-char -fvisibility=hidden    -fPIC  -DLIBEFIVAR_VERSION=38 -D_GNU_SOURCE -I/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/ -DEFIVAR_BUILD_ENVIRONMENT -c -o makeguids.o makeguids.c
clang -O2 -pipe -march=znver1 -std=gnu11 -funsigned-char -fvisibility=hidden   -std=gnu11 -funsigned-char -fvisibility=hidden    -fPIC  -DLIBEFIVAR_VERSION=38 -D_GNU_SOURCE -I/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/ -DEFIVAR_BUILD_ENVIRONMENT -c -o util.o util.c
clang -O2 -pipe -march=znver1 -std=gnu11 -funsigned-char -fvisibility=hidden   -std=gnu11 -funsigned-char -fvisibility=hidden    -L.   -Wl,--add-needed -Wl,--build-id -Wl,--no-allow-shlib-undefined -Wl,-z,now -Wl,-z,muldefs -Wl,--fatal-warnings,-z,relro -rtlib=compiler-rt    -DLIBEFIVAR_VERSION=38 -D_GNU_SOURCE -I/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/ -DEFIVAR_BUILD_ENVIRONMENT -o makeguids makeguids.o util.o -ldl
ld.lld: ^[[0;31merror: ^[[0munknown argument '--add-needed'
clang-14: ^[[0;1;31merror: ^[[0m^[[1mlinker command failed with exit code 1 (use -v to see invocation)^[[0m
make[1]: *** [/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/rules.mk:32: makeguids] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src'
make: *** [Makefile:14: prep] Error 2

This issue persists with clang and LLD 14. Should be re-opened.