R_SPARC_RELATIVE vs R_SPARC_UA32 & unaligned unwind tables - again

Ian Lance Taylor ian@airs.com
Tue Dec 18 18:51:00 GMT 2001


DJ Delorie <dj@redhat.com> writes:

> Ok, I seem to have bumped into a "this just isn't possible" scenario.
> 
> We create unaligned 32-bit pointers in unwind tables (specifically,
> in the augmentation fields for context->lsda in gcc/unwind-dw2.c).
> 
> If these pointers are in a shared library, the dynamic linker needs to
> adjust them according to where the shared library is loaded.
> 
> However, the only reloc available for that is R_SPARC_RELATIVE, and it
> requires aligned data.  If you try to use it with unaligned data,
> ld.so aborts.  If you don't use it, unwinding causes aborts because
> the pointer points to the wrong place.
> 
> Could we make that pointer fde-relative or something, so that ld.so
> doesn't need to adjust it?  Or make it aligned?  I can't think of any
> other fix, unless there's some other R_SPARC_* reloc that does what's
> needed here.

R_SPARC_RELATIVE is an optimization which skips the symbol lookup.  It
seems to me that you can always use an R_SPARC_UA32 reloc against an
offset from a section, or at the very least you could do that against
a symbol.

Ian



More information about the Binutils mailing list