Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Commit

Permalink
Disable indirect symbols via GOT pcrel on Mach-O 64-bit
Browse files Browse the repository at this point in the history
This commit currently causes LLVM to segfault when compiling Rust code on 64-bit
OSX platforms, reported as this LLVM bug:

    https://llvm.org/bugs/show_bug.cgi?id=23779

A bisection turned up r230264 as the offending commit, the review of which is at
http://reviews.llvm.org/D6922. To the best of my knowledge this looks like it's
an optimization for OSX which is fine to omit, so this commit just flips the
flag to *not* perform this optimization, allowing Rust to bootstrap and pass all
tests on OSX 64-bit.
  • Loading branch information
alexcrichton committed Jun 17, 2015
1 parent 8399ec4 commit d3add25
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/CodeGen/TargetLoweringObjectFileImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,25 @@ TargetLoweringObjectFileELF::InitializeELF(bool UseInitArray_) {

TargetLoweringObjectFileMachO::TargetLoweringObjectFileMachO()
: TargetLoweringObjectFile() {
SupportIndirectSymViaGOTPCRel = true;
// WARNING: this is a difference from upstream LLVM!
// -------------------------------------------------
//
// Disable indirect symbols via GOT pcrel on Mach-O 64-bit
//
// If this flag is `true`, then it causes LLVM to segfault when compiling Rust
// code on 64-bit OSX platforms, reported as this LLVM bug:
//
// https://llvm.org/bugs/show_bug.cgi?id=23779
//
// A bisection turned up r230264 as the offending commit, the review of which
// is at http://reviews.llvm.org/D6922. To the best of my knowledge this looks
// like it's an optimization for OSX which is fine to omit, so this commit
// just flips the flag to *not* perform this optimization, allowing Rust to
// bootstrap and pass all tests on OSX 64-bit.
//
// Once that LLVM bug has been fixed, this should be able to be set to `true`
// again.
SupportIndirectSymViaGOTPCRel = false;
}

/// getDepLibFromLinkerOpt - Extract the dependent library name from a linker
Expand Down

0 comments on commit d3add25

Please sign in to comment.