diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2024-01-11 21:12:56 +0000 |
---|---|---|
committer | Sandra Loosemore <sandra@codesourcery.com> | 2024-01-12 04:50:22 +0000 |
commit | cc9cac9f073a9517f5b7fcffcb7c28b166339491 (patch) | |
tree | f052e786014ac1587dbaa0a5a7240c09cdd1fa0a /libgcc | |
parent | 75ed46558a2e085ba12641a47112e37f114faee0 (diff) | |
download | gcc-cc9cac9f073a9517f5b7fcffcb7c28b166339491.zip gcc-cc9cac9f073a9517f5b7fcffcb7c28b166339491.tar.gz gcc-cc9cac9f073a9517f5b7fcffcb7c28b166339491.tar.bz2 |
libgcc, nios2: Fix exception handling on nios2 with -fpic
Exception handling on nios2-linux-gnu with -fpic has been broken since
revision 790854ea7670f11c14d431c102a49181d2915965, "Use _dl_find_object
in _Unwind_Find_FDE". For whatever reason, this doesn't work on nios2.
Nios2 uses the GOT address as the base for DW_EH_PE_datarel
relocations in PIC; see my previous fix to make this work, revision
2d33dcfe9f0494c9b56a8d704c3d27c5a4329ebc, "Support for GOT-relative
DW_EH_PE_datarel encoding". So this may be a horrible bug in the ABI
or in my interpretation of it or just glibc's implementation of
_dl_find_object for this target, but there's existing code out there
that does things this way; and realistically, nobody is going to
re-engineer this now that the vendor has EOL'ed the nios2
architecture. So, just skip over the code trying to use
_dl_find_object on this target and fall back to the way that works.
I plan to backport this patch to the GCC 12 and GCC 13 branches as well.
libgcc/ChangeLog
* unwind-dw2-fde-dip.c (_Unwind_Find_FDE): Do not try to use
_dl_find_object on nios2; it doesn't work.
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/unwind-dw2-fde-dip.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c index 2f2ca35..57d0c881 100644 --- a/libgcc/unwind-dw2-fde-dip.c +++ b/libgcc/unwind-dw2-fde-dip.c @@ -543,8 +543,9 @@ _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases) return ret; /* Use DLFO_STRUCT_HAS_EH_DBASE as a proxy for the existence of a glibc-style - _dl_find_object function. */ -#ifdef DLFO_STRUCT_HAS_EH_DBASE + _dl_find_object function. However, do not use _dl_find_object on nios2, + which uses the GOT address as the base for DW_EH_PE_datarel instead. */ +#if defined(DLFO_STRUCT_HAS_EH_DBASE) && !defined(__nios2__) { struct dl_find_object dlfo; if (_dl_find_object (pc, &dlfo) == 0 && dlfo.dlfo_eh_frame != NULL) |