Bug 2415065 - Update 2.45.50-8 breaks lld
Summary: Update 2.45.50-8 breaks lld
Keywords:
Status: MODIFIED
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2415824
TreeView+ depends on / blocked
 
Reported: 2025-11-14 18:35 UTC by Tom.Rix
Modified: 2025-11-26 11:42 UTC (History)
16 users (show)

Fixed In Version: binutils-2.45.50-9.fc44
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tom.Rix 2025-11-14 18:35:44 UTC
This update has this upstream problem
https://sourceware.org/bugzilla/show_bug.cgi?id=33577

Causing this error for using gtest linked using rocm's lld in the hiprand project
https://download.copr.fedorainfracloud.org/results/music/gtest-control/fedora-rawhide-x86_64/09794040-hiprand/builder-live.log.gz

The error happens here in lld
https://github.com/llvm/llvm-project/blob/main/lld/ELF/InputFiles.cpp#L1701

because the .gnu.version section changed from (using readelf -L) 
old:

Version symbols section '.gnu.version' contains 11 entries:
 Addr: 0x00000000000012e6  Offset: 0x000012e6  Link: 8 (.dynsym)
  000:   0 (*local*)       2 (GLIBC_2.3.4)   1 (*global*)      3 (GLIBC_2.2.5)
  004:   1 (*global*)      4 (GLIBCXX_3.4.32)    1 (*global*)      1 (*global*)   
  008:   1 (*global*)      1 (*global*)      1 (*global*)

new/broken:

Version symbols section '.gnu.version' contains 11 entries:
 Addr: 0x00000000000012e6  Offset: 0x000012e6  Link: 8 (.dynsym)
  000:   0 (*local*)       2 (GLIBC_2.3.4)   0 (*local*)       3 (GLIBC_2.2.5)
  004:   0 (*local*)       4 (GLIBCXX_3.4.32)    0 (*local*)       0 (*local*)    
  008:   0 (*local*)       0 (*local*)       0 (*local*)

symbols without versions are incorrectly skipped.  Here is a patch that shows the location of the problem and 'fixes' the issue

cat ~/rpmbuild/SOURCES/0001-binutils-do-not-skip-unversioned-syms.patch 
From f1e79d45b7926e61434823811f31cefd1610eb29 Mon Sep 17 00:00:00 2001
From: Tom Rix <Tom.Rix>
Date: Fri, 14 Nov 2025 08:56:04 -0800
Subject: [PATCH] binutils do not skip unversioned syms

---
 bfd/elflink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 359d1c59248d..3ddbc6879003 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -11178,13 +11178,14 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
 		 symbol is defined locally.  */
 	      if (h->versioned == versioned_hidden && h->def_regular)
 		iversym.vs_vers |= VERSYM_HIDDEN;
+	    }
 
 	      eversym
 		= (Elf_External_Versym *) flinfo->symver_sec->contents;
 	      eversym += h->dynindx;
 	      _bfd_elf_swap_versym_out (flinfo->output_bfd, &iversym,
 					eversym);
-	    }
+
 	}
     }
 
-- 
2.51.1




Reproducible: Always

Comment 1 Nick Clifton 2025-11-17 14:35:35 UTC
Hi Tom,

  I take the point that the new binutils is creating binaries that
  breaks other linkers.  But I am also concerned that a) the discussion
  in PR 33577 is still going on and b) you have not proposed your
  "fix" upstream.  Oh and c) it looks like this problem might actually
  be something that the other linkers need to fix in their codebase
  rather than the bfd linker reverting to its old behaviour.  (maybe).

  I would rather wait at least for a week or so, and see if the PR
  can be completely resolved upstream, rather than applying patches
  to the rawhide sources.  If however the problem still exists in
  let's say two week's time, feel free to ping me and I will 
  implement a fix.

Cheers
  Nick

Comment 2 Tom Stellard 2025-11-17 16:01:11 UTC
Can you reproduce this error with the lld package or does it only affect ROCm's fork of lld?

Comment 3 Tom.Rix 2025-11-17 16:52:30 UTC
(In reply to Nick Clifton from comment #1)
> Hi Tom,
> 
>   I take the point that the new binutils is creating binaries that
>   breaks other linkers.  But I am also concerned that a) the discussion
>   in PR 33577 is still going on and b) you have not proposed your
>   "fix" upstream.  Oh and c) it looks like this problem might actually
>   be something that the other linkers need to fix in their codebase
>   rather than the bfd linker reverting to its old behaviour.  (maybe).
> 
>   I would rather wait at least for a week or so, and see if the PR
>   can be completely resolved upstream, rather than applying patches
>   to the rawhide sources.  If however the problem still exists in
>   let's say two week's time, feel free to ping me and I will 
>   implement a fix.
> 
> Cheers
>   Nick

Though this change will restore the old behavior enough to get past the problem,
the testsuites fail because they now assume the new output. since the upstream bz
looks ongoing i am not sure i would have much to add.

Folks reading this document on .gnu.version
https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA.junk/symversion.html
will expect a 1 if the symbol is global and 0 if local.
the binutils change makes the section inconsistent with the .dynsym section.

Comment 4 Tom.Rix 2025-11-17 16:59:32 UTC
(In reply to Tom Stellard from comment #2)
> Can you reproduce this error with the lld package or does it only affect
> ROCm's fork of lld?

I have not verified this on the system lld.

Here is the workaround for lld I am using.
https://src.fedoraproject.org/rpms/rocm-compilersupport/blob/rawhide/f/0001-lld-workaround-.gnu.version-change.patch
You can see this change would apply to the upstream above, so I would guess it is a problem.

This should bandaid ROCm enough for now.

Comment 5 Fangrui Song 2025-11-19 04:34:16 UTC
In https://sourceware.org/bugzilla/show_bug.cgi?id=33577 , I agree with using index 0 for undefined symbols.

For defined dynamic symbols: 
https://github.com/llvm/llvm-project/blob/52ed0f215faedf3ceb26368ccd180fe3e27760e4/lld/ELF/InputFiles.cpp#L1701
lld has been rejecting defined VER_NDX_LOCAL symbols in .dynsym for a very long time.
If https://sourceware.org/bugzilla/show_bug.cgi?id=33577 the GNU ld change in question caused GNU ld to create VER_NDX_LOCAL defined symbols in .dynsym , it should be reverted.

Comment 6 Hoshino Lina 2025-11-19 09:44:32 UTC
This broke the Chromium/CEF build after a Mesa update. Filed as bug 2415824.

Comment 7 Tom Stellard 2025-11-19 17:57:11 UTC
(In reply to Fangrui Song from comment #5)
> In https://sourceware.org/bugzilla/show_bug.cgi?id=33577 , I agree with
> using index 0 for undefined symbols.
> 
> For defined dynamic symbols: 
> https://github.com/llvm/llvm-project/blob/
> 52ed0f215faedf3ceb26368ccd180fe3e27760e4/lld/ELF/InputFiles.cpp#L1701
> lld has been rejecting defined VER_NDX_LOCAL symbols in .dynsym for a very
> long time.
> If https://sourceware.org/bugzilla/show_bug.cgi?id=33577 the GNU ld change
> in question caused GNU ld to create VER_NDX_LOCAL defined symbols in .dynsym
> , it should be reverted.

@nickc Would it be possible to revert this patch in rawhide for now until we have a long-term solution?

Comment 8 Than Ngo 2025-11-24 10:35:57 UTC
This broke the chromium build - https://kojipkgs.fedoraproject.org//work/tasks/3743/139243743/build.log

Comment 9 Nick Clifton 2025-11-25 09:46:27 UTC
This should be fixed in the latest rawhide binutils: binutils-2.45.50-9.fc44

Note - the upstream sources still contain the "new" / arguably broken code, but it is my hope that this will be resolved soon.

Comment 10 Than Ngo 2025-11-25 11:11:02 UTC
I tried to build chromium with binutils-2.45.50-9.fc44 in rawhide. It still breaks with following errors:

[chrome:3571/53431] LINK ./root_store_tool
FAILED: [code=1] root_store_tool 
"/usr/bin/python3" "../../build/toolchain/gcc_link_wrapper.py" --output="./root_store_tool" -- clang++ -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--icf=all -Wl,--color-diagnostics -Wl,--undefined-version -Wl,--no-call-graph-profile-sort --target=x86_64-unknown-linux-gnu -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -Wl,-z,defs -Wl,--as-needed -nostdlib++ -rdynamic -pie -Wl,--disable-new-dtags prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler2.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject.rlib -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes   -stdlib=libc++ -o "./root_store_tool" -Wl,--start-group @"./root_store_tool.rsp" -Wl,--end-group   /usr/lib/clang/21/lib/x86_64-redhat-linux-gnu/libclang_rt.builtins.a -ldl -lpthread -lrt -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -latomic -ldouble-conversion -lnspr4 -lnss3 -lnssutil3 -lplc4 -lplds4 -lsmime3 -Wl,--start-group obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib obj/third_party/rust/foldhash/v0_2/lib/libfoldhash_lib.rlib obj/build/rust/allocator/libbuild_srust_sallocator_callocator.rlib obj/build/rust/allocator/liballoc_error_handler_impl_ffi.rlib obj/build/rust/allocator/liballocator_impls_ffi.rlib obj/base/libbase_crust_ulogger.rlib obj/base/libbase_clogging_ulog_useverity_ubindgen.rlib obj/third_party/rust/log/v0_4/lib/liblog_lib.rlib obj/build/rust/chromium_prelude/libchromium.rlib obj/third_party/rust/serde_json_lenient/v0_2/wrapper/lib_tprserde_ujson_ulenient_sv0_u2_swrapper_cwrapper.rlib obj/third_party/rust/serde/v1/lib/libserde_lib.rlib obj/third_party/rust/serde_core/v1/lib/libserde_core_lib.rlib obj/third_party/rust/serde_json_lenient/v0_2/lib/libserde_json_lenient_lib.rlib obj/third_party/rust/itoa/v1/lib/libitoa_lib.rlib obj/third_party/rust/memchr/v2/lib/libmemchr_lib.rlib obj/third_party/rust/ryu/v1/lib/libryu_lib.rlib -Wl,--end-group 
clang++: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors' [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-package-notes' [-Wunused-command-line-argument]
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_FreeAddrInfo is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_Delete is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_GetFileInfo is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_DeleteSharedMemory is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_FPrintZoneStats is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_Bind is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_Seek64 is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol LL_MinInt is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_FD_NISSET is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_GetCounterNameFromHandle is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_ntohll is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_Accept is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_GMTParameters is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_SendFile is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_NewTCPSocketPair is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_SetCurrentThreadName is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_FindSymbol is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol LL_MaxUint is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_TransmitFile is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: corrupt input file: version definition index 0 for symbol PR_GetTCPMethods is out of bounds
>>> defined in /usr/bin/../lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libnspr4.so
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)


The link to chromium build log: https://kojipkgs.fedoraproject.org//work/tasks/7600/139277600/build.log

Comment 11 Florian Weimer 2025-11-25 11:31:28 UTC
Looks like libnspr4.so needs to be rebuilt with the fixed binutils.

Comment 12 Thorsten Leemhuis 2025-11-26 08:26:35 UTC
(In reply to Nick Clifton from comment #9)
> This should be fixed in the latest rawhide binutils: binutils-2.45.50-9.fc44
> Note - the upstream sources still contain the "new" / arguably broken code,
> but it is my hope that this will be resolved soon.

Pretty sure 2.45.50-9.fc44 broke kernel builds for me – and looks like for Fedora, too https://koji.fedoraproject.org/koji/taskinfo?taskID=139285551

```
libbpf.c: In function ‘kallsyms_cb’:
libbpf.c:8250:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
 8250 |         res = strstr(sym_name, ".llvm.");
      |             ^
libbpf.c: In function ‘avail_kallsyms_cb’:
libbpf.c:11579:31: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
11579 |                 if (!(sym_sfx = strstr(sym_name, ".llvm.")))
      |                               ^
libbpf.c: In function ‘resolve_full_path’:
libbpf.c:12167:35: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
12167 |                         next_path = strchr(s, ':');
      |                                   ^
cc1: all warnings being treated as errors
```

Will that be fixed by a rebuild of some other package or is more needed on the binutils side?

Comment 13 Sam James 2025-11-26 08:31:36 UTC
That's from a glibc change for C23. Packages themselves need to be fixed for that.

Comment 14 Thorsten Leemhuis 2025-11-26 11:42:24 UTC
(In reply to Sam James from comment #13)
> That's from a glibc change for C23. Packages themselves need to be fixed for
> that.

Ugh, I deeply apologise for the false alarm then. So much for the "Pretty sure" (yes, glibc changed in parallel to binutils, I missed that and blamed binutils) :-((


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