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 {


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 {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to