From d672d5219a72d2e13dcc257116876d41955e36b2 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Thu, 11 Mar 2021 14:54:47 -0800 Subject: 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 --- clang/lib/CodeGen/CodeGenModule.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') 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 -- cgit v1.2.3