Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
telans opened this issue Jan 20, 2022 · 4 comments · Fixed by #218
Closed

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

telans opened this issue Jan 20, 2022 · 4 comments · Fixed by #218

Comments

@telans
Copy link

telans commented Jan 20, 2022

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

@telans
Copy link
Author

telans commented Feb 15, 2022

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?

@telans
Copy link
Author

telans commented Feb 15, 2022

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

@telans telans closed this as completed Feb 15, 2022
@tmaakis
Copy link

tmaakis commented Mar 26, 2022

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

@thrifty-txt
Copy link
Contributor

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

thrifty-txt added a commit to thrifty-txt/efivar that referenced this issue May 31, 2022
Resolves rhboot#204
Signed-off-by: Ali Abdel-Qader <abdelqaderali@protonmail.com>
@telans telans reopened this May 31, 2022
SergiiDmytruk pushed a commit to 3mdeb/efivar that referenced this issue Sep 21, 2022
Resolves rhboot#204
Signed-off-by: Ali Abdel-Qader <abdelqaderali@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants