Skip to content

llvmPackages_{18,19,20,21}.lld: initialize Symbol fields in the constructor - #568680

Merged
philiptaron merged 1 commit into
NixOS:stagingfrom
amaanq:lld-symbol-init
Oct 7, 2026
Merged

philiptaron merged 1 commit into
NixOS:stagingfrom
amaanq:lld-symbol-init

Conversation

@amaanq

@amaanq amaanq commented Sep 30, 2026

Copy link
Copy Markdown
Member

lld relies on a memset that GCC 16 is allowed to optimize away, leaving
some symbol fields uninitialized. With lld 21, this makes ld -r emit
broken section symbols, which breaks LTO kernel module builds
(see ClangBuiltLinux/linux#2162). 18 through 20 should have the same
bug, but I haven't seen it break there myself.

This backports llvm/llvm-project@4d5dffb594 and
llvm/llvm-project@070e505ce2, which landed in 22.1.8.

Things done

…structor

lld relies on a memset that GCC 16 is allowed to optimize away, leaving
some symbol fields uninitialized. With lld 21, this makes `ld -r` emit
broken section symbols, which breaks LTO kernel module builds
(see ClangBuiltLinux/linux#2162). 18 through 20 should have the same
bug, but I haven't seen it break there myself.

This backports llvm/llvm-project@4d5dffb594 and
llvm/llvm-project@070e505ce2, which landed in 22.1.8.
@nixpkgs-ci
nixpkgs-ci Bot requested review from a team and andir and removed request for a team September 30, 2026 14:49
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. labels Sep 30, 2026
@nixpkgs-ci
nixpkgs-ci Bot requested a review from a team September 30, 2026 14:50
@nixpkgs-ci nixpkgs-ci Bot added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label Sep 30, 2026

@peterwaller-arm peterwaller-arm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I've done my best to verify:

  • The patch faithfully represents what is upstream.
  • The patches apply and I can build those TUs (whole builds and tests not done).
  • It makes sense to want to backport this.

I didn't spot any obvious wiring mistakes.

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Sep 30, 2026
@Stzx

Stzx commented Oct 4, 2026

Copy link
Copy Markdown
Member

This may be related to the kernel compilation failure,

Kernel (xanmod 7.2.9) + LLVM (21.1.8) + LTO

net/ipv4/udp_tunnel.o: error: objtool: bad .discard.annotate_insn entry: 0 of type 8
make[4]: *** [../scripts/Makefile.build:509: net/ipv4/udp_tunnel.o] Error 255
make[4]: *** Deleting file 'net/ipv4/udp_tunnel.o'
make[4]: *** Waiting for unfinished jobs....
  CC [M]  net/ipv4/netfilter/ipt_ah.o
  CC [M]  net/netfilter/ipset/ip_set_hash_net.o
net/netfilter/nf_conntrack_h323.o: error: objtool: +0x23f: special: can't find orig instruction
make[4]: *** [../scripts/Makefile.build:509: net/netfilter/nf_conntrack_h323.o] Error 255
make[4]: *** Deleting file 'net/netfilter/nf_conntrack_h323.o'
make[4]: *** Waiting for unfinished jobs....
  CC [M]  net/ipv4/netfilter/ipt_rpfilter.o
  CC [M]  net/netfilter/ipset/ip_set_hash_netport.o
  CC [M]  net/ipv4/netfilter/ipt_ECN.o
  CC [M]  net/netfilter/ipset/ip_set_hash_netiface.o
  CC [M]  net/ipv4/netfilter/ipt_REJECT.o
net/netfilter/nf_nat.o: error: objtool: bad .discard.annotate_insn entry: 0 of type 8
make[4]: *** [../scripts/Makefile.build:509: net/netfilter/nf_nat.o] Error 255
make[4]: *** Deleting file 'net/netfilter/nf_nat.o'
  CC [M]  net/ipv4/netfilter/ipt_SYNPROXY.o
  CC [M]  net/netfilter/ipset/ip_set_hash_netnet.o
  CC [M]  net/ipv4/netfilter/arpt_mangle.o
  CC [M]  net/ipv4/netfilter/nf_dup_ipv4.o
  CC [M]  net/netfilter/ipset/ip_set_hash_netportnet.o
  CC [M]  net/netfilter/ipset/ip_set_list_set.o
net/netfilter/ipset/ip_set_hash_netiface.o: error: objtool: bad .discard.annotate_insn entry: 2 of type 8
make[5]: *** [../scripts/Makefile.build:289: net/netfilter/ipset/ip_set_hash_netiface.o] Error 255
make[5]: *** Deleting file 'net/netfilter/ipset/ip_set_hash_netiface.o'
make[5]: *** Waiting for unfinished jobs....
  CC [M]  net/ipv4/netfilter/nf_nat_snmp_basic.asn1.o
  CC [M]  net/ipv4/netfilter/nf_nat_snmp_basic_main.o
make[4]: *** [../scripts/Makefile.build:550: net/netfilter/ipset] Error 2
net/netfilter/nf_tables.o: error: objtool: +0x170: special: can't find orig instruction
make[4]: *** [../scripts/Makefile.build:509: net/netfilter/nf_tables.o] Error 255
make[4]: *** Deleting file 'net/netfilter/nf_tables.o'
make[3]: *** [../scripts/Makefile.build:550: net/netfilter] Error 2
  CC [M]  kernel/kheaders.o
  LD [M]  net/ipv4/netfilter/nf_nat_snmp_basic.o
make[3]: *** [../scripts/Makefile.build:550: net/ipv4] Error 2
make[2]: *** [../scripts/Makefile.build:550: net] Error 2
make[1]: *** [/build/source/Makefile:2211: .] Error 2
make: *** [/build/source/Makefile:248: __sub-make] Error 2

@zowoq zowoq left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes kernel built with clang 21.

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Oct 5, 2026
@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 3+ This PR was reviewed and approved by three or more persons. and removed 12.approvals: 2 This PR was reviewed and approved by two persons. labels Oct 7, 2026
@philiptaron
philiptaron added this pull request to the merge queue Oct 7, 2026
Merged via the queue into NixOS:staging with commit 90873de Oct 7, 2026
40 checks passed
insipx pushed a commit to insipx/nixpkgs that referenced this pull request Oct 8, 2026
kixelated added a commit to moq-dev/moq that referenced this pull request Oct 13, 2026
GCC 16 miscompiles nixpkgs' lld 21, so zig's relocatable link writes
undefined section symbols into aws-lc's bcm.o. Fixed upstream by
NixOS/nixpkgs#568680; add a quest waiting on it to reach
nixpkgs-unstable and shrink release-link to the bump.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. 12.approvals: 3+ This PR was reviewed and approved by three or more persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants