Bug 2070813 - Cannot compile with lld-14 and -fuse-ld=lld due to --no-add-needed flag
Summary: Cannot compile with lld-14 and -fuse-ld=lld due to --no-add-needed flag
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-04-01 04:03 UTC by Tom Stellard
Modified: 2023-05-25 16:52 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-05-25 16:52:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tom Stellard 2022-04-01 04:03:54 UTC
lld-14 stopped accepting the --no-add-needed-flag, and gcc in Fedora passes this flag to the linker by default.  I've patched lld-14 in Fedora to accept this flag for now, but can we update gcc to stop using this flag?

Comment 1 Jakub Jelinek 2022-04-01 08:06:02 UTC
Then just revert it in upstream lld too, it is a very bad idea to ever remove from linker options the compiler driver uses.
GCC probes at configure time for linker features and assumes the actually used linker at runtime will be backwards compatible
with what has been detected (or hardcoded).
GCC allows changing the actuallyy used linker primary through -B path/ option and doesn't really know what the linker is,
-fuse-ld= is just another way how to pick up the linker, no behavior is right now dependent on it except for which suffix
to ld is used and not everything actually could be done based on it (e.g. because it is never passed to the compiler).
So, linker (and assembler too) needs to take backwards compatibility seriously.

Comment 2 Tom Stellard 2022-04-01 15:35:16 UTC
@jakub Upstream lld did not want to revert the change, because they said upstream gcc doesn't use the flag.

Comment 3 Jakub Jelinek 2022-04-01 15:39:56 UTC
If upstream lld has that approach to backwards compatibility, then probably -fuse-ld=lld can't be supported.

Comment 4 Fangrui Song 2022-04-02 00:28:31 UTC
In binutils-gdb commit ddbb8a31d5f6d13c91a416e13f6ad11ac6604102 (2009-11), --[no-]copy-dt-needed-entries was added to replace --[no-]add-needed.
The latter remains as a deprecated alias.
In https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=08efffb82dbcbb34f9704f63cd1c51a252e2f710 (2011-08), --no-copy-dt-needed-entries (--no-add-needed) became the default.
Removing --no-add-needed seems a good idea for at least the following reasons, not even considering the help it will make to ld.lld:

* drop a local patch
* --no-add-needed is a deprecated alias, albeit without a diagnostic.

(Debian patched their gcc to pass --no-add-needed to ld in 2010, and dropped the local patch in 2012 after they noticed GNU ld's changed default.)

Comment 5 Florian Weimer 2022-04-04 08:26:39 UTC
Shouldn't we just drop gcc12-no-add-needed.patch, given that it that repeats the ld default? The --copy-dt-needed-entries behavior is just wrong, and I hope no linker still does this by default these days. ld.bfd is fine, as noted by Fangrui, and ld.gold does not even implement --copy-dt-needed-entries (according to its --help output).

Comment 6 Ben Cotton 2023-04-25 16:58:01 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 7 Ludek Smid 2023-05-25 16:52:07 UTC
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16.

Fedora Linux 36 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.