Author: Fangrui Song Date: 2020-12-05T00:42:07-08:00 New Revision: 1ab9327d1c01645806394faa648f65e947b65177
URL: https://github.com/llvm/llvm-project/commit/1ab9327d1c01645806394faa648f65e947b65177 DIFF: https://github.com/llvm/llvm-project/commit/1ab9327d1c01645806394faa648f65e947b65177.diff LOG: [TargetMachine][CodeGenModule] Delete unneeded ppc32 special case from shouldAssumeDSOLocal PPCMCInstLower does not actually call shouldAssumeDSOLocal for ppc32 so this is dead. Actually Clang ppc32 does produce a pair of absolute relocations which match GCC. This also fixes a comment (R_PPC_COPY and R_PPC64_COPY do exist). Added: Modified: clang/lib/CodeGen/CodeGenModule.cpp llvm/lib/Target/TargetMachine.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ce5fb9434950..0bb9c91f2434 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -967,10 +967,8 @@ static bool shouldAssumeDSOLocal(const CodeGenModule &CGM, if (RM == llvm::Reloc::PIC_ && GV->hasExternalWeakLinkage()) return false; - // PPC has no copy relocations and cannot use a plt entry as a symbol address. - llvm::Triple::ArchType Arch = TT.getArch(); - if (Arch == llvm::Triple::ppc || Arch == llvm::Triple::ppc64 || - Arch == llvm::Triple::ppc64le) + // PowerPC64 prefers TOC indirection to avoid copy relocations. + if (TT.isPPC64()) return false; // If we can use copy relocations we can assume it is local. diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index 30f588193def..e2fd4687d3c8 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -186,8 +186,8 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M, return false; Triple::ArchType Arch = TT.getArch(); - // PowerPC prefers avoiding copy relocations. - if (Arch == Triple::ppc || TT.isPPC64()) + // PowerPC64 prefers TOC indirection to avoid copy relocations. + if (TT.isPPC64()) return false; // dso_local is traditionally implied for Reloc::Static. Eventually we shall _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits