From 9cfd368302666f38a317df64c68e33abdd6ecdee Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Fri, 18 Apr 2014 14:54:41 +0000 Subject: [PATCH] ARM64: don't emit .subsections_via_symbols on ELF. Part of PR19455. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206610 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM64/ARM64AsmPrinter.cpp | 16 +++++++++------- test/CodeGen/ARM64/subsections.ll | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 test/CodeGen/ARM64/subsections.ll diff --git a/lib/Target/ARM64/ARM64AsmPrinter.cpp b/lib/Target/ARM64/ARM64AsmPrinter.cpp index 09dbf55e3f1..9ea00c8a938 100644 --- a/lib/Target/ARM64/ARM64AsmPrinter.cpp +++ b/lib/Target/ARM64/ARM64AsmPrinter.cpp @@ -120,13 +120,15 @@ private: //===----------------------------------------------------------------------===// void ARM64AsmPrinter::EmitEndOfAsmFile(Module &M) { - // Funny Darwin hack: This flag tells the linker that no global symbols - // contain code that falls through to other global symbols (e.g. the obvious - // implementation of multiple entry points). If this doesn't occur, the - // linker can safely perform dead code stripping. Since LLVM never - // generates code that does this, it is always safe to set. - OutStreamer.EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); - SM.serializeToStackMapSection(); + if (Subtarget->isTargetMachO()) { + // Funny Darwin hack: This flag tells the linker that no global symbols + // contain code that falls through to other global symbols (e.g. the obvious + // implementation of multiple entry points). If this doesn't occur, the + // linker can safely perform dead code stripping. Since LLVM never + // generates code that does this, it is always safe to set. + OutStreamer.EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); + SM.serializeToStackMapSection(); + } // Emit a .data.rel section containing any stubs that were created. if (Subtarget->isTargetELF()) { diff --git a/test/CodeGen/ARM64/subsections.ll b/test/CodeGen/ARM64/subsections.ll new file mode 100644 index 00000000000..316e7c3a8eb --- /dev/null +++ b/test/CodeGen/ARM64/subsections.ll @@ -0,0 +1,5 @@ +; RUN: llc -mtriple=arm64-apple-ios7.0 -o - %s | FileCheck %s --check-prefix=CHECK-MACHO +; RUN: llc -mtriple=arm64-linux-gnu -o - %s | FileCheck %s --check-prefix=CHECK-ELF + +; CHECK-MACHO: .subsections_via_symbols +; CHECK-ELF-NOT: .subsections_via_symbols \ No newline at end of file -- 2.34.1