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: Properly dump addend in readelf


On Sat, Oct 2, 2010 at 10:22 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Sat, 2 Oct 2010, H.J. Lu wrote:
>
>> On Sat, Oct 2, 2010 at 5:17 AM, Joseph S. Myers <joseph@codesourcery.com> wrote:
>> > On Fri, 1 Oct 2010, H.J. Lu wrote:
>> >
>> >> ? ? ? ? ? ? ? ? if (off < 0)
>> >> - ? ? ? ? ? ? ? ? printf (" - %lx", - off);
>> >> + ? ? ? ? ? ? ? ? printf (" - %llx", - off);
>> >> ? ? ? ? ? ? ? ? else
>> >> - ? ? ? ? ? ? ? ? printf (" + %lx", off);
>> >> + ? ? ? ? ? ? ? ? printf (" + %llx", off);
>> >
>> > Use of %ll formats isn't portable across hosts; MinGW needs %I64. ?See
>> > BFD_VMA_FMT in bfd-in.h, for example, or print_vma in binutils/prdbg.c.
>> >
>>
>>
>> BFD_VMA_FMT doesn't always work with long long. llx has been used:
>
> I was giving examples of how this can be done portably.
>

Here is a new patch. It also fixed potential problem with 32bit ELF
and 64bit VMA:

	      aux->table[i].start.offset  = rp->r_addend + sym->st_value;
	      aux->table[i].end.offset    = rp->r_addend + sym->st_value;
	      aux->table[i].info.offset   = rp->r_addend + sym->st_value;
	      aux->table[i].start.offset  = sym->st_value + rp->r_addend;
	      aux->table[i].end.offset    = sym->st_value + rp->r_addend;
	    addend += rp->r_addend;

OK to install?

Thanks.


-- 
H.J.
----
2010-10-02  H.J. Lu  <hongjiu.lu@intel.com>

	* readelf.c (slurp_rela_relocs): Properly convert r_addend.
	(dump_relocations): Properly dump r_addend.

Attachment: binutils-addend-2.patch
Description: Text document


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