Skip to content

Commit 81a8d54

Browse files
authored
Merge pull request #27224 from jckarter/armv7k-linker-workaround-5.1-08
[5.1 08-28-2019] IRGen: Backport workaround for rdar://problem/53836960
2 parents e1ac27c + 9893549 commit 81a8d54

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,13 +2559,22 @@ static llvm::GlobalVariable *createGOTEquivalent(IRGenModule &IGM,
25592559
// rdar://problem/50968433: Unnamed_addr constants appear to get emitted
25602560
// with incorrect alignment by the LLVM JIT in some cases. Don't use
25612561
// unnamed_addr as a workaround.
2562-
if (!IGM.getOptions().UseJIT) {
2562+
// rdar://problem/53836960: LLVM miscompiles relative references to local
2563+
// symbols.
2564+
if (!IGM.getOptions().UseJIT
2565+
&& (!IGM.Triple.isOSDarwin()
2566+
|| (IGM.Triple.getArch() != llvm::Triple::x86 &&
2567+
IGM.Triple.getArchName() != "armv7" &&
2568+
IGM.Triple.getArchName() != "armv7s" &&
2569+
IGM.Triple.getArchName() != "thumbv7" &&
2570+
IGM.Triple.getArchName() != "thumbv7s" &&
2571+
!IGM.Triple.isWatchABI()))) {
25632572
gotEquivalent->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
25642573
} else {
25652574
ApplyIRLinkage(IRLinkage::InternalLinkOnceODR)
25662575
.to(gotEquivalent);
25672576
}
2568-
2577+
25692578
return gotEquivalent;
25702579
}
25712580

0 commit comments

Comments
 (0)