On Mon, Jun 27, 2011 at 7:58 AM, Jason Merrill wrote: > On 06/26/2011 05:58 PM, H.J. Lu wrote: >> >> The current unwind library scheme provides only one unwind >> context and is backward compatible with multiple different unwind >> contexts from multiple unwind libraries: >> >> http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01769.html >> >> My patch fixes UNITS_PER_WORD > sizeof (void *) and >> enforces single unwind context when backward compatibility >> isn't needed. > > OK, there seem to be two things going on in this patch: > > 1) Handle registers larger than pointers. > 2) Require that all code share a single copy of the unwinder. > > For #2, how are you avoiding the issues Jakub describes in that message? >  Isn't his scenario 2 still possible?  Are you deciding that it's better to > abort at run-time in that case? > > It seems to me that for targets newer than Jakub's patch we can hard-wire > _Unwind_IsExtendedContext to true, but making further assumptions would be a > mistake. > > Then, if we're still trying to handle versioning, I think your earlier patch > for #1 (r170716) that just changes the type of the reg array is a better way > to go.  But that change should be dependent on a target macro to avoid ABI > changes for existing targets. > This updated patch. It allows multiple unwind contexts. It replaces char by_value[DWARF_FRAME_REGISTERS+1]; with _Unwind_Word value[DWARF_FRAME_REGISTERS+1]; The code is cleaner than conditionally replacing void *reg[DWARF_FRAME_REGISTERS+1]; with _Unwind_Word reg[DWARF_FRAME_REGISTERS+1]; with a bigger unwind context. But it is more flexible if we want to extend unwind context later, like saving/restoring 128bit or vector registers which may be bigger than the current _Unwind_Word. Thanks. -- H.J. ---- gcc/ 2011-06-28 H.J. Lu * config.gcc (libgcc_tm_file): Add i386/value-unwind.h for Linux/x86. * system.h (REG_VALUE_IN_UNWIND_CONTEXT): Poisoned. * unwind-dw2.c (_Unwind_Context): If REG_VALUE_IN_UNWIND_CONTEXT is defined, add value and remove by_value. (SIGNAL_FRAME_BIT): Define if REG_VALUE_IN_UNWIND_CONTEXT is defined. (EXTENDED_CONTEXT_BIT): Don't define if REG_VALUE_IN_UNWIND_CONTEXT is defined. (_Unwind_IsExtendedContext): Likewise. (_Unwind_GetGR): Support REG_VALUE_IN_UNWIND_CONTEXT. (_Unwind_SetGR): Likewise. (_Unwind_GetGRPtr): Likewise. (_Unwind_SetGRPtr): Likewise. (_Unwind_SetGRValue): Likewise. (_Unwind_GRByValue): Likewise. (__frame_state_for): Likewise. (uw_install_context_1): Likewise. * doc/tm.texi.in: Document REG_VALUE_IN_UNWIND_CONTEXT. * doc/tm.texi: Regenerated. libgcc/ 2011-06-28 H.J. Lu * config/i386/value-unwind.h: New.