diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 | 
| commit | 54db30ce18663e6c2991958f3b5d18362e8e93c4 (patch) | |
| tree | 4aa6442802570767398cc83ba484e97b1309bdc2 /contrib/llvm/lib/Target/TargetMachine.cpp | |
| parent | 35284c22e9c8348159b7ce032ea45f2cdeb65298 (diff) | |
| parent | e6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/Target/TargetMachine.cpp')
| -rw-r--r-- | contrib/llvm/lib/Target/TargetMachine.cpp | 22 | 
1 files changed, 16 insertions, 6 deletions
| diff --git a/contrib/llvm/lib/Target/TargetMachine.cpp b/contrib/llvm/lib/Target/TargetMachine.cpp index 39d5705b2a53..634866d93570 100644 --- a/contrib/llvm/lib/Target/TargetMachine.cpp +++ b/contrib/llvm/lib/Target/TargetMachine.cpp @@ -1,9 +1,8 @@  //===-- TargetMachine.cpp - General Target Information ---------------------==//  // -//                     The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception  //  //===----------------------------------------------------------------------===//  // @@ -145,6 +144,12 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,        isa<GlobalVariable>(GV))      return false; +  // On COFF, don't mark 'extern_weak' symbols as DSO local. If these symbols +  // remain unresolved in the link, they can be resolved to zero, which is +  // outside the current DSO. +  if (TT.isOSBinFormatCOFF() && GV && GV->hasExternalWeakLinkage()) +    return false; +    // Every other GV is local on COFF.    // Make an exception for windows OS in the triple: Some firmware builds use    // *-win32-macho triples. This (accidentally?) produced windows relocations @@ -168,7 +173,12 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,      return GV && GV->isStrongDefinitionForLinker();    } -  assert(TT.isOSBinFormatELF()); +  // Due to the AIX linkage model, any global with default visibility is +  // considered non-local. +  if (TT.isOSBinFormatXCOFF()) +    return false; + +  assert(TT.isOSBinFormatELF() || TT.isOSBinFormatWasm());    assert(RM != Reloc::DynamicNoPIC);    bool IsExecutable = @@ -196,7 +206,7 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,        return true;    } -  // ELF supports preemption of other symbols. +  // ELF & wasm support preemption of other symbols.    return false;  } | 
