diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index ad0e9012525..b45b8e354b3 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -163,14 +163,6 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M, // If the symbol is defined, it cannot be preempted. if (!GV->isDeclarationForLinker()) return true; - } else if (TT.isOSBinFormatELF()) { - // If dso_local allows AsmPrinter::getSymbolPreferLocal to use a local - // alias, set the flag. We cannot set dso_local for other global values, - // because otherwise direct accesses to a probably interposable symbol (even - // if the codegen assumes not) will be rejected by the linker. - if (!GV->canBenefitFromLocalAlias()) - return false; - return TT.isX86() && M.noSemanticInterposition(); } // ELF & wasm support preemption of other symbols. diff --git a/test/CodeGen/X86/semantic-interposition-comdat.ll b/test/CodeGen/X86/semantic-interposition-comdat.ll deleted file mode 100644 index d11be2d6bd0..00000000000 --- a/test/CodeGen/X86/semantic-interposition-comdat.ll +++ /dev/null @@ -1,28 +0,0 @@ -; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s - -$comdat_func = comdat any - -; CHECK-LABEL: func2: -; CHECK-NOT: .Lfunc2$local - -declare void @func() - -define hidden void @func2() { -entry: - call void @func() - ret void -} - -; CHECK: comdat_func: -; CHECK-NOT: .Lcomdat_func$local - -define hidden void @comdat_func() comdat { -entry: - call void @func() - ret void -} - -!llvm.module.flags = !{!0, !1} - -!0 = !{i32 1, !"SemanticInterposition", i32 0} -!1 = !{i32 7, !"PIC Level", i32 2} diff --git a/test/CodeGen/X86/semantic-interposition-infer-dsolocal.ll b/test/CodeGen/X86/semantic-interposition-infer-dsolocal.ll deleted file mode 100644 index a0391d03646..00000000000 --- a/test/CodeGen/X86/semantic-interposition-infer-dsolocal.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s - -;; With a module flag SemanticInterposition=0, infer dso_local flags even if PIC. -;; Local aliases will be generated for applicable variables and functions. - -@var = global i32 0, align 4 - -@ifunc = ifunc i32 (), bitcast (i32 ()* ()* @ifunc_resolver to i32 ()*) - -define i32 @ifunc_impl() { -entry: - ret i32 0 -} - -define i32 ()* @ifunc_resolver() { -entry: - ret i32 ()* @ifunc_impl -} - -declare i32 @external() - -define i32 @func() { - ret i32 0 -} - -;; Don't set dso_local on declarations or ifuncs. -define i32 @foo() { -; CHECK: movl .Lvar$local(%rip), %ebp -; CHECK: callq external@PLT -; CHECK: callq ifunc@PLT -; CHECK: callq .Lfunc$local{{$}} -entry: - %0 = load i32, i32* @var, align 4 - %call = tail call i32 @external() - %add = add nsw i32 %call, %0 - %call1 = tail call i32 @ifunc() - %add2 = add nsw i32 %add, %call1 - %call2 = tail call i32 @func() - %add3 = add nsw i32 %add, %call2 - ret i32 %add3 -} - -!llvm.module.flags = !{!0, !1} - -!0 = !{i32 1, !"SemanticInterposition", i32 0} -!1 = !{i32 7, !"PIC Level", i32 2}