summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-08-14 10:30:27 +0000
committerFangrui Song <maskray@google.com>2019-08-14 10:30:27 +0000
commit8caa0aaa4dcdd3e68c260c75abfad52519d70753 (patch)
tree3fc3afda079eb4e863457bd60a3cb527d9bd266d
parent15e26d1fe945eda5de84ab9b90bc63f2945ba9cc (diff)
downloadbcm5719-llvm-8caa0aaa4dcdd3e68c260c75abfad52519d70753.tar.gz
bcm5719-llvm-8caa0aaa4dcdd3e68c260c75abfad52519d70753.zip
[AsmPrinter] Delete redundant .type foo, @function when emitting an ifunc
In MCAsmStreamer: .type foo,@function # <--- this is redundant .type foo,@gnu_indirect_function In MCELFStreamer, the latter STT_GNU_IFUNC overrides STT_FUNC. llvm-svn: 368823
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp9
-rw-r--r--llvm/test/CodeGen/X86/ifunc-asm.ll3
2 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index cc85cb940e6..61cb46cb4bb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1313,11 +1313,10 @@ void AsmPrinter::emitGlobalIndirectSymbol(Module &M,
// Set the symbol type to function if the alias has a function type.
// This affects codegen when the aliasee is not a function.
- if (IsFunction) {
- OutStreamer->EmitSymbolAttribute(Name, MCSA_ELF_TypeFunction);
- if (isa<GlobalIFunc>(GIS))
- OutStreamer->EmitSymbolAttribute(Name, MCSA_ELF_TypeIndFunction);
- }
+ if (IsFunction)
+ OutStreamer->EmitSymbolAttribute(Name, isa<GlobalIFunc>(GIS)
+ ? MCSA_ELF_TypeIndFunction
+ : MCSA_ELF_TypeFunction);
EmitVisibility(Name, GIS.getVisibility());
diff --git a/llvm/test/CodeGen/X86/ifunc-asm.ll b/llvm/test/CodeGen/X86/ifunc-asm.ll
index ef3f5b32ad1..c1604882f3c 100644
--- a/llvm/test/CodeGen/X86/ifunc-asm.ll
+++ b/llvm/test/CodeGen/X86/ifunc-asm.ll
@@ -10,6 +10,5 @@ entry:
; CHECK-NEXT: foo_ifunc:
@foo = ifunc i32 (i32), i64 ()* @foo_ifunc
-; CHECK: .type foo,@function
-; CHECK-NEXT: .type foo,@gnu_indirect_function
+; CHECK: .type foo,@gnu_indirect_function
; CHECK-NEXT: .set foo, foo_ifunc
OpenPOWER on IntegriCloud