[PATCH] D68076: [AArch64] Enable unwind tables by default for Gnu targets

David Tellenbach via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 26 02:44:10 PDT 2019


tellenbach created this revision.
Herald added subscribers: cfe-commits, kristof.beyls, aprantl.
Herald added a project: clang.

Currently the following situation can occur: During AArch64 frame lowering cfi instructions get emitted if debug information is generated but not if not. Since cfi instructions act as scheduling boundaries during instruction scheduling this leads to different scheduling regions and therefore different assembly depending on whether debug information is generated or not.

This patch fixes this problem by enabling unwind tables by default on AArch64 when compiling for a Gnu targets.


Repository:
  rC Clang

https://reviews.llvm.org/D68076

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/test/Driver/clang-translation.c


Index: clang/test/Driver/clang-translation.c
===================================================================
--- clang/test/Driver/clang-translation.c
+++ clang/test/Driver/clang-translation.c
@@ -150,6 +150,10 @@
 // ARMv8_THREAD_POINTER_EL3-NOT: "-target-feature" "+tpidr-el2"
 // ARMv8_THREAD_POINTER_EL3: "-target-feature" "+tpidr-el3"
 
+// RUN: %clang -target aarch64-linux -### -S %s 2>&1 | \
+// RUN: FileCheck -check-prefix=AARCH64_LINUX_DEFAULT_UNWIND_TABLES %s
+// AARCH64_LINUX_DEFAULT_UNWIND_TABLES: "-munwind-tables"
+
 // RUN: %clang -target powerpc64-unknown-linux-gnu \
 // RUN: -### -S %s -mcpu=G5 2>&1 | FileCheck -check-prefix=PPCG5 %s
 // PPCG5: clang
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2540,7 +2540,8 @@
 }
 
 bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
-  return getArch() == llvm::Triple::x86_64;
+  return getArch() == llvm::Triple::x86_64 ||
+         getArch() == llvm::Triple::aarch64;
 }
 
 bool Generic_GCC::isPICDefault() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68076.221902.patch
Type: text/x-patch
Size: 1150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190926/ac890f26/attachment.bin>


More information about the cfe-commits mailing list