On Wed, Nov 03, 2021 at 05:28:55PM +0100, Florian Weimer wrote: > --- a/libgcc/unwind-dw2-fde-dip.c > +++ b/libgcc/unwind-dw2-fde-dip.c > @@ -129,6 +129,30 @@ unw_eh_callback_data_dbase (const struct > unw_eh_callback_data *data > #endif > } > > +#ifdef DL_FIND_EH_FRAME_DBASE > +#if DL_FIND_EH_FRAME_DBASE != NEED_DBASE_MEMBER > +#error "DL_FIND_EH_FRAME_DBASE != NEED_DBASE_MEMBER"
Instead of #error just don't define USE_DL_FIND_EH_FRAME? I.e. #ifdef DL_FIND_EH_FRAME_DBASE #if DL_FIND_EH_FRAME_DBASE == NEED_DBASE_MEMBER > +#define USE_DL_FIND_EH_FRAME 1 > +#define DL_FIND_EH_FRAME_CONDITION 1 > +#endif ? Is it a good idea to have different arguments of the function for i386/nios2/frv/bfind vs. the rest, wouldn't just always passing void **__dbase argument be cleaner? Internally it is fine to differentiate based on NEED_DBASE_MEMBER, but doing that on a public interface? > +/* Fallback declaration for old glibc headers. DL_FIND_EH_FRAME_DBASE is > used > + as a proxy to determine if <dlfcn.h> declares _dl_find_eh_frame. */ > +#if defined __GLIBC__ && !defined DL_FIND_EH_FRAME_DBASE > +#if NEED_DBASE_MEMBER > +void *_dl_find_eh_frame (void *__pc, void **__dbase) __attribute__ ((weak)); > +#else > +void *_dl_find_eh_frame (void *__pc) __attribute__ ((weak)); > +#endif > +#define USE_DL_FIND_EH_FRAME 1 > +#define DL_FIND_EH_FRAME_CONDITION (_dl_find_eh_frame != NULL) > +#endif I'd prefer not to do this. If we find glibc with the support in the headers, let's use it, otherwise let's keep using what we were doing before. > +#if NEED_DBASE_MEMBER > + eh_frame = _dl_find_eh_frame (pc, &dbase); > +#else > + dbase = NULL; > + eh_frame = _dl_find_eh_frame (pc); > +#endif > + if (eh_frame == NULL) > + return NULL; > + > + struct find_fde_tail_result result > + = find_fde_tail ((_Unwind_Ptr) pc, eh_frame, (_Unwind_Ptr) dbase); > + if (result.entry != NULL) > + { > + bases->tbase = NULL; > + bases->dbase = (void *) dbase; > + bases->func = result.func; > + } > + return result.entry; > + } > +#endif > + > data.pc = (_Unwind_Ptr) pc; > #if NEED_DBASE_MEMBER > data.dbase = NULL; > -- > 2.31.1 Otherwise LGTM. Jakub