TargetMachine: Make the win32-macho workaround more specific.

This is to avoid problems with win32 + ELF which surprisingly happens a
lot in practice: If a user just specifies -march on the commandline the
object format changes along with the architecture to ELF in many
instances while the OS stays with the default/host OS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283151 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun 2016-10-03 22:12:37 +00:00
parent 1596f9b429
commit 3d8b8c8458

View File

@ -131,7 +131,7 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
// Make an exception for windows OS in the triple: Some firmwares builds use
// *-win32-macho triples. This (accidentally?) produced windows relocations
// without GOT tables in older clang versions; Keep this behaviour.
if (TT.isOSBinFormatCOFF() || TT.isOSWindows())
if (TT.isOSBinFormatCOFF() || (TT.isOSWindows() && TT.isOSBinFormatMachO()))
return true;
if (GV && (GV->hasLocalLinkage() || !GV->hasDefaultVisibility()))