If you have a 64-bit executable with a section whose address starts at higher than 0xffffffff, the output of a 32-bit size program that targets 64-bit executables will be wrong:
$ cat test.c void _start() { } $ gcc -nostdlib -fPIC -ffreestanding test.c -Wl,-Ttext,0x100000000 $ x86_64-linux-size -Ax a.out a.out : section size addr .text 0x6 0x0 .eh_frame_hdr 0x14 0x8 .eh_frame 0x38 0x20 .comment 0x1d 0x0 Total 0x6f The expected output is: $ size -Ax a.out a.out : section size addr .text 0x6 0x100000000 .eh_frame_hdr 0x14 0x100000008 .eh_frame 0x38 0x100000020 .comment 0x1d 0x0 Total 0x6f I think this patch should fix it: Index: binutils/size.c =================================================================== RCS file: /cvs/src/src/binutils/size.c,v retrieving revision 1.30 diff -u -r1.30 size.c --- binutils/size.c 5 Jul 2007 16:54:45 -0000 1.30 +++ binutils/size.c 26 Jul 2008 20:29:51 -0000 @@ -408,15 +408,21 @@ /* This is what lexical functions are for. */ +#if BFD_HOST_64BIT_LONG_LONG +#define FMT "ll" +#else +#define FMT "l" +#endif + static int size_number (bfd_size_type num) { char buffer[40]; sprintf (buffer, - (radix == decimal ? "%lu" : - ((radix == octal) ? "0%lo" : "0x%lx")), - (unsigned long) num); + (radix == decimal ? "%"FMT"u" : + ((radix == octal) ? "0%"FMT"o" : "0x%"FMT"x")), + num); return strlen (buffer); } @@ -427,9 +433,9 @@ char buffer[40]; sprintf (buffer, - (radix == decimal ? "%lu" : - ((radix == octal) ? "0%lo" : "0x%lx")), - (unsigned long) num); + (radix == decimal ? "%"FMT"u" : + ((radix == octal) ? "0%"FMT"o" : "0x%"FMT"x")), + num); printf ("%*s", width, buffer); } -- Summary: size output is wrong for "addr" column for 64-bit executable Product: binutils Version: 2.19 (HEAD) Status: NEW Severity: normal Priority: P2 Component: binutils AssignedTo: unassigned at sources dot redhat dot com ReportedBy: zhirsch at umich dot edu CC: bug-binutils at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=6769 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils