Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 831472 - sys-libs/efivar-38 - ld.lld: error: unknown argument '--add-needed'
Summary: sys-libs/efivar-38 - ld.lld: error: unknown argument '--add-needed'
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords: PATCH
: 867124 867850 888847 893622 (view as bug list)
Depends on:
Blocks: systemwide-clang
  Show dependency tree
 
Reported: 2022-01-19 12:10 UTC by Michael Egger
Modified: 2023-02-12 19:15 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_831472.txt,3.00 KB, text/plain)
2022-02-15 15:02 UTC, Michael Egger
Details
emerge --info (file_831472.txt,7.45 KB, text/plain)
2022-02-15 15:04 UTC, Michael Egger
Details
add-needed.patch (add-needed.patch,1.69 KB, patch)
2023-01-17 14:22 UTC, nvinson234
Details | Diff
clang.patch (clang.patch,8.63 KB, patch)
2023-01-17 14:22 UTC, nvinson234
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Egger 2022-01-19 12:10:30 UTC
sys-libs/efivar-38 fails to link with sys-devel/lld-13.0.0::gentoo.

Relevant lines from build log:

make[1]: Entering directory '/tmp/portage/sys-libs/efivar-38/work/efivar-38/src'
clang -march=native -O3 -pipe -std=gnu11 -funsigned-char -fvisibility=hidden   -std=gnu11 -funsigned-char -fvisibility=hidden    -fPIC  -DLIBEFIVAR_VERSION=38 -D_GNU_SOURCE -I/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/ -DEFIVAR_BUILD_ENVIRONMENT -c -o makeguids.o makeguids.c
clang -march=native -O3 -pipe -std=gnu11 -funsigned-char -fvisibility=hidden   -std=gnu11 -funsigned-char -fvisibility=hidden    -fPIC  -DLIBEFIVAR_VERSION=38 -D_GNU_SOURCE -I/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/ -DEFIVAR_BUILD_ENVIRONMENT -c -o util.o util.c
clang -march=native -O3 -pipe -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/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]: *** [/tmp/portage/sys-libs/efivar-38/work/efivar-38/src/include/rules.mk:32: makeguids] Error 1
make[1]: Leaving directory '/tmp/portage/sys-libs/efivar-38/work/efivar-38/src'


Reproducible: Always
Comment 1 James Beddek 2022-02-15 12:39:22 UTC
I can't reproduce this with clang-14, despite still using lld-13. Not sure why. Michael would you be able to test? Thanks.
Comment 2 Michael Egger 2022-02-15 15:02:42 UTC
Created attachment 765197 [details]
build.log

build log
Comment 3 Michael Egger 2022-02-15 15:04:30 UTC
Created attachment 765198 [details]
emerge --info

This is still an issue on my machine, attached build.log and emerge --info
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-02-15 15:19:25 UTC
Did Clang 14 add something here then?
Comment 5 Mike Gilbert gentoo-dev 2022-02-15 16:08:19 UTC
Please work with upstream on this.
Comment 6 jon R-B 2022-07-17 17:14:27 UTC
There are two PR upstream to resolve this

https://github.com/rhboot/efivar/pull/218
This removes the --add-needed option but produces another issue

https://github.com/rhboot/efivar/pull/222
fixes the "unable to insert .data after .data" but isn't complete
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-28 16:37:33 UTC
*** Bug 867124 has been marked as a duplicate of this bug. ***
Comment 8 Stephan Hartmann (RETIRED) gentoo-dev 2022-09-02 10:56:07 UTC
*** Bug 867850 has been marked as a duplicate of this bug. ***
Comment 9 ethancaston 2022-12-01 23:10:23 UTC
issue recreated while doing a new install with clang,it currently is impossible to use this profile to install gentoo on an EFI system until a fix is pushed

(chdoot) mint /usr/src/linux # emerge -v sys-libs/efivar

 * IMPORTANT: 9 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] sys-libs/efivar-38:0/1::gentoo  USE="-test" 0 KiB

Total: 1 package (1 new), Size of downloads: 0 KiB


>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-libs/efivar-38::gentoo
 * efivar-38.tar.bz2 BLAKE2B SHA512 size ;-) ...                                                                                                       [ ok ]
>>> Unpacking source...
>>> Unpacking efivar-38.tar.bz2 to /var/tmp/portage/sys-libs/efivar-38/work
>>> Source unpacked in /var/tmp/portage/sys-libs/efivar-38/work
>>> Preparing source in /var/tmp/portage/sys-libs/efivar-38/work/efivar-38 ...
 * Applying efivar-38-ia64-relro.patch ...                                                                                                             [ ok ]
 * Applying efivar-38-march-native.patch ...                                                                                                           [ ok ]
 * Applying efivar-38-Makefile-dep.patch ...                                                                                                           [ ok ]
 * Applying efivar-38-binutils-2.36.patch ...                                                                                                          [ ok ]
 * Applying efivar-38-ld-locale.patch ...                                                                                                              [ ok ]
 * Applying efivar-38-glibc-2.36.patch ...                                                                                                             [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-libs/efivar-38/work/efivar-38 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-libs/efivar-38/work/efivar-38 ...
make -j16 
make[1]: Entering directory '/var/tmp/portage/sys-libs/efivar-38/work/efivar-38/src'
clang -march=native -O2 -pipe -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=native -O2 -pipe -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=native -O2 -pipe -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-15: 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
 * ERROR: sys-libs/efivar-38::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-libs/efivar-38::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-libs/efivar-38::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-libs/efivar-38/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-libs/efivar-38/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-libs/efivar-38/work/efivar-38'
 * S: '/var/tmp/portage/sys-libs/efivar-38/work/efivar-38'

>>> Failed to emerge sys-libs/efivar-38, Log file:

>>>  '/var/tmp/portage/sys-libs/efivar-38/temp/build.log'

 * Messages for package sys-libs/efivar-38:

 * ERROR: sys-libs/efivar-38::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-libs/efivar-38::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-libs/efivar-38::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-libs/efivar-38/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-libs/efivar-38/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-libs/efivar-38/work/efivar-38'
 * S: '/var/tmp/portage/sys-libs/efivar-38/work/efivar-38'
Comment 10 Stephan Hartmann (RETIRED) gentoo-dev 2022-12-29 10:02:52 UTC
*** Bug 888847 has been marked as a duplicate of this bug. ***
Comment 11 nvinson234 2023-01-17 14:22:18 UTC
Created attachment 848743 [details, diff]
add-needed.patch

1 of 2 patches needed to build efivar-38 with clang.
Comment 12 nvinson234 2023-01-17 14:22:41 UTC
Created attachment 848745 [details, diff]
clang.patch

2 of 2 patches needed to build efivar-38 with clang.
Comment 13 Stephan Hartmann (RETIRED) gentoo-dev 2023-02-08 17:32:55 UTC
*** Bug 893622 has been marked as a duplicate of this bug. ***
Comment 14 Mike Gilbert gentoo-dev 2023-02-08 18:06:28 UTC
Please link to the upstream commits instead of attaching them as patches.
Comment 15 Stephan Hartmann (RETIRED) gentoo-dev 2023-02-11 19:29:14 UTC
(In reply to Mike Gilbert from comment #14)
> Please link to the upstream commits instead of attaching them as patches.

https://github.com/rhboot/efivar/commit/b23aba1469de8bb7a115751f9cd294ad3aaa6680
https://github.com/rhboot/efivar/commit/cfd686de51494d3e34be896a91835657ccab37d4

Maybe also:
https://github.com/rhboot/efivar/commit/1f247260c9b4bd6fcda30f3e4cc358852aeb9e4d
Comment 16 Larry the Git Cow gentoo-dev 2023-02-12 18:47:14 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a929b75061d1ee6190ac9df0bfaafde6a4a19618

commit a929b75061d1ee6190ac9df0bfaafde6a4a19618
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-02-12 18:45:22 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-02-12 18:47:10 +0000

    sys-libs/efivar: backport lld fixes
    
    Closes: https://bugs.gentoo.org/831472
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-libs/efivar/efivar-38.ebuild                 |   7 +-
 sys-libs/efivar/files/efivar-38-ia64-relro.patch |   4 +-
 sys-libs/efivar/files/efivar-38-lld-fixes.patch  | 345 +++++++++++++++++++++++
 3 files changed, 352 insertions(+), 4 deletions(-)
Comment 17 Mike Gilbert gentoo-dev 2023-02-12 19:10:36 UTC
(In reply to nvinson234 from comment #11)

Thanks for rebasing the patches on top of Gentoo's existing patchset. In the future, it would be helpful if you mentioned doing so.

I decided it was better to adjust the Gentoo-specific efivar-38-ia64-relro.patch to apply on top of the other patches which have all been accepted upstream.