Patch for ICF string inline bug for SHT_REL sections.

Ian Lance Taylor iant@google.com
Wed Jul 28 20:37:00 GMT 2010


Sriraman Tallam <tmsriram@google.com> writes:

> +                      case 1:
> +                        {
> +                          reloc_addend_value =
> +                            *(reinterpret_cast<const uint8_t*>(reloc_addend_ptr));
> +			  break;
> +                        }
> +                      case 2:
> +                        {
> +                          reloc_addend_value =
> +                            *(reinterpret_cast<const uint16_t*>(reloc_addend_ptr));
> +			  break;
> +                        }
> +                      case 4:
> +                        {
> +                          reloc_addend_value =
> +                            *(reinterpret_cast<const uint32_t*>(reloc_addend_ptr));
> +			  break;

You can't use these reinterpret_casts.  In general the addend need not
be aligned, and this will crash when running on a strict alignment host
like SPARC.  Without some knowledge that the addend is aligned, you need
to use Swap_unaligned.  It may be easiest to use read_from_pointer from
int_encoding.h.

Sorry for the long delay.

Ian



More information about the Binutils mailing list