diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2021-03-11 14:54:47 -0800 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2021-03-17 17:27:41 -0700 |
| commit | d672d5219a72d2e13dcc257116876d41955e36b2 (patch) | |
| tree | f1f9128c9ca4fd9d43ceb9e445db01da42aada29 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | 3315bd0beb4cf23f838bd522a1f0e3fcc0a9fae2 (diff) | |
Revert "[CodeGenModule] Set dso_local for Mach-O GlobalValue"
This reverts commit 809a1e0ffd7af40ee27270ff8ba2ffc927330e71.
Mach-O doesn't support dso_local and this change broke XNU because of the use of dso_local.
Differential Revision: https://reviews.llvm.org/D98458
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index f3a73f8783dc..3a197e85ef7b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -978,20 +978,14 @@ static bool shouldAssumeDSOLocal(const CodeGenModule &CGM, if (TT.isOSBinFormatCOFF() || (TT.isOSWindows() && TT.isOSBinFormatMachO())) return true; - const auto &CGOpts = CGM.getCodeGenOpts(); - llvm::Reloc::Model RM = CGOpts.RelocationModel; - const auto &LOpts = CGM.getLangOpts(); - - if (TT.isOSBinFormatMachO()) { - if (RM == llvm::Reloc::Static) - return true; - return GV->isStrongDefinitionForLinker(); - } - // Only handle COFF and ELF for now. if (!TT.isOSBinFormatELF()) return false; + // If this is not an executable, don't assume anything is local. + const auto &CGOpts = CGM.getCodeGenOpts(); + llvm::Reloc::Model RM = CGOpts.RelocationModel; + const auto &LOpts = CGM.getLangOpts(); if (RM != llvm::Reloc::Static && !LOpts.PIE) { // On ELF, if -fno-semantic-interposition is specified and the target // supports local aliases, there will be neither CC1 |
