This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for ICF string inline bug for SHT_REL sections.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]