PATCH: Sign extend relocation result to 64bit for R_X86_64_DTPOFF64/R_X86_64_TPOFF64

Roland McGrath roland@hack.frob.com
Tue May 8 22:55:00 GMT 2012


> https://sites.google.com/site/x32abi/documents
> 
> most of relocations in x32 are applied to 32bit fields.  

OK.

> > Then it can be just:
> >
> >        *reloc_addr = (Elf64_Sxword) (Elf32_Sword) value;
> 
> Not all relocations use this computation.  I don't think we
> should compute a value which is only used by a few relocations.

Sorry I was not clear.  I just meant a local temporary in those cases to
avoid having the same calculation on both forks of the #if, not anything
superfluous.

> > But it needs a comment saying why this particular reloc type gets sign
> > extension when all the others get zero extension.
> >
> 
> Here is the updated patch with comments.  OK for trunk?

Never say "64bit", always "64-bit" if an adjective.

The comments are too terse.  Say something like:

This relocation type computes a signed offset that is usually negative.
The symbol and addend values are 32 bits but the GOT entry is 64 bits wide
and the whole 64-bit entry is used as a signed quantity, so we need to
sign-extend the computed value to 64 bits.


Thanks,
Roland



More information about the Libc-alpha mailing list