Skip to content

IRGen: Work around JIT bug with GOT equivalents. #24944

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
merged 1 commit into from
May 22, 2019

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented May 21, 2019

SR-10590 | rdar://problem/50968433 appears to be caused by an LLVM JIT bug where GOT-equivalent
globals get emitted with incorrect alignment. Not marking the GOT equivalent as unnamed_addr
(which prevents it from getting folded into the GOT, or other equivalent constants) appears
to work around the issue.

rdar://problem/50971519

@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ad89fa5816a07f570c229a82b2475d81e69f5eb5

@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ad89fa5816a07f570c229a82b2475d81e69f5eb5

@@ -2419,7 +2420,9 @@ static llvm::GlobalVariable *createGOTEquivalent(IRGenModule &IGM,
llvm::GlobalValue::PrivateLinkage,
global,
llvm::Twine("got.") + globalName);
gotEquivalent->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
if (!IGM.getOptions().UseJIT)
Copy link
Member

Choose a reason for hiding this comment

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

This would be nice to annotate with a FIXME and a reference to the SR and PR

@jckarter jckarter force-pushed the keypath-jit-workaround branch from ad89fa5 to 05fe130 Compare May 21, 2019 17:08
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ad89fa5816a07f570c229a82b2475d81e69f5eb5

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ad89fa5816a07f570c229a82b2475d81e69f5eb5

@jckarter jckarter force-pushed the keypath-jit-workaround branch from 05fe130 to c7c8e5e Compare May 21, 2019 17:30
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 05fe1305b4d4e433b9c4bbb7881e0569f827a7c6

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 05fe1305b4d4e433b9c4bbb7881e0569f827a7c6

if (!IGM.getOptions().UseJIT) {
gotEquivalent->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
} else {
gotEquivalent->setLinkage(llvm::GlobalValue::LinkOnceODRLinkage);
Copy link
Member

Choose a reason for hiding this comment

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

Please use ApplyIRLinkage here. Without the COMDAT, this will break the Windows build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It probably wouldn't matter in this case, because there'd never be any time we feed two -use-jit-built modules into LINK simultaneously. In immediate mode there's only one module, and in integrated-REPL mode, the REPL does its own ad-hoc coalescing and linking of separate modules.

SR-10590 | rdar://problem/50968433 appears to be caused by an LLVM JIT bug where GOT-equivalent
globals get emitted with incorrect alignment. Not marking the GOT equivalent as unnamed_addr
(which prevents it from getting folded into the GOT, or other equivalent constants) appears
to work around the issue.
@jckarter jckarter force-pushed the keypath-jit-workaround branch from c7c8e5e to 81c7f84 Compare May 21, 2019 21:17
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c7c8e5ebe586390c34b59b993eedf0d34b1dfcc2

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c7c8e5ebe586390c34b59b993eedf0d34b1dfcc2

@jckarter
Copy link
Contributor Author

@swift-ci Please test Linux

@jckarter jckarter merged commit 3a1771c into swiftlang:master May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants