Skip to content

Remove workaround for unnamed_addr constants for LLVM JIT #28704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions lib/IRGen/GenDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2590,20 +2590,15 @@ static llvm::GlobalVariable *createGOTEquivalent(IRGenModule &IGM,
global,
llvm::Twine("got.") + globalName);

// rdar://problem/50968433: Unnamed_addr constants appear to get emitted
// with incorrect alignment by the LLVM JIT in some cases. Don't use
// unnamed_addr as a workaround.
// rdar://problem/53836960: i386 ld64 also mis-links relative references
// to GOT entries.
if (!IGM.getOptions().UseJIT
&& (!IGM.Triple.isOSDarwin()
|| IGM.Triple.getArch() != llvm::Triple::x86)) {
if (!IGM.Triple.isOSDarwin() || IGM.Triple.getArch() != llvm::Triple::x86) {
gotEquivalent->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
} else {
ApplyIRLinkage(IRLinkage::InternalLinkOnceODR)
.to(gotEquivalent);
}

return gotEquivalent;
}

Expand Down