https://gcc.gnu.org/g:ae9cb9fc18992c8c505d46c28b3c493ac7d7fbde

commit ae9cb9fc18992c8c505d46c28b3c493ac7d7fbde
Author: Thomas Schwinge <tschwi...@baylibre.com>
Date:   Tue Mar 18 10:10:30 2025 +0100

    GCN, nvptx: Define '_Unwind_RaiseException', '_Unwind_Resume_or_Rethrow'
    
    This resolves GCN:
    
        ld: error: undefined symbol: _Unwind_RaiseException
        >>> referenced by eh_throw.cc:93 
([...]/source-gcc/libstdc++-v3/libsupc++/eh_throw.cc:93)
        >>>               eh_throw.o:(__cxa_throw) in archive 
/srv/data/tschwinge/amd-instinct2/gcc/build/submit-light-target_gcn/build-gcc/amdgcn-amdhsa/gfx908/libstdc++-v3/src/.libs/libstdc++.a
        [...]
        collect2: error: ld returned 1 exit status
    
    ..., and/or:
    
        ld: error: undefined symbol: _Unwind_Resume_or_Rethrow
        >>> referenced by eh_throw.cc:129 
([...]/source-gcc/libstdc++-v3/libsupc++/eh_throw.cc:129)
        >>>               eh_throw.o:(__cxa_rethrow) in archive 
/srv/data/tschwinge/amd-instinct2/gcc/build/submit-light-target_gcn/build-gcc/amdgcn-amdhsa/gfx908/libstdc++-v3/src/.libs/libstdc++.a
        [...]
        collect2: error: ld returned 1 exit status
    
    ..., and nvptx:
    
        unresolved symbol _Unwind_RaiseException
        collect2: error: ld returned 1 exit status
    
    ..., or:
    
        unresolved symbol _Unwind_Resume_or_Rethrow
        collect2: error: ld returned 1 exit status
    
    For both GCN, nvptx, this each progresses ~25 'check-gcc-c++',
    and ~10 'check-target-libstdc++-v3' test cases:
    
        [-FAIL:-]{+PASS:+} [...] (test for excess errors)
    
    ..., with (if applicable, for most of them):
    
        [-UNRESOLVED:-]{+PASS:+} [...] [-compilation failed to produce 
executable-]{+execution test+}
    
    ..., or some 'FAIL: [...] execution test' where these test cases now FAIL 
when
    attempting to use these interfaces, or, if applicable, FAIL due to run-time
    'GCC/nvptx: sorry, unimplemented: dynamic stack allocation not supported'.
    
            libgcc/
            * config/gcn/unwind-gcn.c (_Unwind_RaiseException)
            (_Unwind_Resume_or_Rethrow): New.
            * config/nvptx/unwind-nvptx.c (_Unwind_RaiseException)
            (_Unwind_Resume_or_Rethrow): Likewise.
    
    (cherry picked from commit 54ab0f6785c006ddff056dab9c0240cddae82020)

Diff:
---
 libgcc/ChangeLog.omp               |  8 ++++++++
 libgcc/config/gcn/unwind-gcn.c     | 14 ++++++++++++++
 libgcc/config/nvptx/unwind-nvptx.c | 14 ++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/libgcc/ChangeLog.omp b/libgcc/ChangeLog.omp
index 2683de6b8249..c4efc083b53d 100644
--- a/libgcc/ChangeLog.omp
+++ b/libgcc/ChangeLog.omp
@@ -3,6 +3,14 @@
        Backported from trunk:
        2025-04-08  Thomas Schwinge  <tschwi...@baylibre.com>
 
+       * config/gcn/unwind-gcn.c (_Unwind_RaiseException)
+       (_Unwind_Resume_or_Rethrow): New.
+       * config/nvptx/unwind-nvptx.c (_Unwind_RaiseException)
+       (_Unwind_Resume_or_Rethrow): Likewise.
+
+       Backported from trunk:
+       2025-04-08  Thomas Schwinge  <tschwi...@baylibre.com>
+
        * config/gcn/unwind-gcn.c (_Unwind_DeleteException): New.
        * config/nvptx/unwind-nvptx.c (_Unwind_DeleteException): Likewise.
 
diff --git a/libgcc/config/gcn/unwind-gcn.c b/libgcc/config/gcn/unwind-gcn.c
index 2ee389b19533..d229417866fa 100644
--- a/libgcc/config/gcn/unwind-gcn.c
+++ b/libgcc/config/gcn/unwind-gcn.c
@@ -24,6 +24,13 @@
 
 #include "unwind.h"
 
+_Unwind_Reason_Code
+_Unwind_RaiseException(struct _Unwind_Exception *exc __attribute__ 
((__unused__)))
+{
+  __builtin_abort ();
+  return 0;
+}
+
 void
 _Unwind_DeleteException (struct _Unwind_Exception *exc)
 {
@@ -31,6 +38,13 @@ _Unwind_DeleteException (struct _Unwind_Exception *exc)
     (*exc->exception_cleanup) (_URC_FOREIGN_EXCEPTION_CAUGHT, exc);
 }
 
+_Unwind_Reason_Code
+_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc __attribute__ 
((__unused__)))
+{
+  __builtin_abort ();
+  return 0;
+}
+
 _Unwind_Reason_Code
 _Unwind_Backtrace(_Unwind_Trace_Fn trace, void * trace_argument)
 {
diff --git a/libgcc/config/nvptx/unwind-nvptx.c 
b/libgcc/config/nvptx/unwind-nvptx.c
index 2ee389b19533..d229417866fa 100644
--- a/libgcc/config/nvptx/unwind-nvptx.c
+++ b/libgcc/config/nvptx/unwind-nvptx.c
@@ -24,6 +24,13 @@
 
 #include "unwind.h"
 
+_Unwind_Reason_Code
+_Unwind_RaiseException(struct _Unwind_Exception *exc __attribute__ 
((__unused__)))
+{
+  __builtin_abort ();
+  return 0;
+}
+
 void
 _Unwind_DeleteException (struct _Unwind_Exception *exc)
 {
@@ -31,6 +38,13 @@ _Unwind_DeleteException (struct _Unwind_Exception *exc)
     (*exc->exception_cleanup) (_URC_FOREIGN_EXCEPTION_CAUGHT, exc);
 }
 
+_Unwind_Reason_Code
+_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc __attribute__ 
((__unused__)))
+{
+  __builtin_abort ();
+  return 0;
+}
+
 _Unwind_Reason_Code
 _Unwind_Backtrace(_Unwind_Trace_Fn trace, void * trace_argument)
 {

Reply via email to