Repository navigation
bootstrap: "download-ci-llvm = true" doesn't work on x86_64-pc-windows-gnu with lld #107668
Description
Activity
- addedT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)C-bugCategory: This is a bug.Category: This is a bug.A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
on Feb 4, 2023 It happens only with LLD but i haven't investigated.
At MSYS2 we had to remove M68k to maskę it build with LLD but since 1.67 we no longer got this issue: https://github.com/msys2/MINGW-packages/pull/15256/files#diff-9d9b9deaf0bc40ce778f7bbeae62dd4b0c7a3269b7cf080ab80acfb8b5d561d9L8- addedA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binaries
on Feb 17, 2023 cc #39915
do either of you know what LLD is doing differently compared to LD? is this something rustc controls? It would help to have a minimization smaller than "all of rustc and llvm" ...
- changed the title
[-]bootstrap: "download-ci-llvm = true" doesn't work on x86_64-pc-windows-gnu[/-][+]bootstrap: "download-ci-llvm = true" doesn't work on x86_64-pc-windows-gnu with lld[/+]on Feb 17, 2023 I don't know the answer to any of those questions but this issue stopped happening at MSYS2 so it could have been some LLVM 16 change (MSYS2 uses LLVM 15 but backports important patches from LLVM 16) that fixed this problem there.
Looks like we're currently using LLVM 15: https://github.com/rust-lang/llvm-project/tree/rustc/15.0-2022-12-07
@rustbot label +S-blocked
- addedS-blockedStatus: Blocked on something else such as an RFC or other implementation work.Status: Blocked on something else such as an RFC or other implementation work.
on Feb 19, 2023 Yup, I plan to try once #107224 is merged.
Reacted by jynThis is still an issue with LLVM 17.0.5.
Reacted by Onur Özkan and Mateusz MikułaThere's an ODR violation in M68k's
FormalArgHandler, its base classM68kIncomingValueHandlerdoesn't have a virtual methodmarkPhysRegUsedwhileIncomingValueHandlerfor all other targets including PPC do.So it's not a linker's problem,
ldactually complains about this too, it just reports it as a warning instead of an error.The simplest fix is to rename the structure (instead of adding virtual methods).
diff --git a/llvm/lib/Target/M68k/GISel/M68kCallLowering.cpp b/llvm/lib/Target/M68k/GISel/M68kCallLowering.cpp index b0ada29d1cea..93b250656cd2 100644 --- a/llvm/lib/Target/M68k/GISel/M68kCallLowering.cpp +++ b/llvm/lib/Target/M68k/GISel/M68kCallLowering.cpp @@ -118,7 +118,7 @@ bool M68kCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder, CCAssignFn *AssignFn = TLI.getCCAssignFn(F.getCallingConv(), false, F.isVarArg()); IncomingValueAssigner ArgAssigner(AssignFn); - FormalArgHandler ArgHandler(MIRBuilder, MRI); + M68kFormalArgHandler ArgHandler(MIRBuilder, MRI); return determineAndHandleAssignments(ArgHandler, ArgAssigner, SplitArgs, MIRBuilder, F.getCallingConv(), F.isVarArg()); diff --git a/llvm/lib/Target/M68k/GISel/M68kCallLowering.h b/llvm/lib/Target/M68k/GISel/M68kCallLowering.h index a1589e96aa3d..5e05e46f4ac4 100644 --- a/llvm/lib/Target/M68k/GISel/M68kCallLowering.h +++ b/llvm/lib/Target/M68k/GISel/M68kCallLowering.h @@ -63,8 +63,8 @@ private: ISD::ArgFlagsTy Flags) override; }; -struct FormalArgHandler : public M68kIncomingValueHandler { - FormalArgHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI) +struct M68kFormalArgHandler : public M68kIncomingValueHandler { + M68kFormalArgHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI) : M68kIncomingValueHandler(MIRBuilder, MRI) {} };
I wish I tried to debug this a few years eariler.
Reacted by Rémy Rakic, Mateusz Mikuła and nori liCould someone submit this to LLVM?
I'm not familiar with their processes.
cc @nikicYou can simply open pull request to https://github.com/llvm/llvm-project/
Otherwise I can do it this or next weekend.Opened a pull request with the fix - llvm/llvm-project#72797
Reacted by Mateusz Mikuła and Rémy Rakic- added a commit that references this issue
on Dec 14, 2023 Fixed in #119159.
- added a commit that references this issue
on Dec 20, 2023 - added a commit that references this issue
on Apr 23, 2024 - added a commit that references this issue
on Oct 7, 2026
You get an error like this:
I didn't investigate it further.
It never worked in the past and I assumed it's due to the old mingw version on CI, but it still doesn't work after #100178 and the actual error doesn't look like it's caused by a toolchain version.