Skip to content

Conversation

androm3da
Copy link
Member

The missing PT_GNU_EH_FRAME was causing C++ exception handling test failures in llvm-test-suite. We should unconditionally add this argument like the other drivers do.

Discovered-by: Alexey Karyakin [email protected]
Fixes: #129745

The missing `PT_GNU_EH_FRAME` was causing C++ exception handling test
failures in llvm-test-suite.  We should unconditionally add this
argument like the other drivers do.

Fixes: llvm#129745
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:Hexagon clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Mar 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 7, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-backend-hexagon

Author: Brian Cain (androm3da)

Changes

The missing PT_GNU_EH_FRAME was causing C++ exception handling test failures in llvm-test-suite. We should unconditionally add this argument like the other drivers do.

Discovered-by: Alexey Karyakin <[email protected]>
Fixes: #129745


Full diff: https://github.com/llvm/llvm-project/pull/130225.diff

3 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Hexagon.cpp (+1)
  • (modified) clang/test/Driver/hexagon-toolchain-elf.c (+1)
  • (modified) clang/test/Driver/hexagon-toolchain-linux.c (+1)
diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
index 7ca5ab9af8810..6ea701a7882d1 100644
--- a/clang/lib/Driver/ToolChains/Hexagon.cpp
+++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -313,6 +313,7 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
                                      // handled somewhere else.
   Args.ClaimAllArgs(options::OPT_static_libgcc);
 
+  CmdArgs.push_back("--eh-frame-hdr");
   //----------------------------------------------------------------------------
   //
   //----------------------------------------------------------------------------
diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c
index be812dda40d57..de2ebfeeda26c 100644
--- a/clang/test/Driver/hexagon-toolchain-elf.c
+++ b/clang/test/Driver/hexagon-toolchain-elf.c
@@ -555,6 +555,7 @@
 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
 // RUN:   -mcpu=hexagonv60 \
 // RUN:   -fuse-ld=lld %s 2>&1 | FileCheck -check-prefix=CHECK382 %s
+// CHECK382:          "--eh-frame-hdr
 // CHECK382-NOT:      "-march=
 // CHECK382-NOT:      "-mcpu=
 // -----------------------------------------------------------------------------
diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c
index 6f7f3b20f9141..e791353cca07f 100644
--- a/clang/test/Driver/hexagon-toolchain-linux.c
+++ b/clang/test/Driver/hexagon-toolchain-linux.c
@@ -127,6 +127,7 @@
 // RUN:    --target=hexagon-unknown-linux-musl %s -### 2>&1 \
 // RUN:    | FileCheck -check-prefix=CHECK011 %s
 // CHECK011:   InstalledDir: [[INSTALLED_DIR:.+]]
+// CHECK011:   "--eh-frame-hdr"
 // CHECK011:   crt1.o
 // CHECK011-NOT:  "-lunwind"
 // CHECK011-NOT:  "-lgcc_eh"

@llvmbot
Copy link
Member

llvmbot commented Mar 7, 2025

@llvm/pr-subscribers-clang-driver

Author: Brian Cain (androm3da)

Changes

The missing PT_GNU_EH_FRAME was causing C++ exception handling test failures in llvm-test-suite. We should unconditionally add this argument like the other drivers do.

Discovered-by: Alexey Karyakin <[email protected]>
Fixes: #129745


Full diff: https://github.com/llvm/llvm-project/pull/130225.diff

3 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Hexagon.cpp (+1)
  • (modified) clang/test/Driver/hexagon-toolchain-elf.c (+1)
  • (modified) clang/test/Driver/hexagon-toolchain-linux.c (+1)
diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
index 7ca5ab9af8810..6ea701a7882d1 100644
--- a/clang/lib/Driver/ToolChains/Hexagon.cpp
+++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -313,6 +313,7 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
                                      // handled somewhere else.
   Args.ClaimAllArgs(options::OPT_static_libgcc);
 
+  CmdArgs.push_back("--eh-frame-hdr");
   //----------------------------------------------------------------------------
   //
   //----------------------------------------------------------------------------
diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c
index be812dda40d57..de2ebfeeda26c 100644
--- a/clang/test/Driver/hexagon-toolchain-elf.c
+++ b/clang/test/Driver/hexagon-toolchain-elf.c
@@ -555,6 +555,7 @@
 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
 // RUN:   -mcpu=hexagonv60 \
 // RUN:   -fuse-ld=lld %s 2>&1 | FileCheck -check-prefix=CHECK382 %s
+// CHECK382:          "--eh-frame-hdr
 // CHECK382-NOT:      "-march=
 // CHECK382-NOT:      "-mcpu=
 // -----------------------------------------------------------------------------
diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c
index 6f7f3b20f9141..e791353cca07f 100644
--- a/clang/test/Driver/hexagon-toolchain-linux.c
+++ b/clang/test/Driver/hexagon-toolchain-linux.c
@@ -127,6 +127,7 @@
 // RUN:    --target=hexagon-unknown-linux-musl %s -### 2>&1 \
 // RUN:    | FileCheck -check-prefix=CHECK011 %s
 // CHECK011:   InstalledDir: [[INSTALLED_DIR:.+]]
+// CHECK011:   "--eh-frame-hdr"
 // CHECK011:   crt1.o
 // CHECK011-NOT:  "-lunwind"
 // CHECK011-NOT:  "-lgcc_eh"

@androm3da androm3da requested a review from iajbar March 8, 2025 17:44
@androm3da androm3da merged commit 6657769 into llvm:main Mar 10, 2025
15 checks passed
swift-ci pushed a commit to swiftlang/llvm-project that referenced this pull request Mar 27, 2025
The missing `PT_GNU_EH_FRAME` was causing C++ exception handling test
failures in llvm-test-suite. We should unconditionally add this argument
like the other drivers do.

Discovered-by: Alexey Karyakin <[email protected]>
Fixes: llvm#129745
(cherry picked from commit 6657769)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:Hexagon clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Several C++ EH tests fail with "terminating due to uncaught exception of type int"
3 participants