PATCH: Properly dump addend in readelf
H.J. Lu
hjl.tools@gmail.com
Sat Oct 2 12:46:00 GMT 2010
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.
More information about the Binutils
mailing list