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 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:

dwarf.c:  snprintf (buff, sizeof (buff), "%16.16llx ", val);
nm.c:static char value_format_64bit[] = "%016llx";
prdbg.c:	sprintf (buf, "0x%llx", (unsigned long long) vma);
readelf.c:		  ? "%16.16llx  %16.16llx "
readelf.c:		  : "%12.12llx  %12.12llx ",
strings.c:	        printf ("%7llx ", (unsigned long long) start);

print_vma will fail many tests due to leading 0s.


-- 
H.J.


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