Bug 3402

Summary: linker produces very large executable.
Product: binutils Reporter: Pawel Sikora <pluto>
Component: ldAssignee: unassigned
Status: RESOLVED DUPLICATE    
Severity: normal CC: bug-binutils
Priority: P2    
Version: 2.17   
Target Milestone: ---   
Host: Target: x86_64-linux
Build: Last reconfirmed:
Attachments: testcase
64-bit object.
compressed exec.

Description Pawel Sikora 2006-10-20 06:33:31 UTC
as you can see, the 32-bit output (object and executable)
looks reasonable, but 64-bit executable size looks weird.

$ g++ print-bind.cpp -o print-bind -O1 --save-temps -s -m32
$ ls -la print-bind*
   9908 2006-10-20 08:27 print-bind
    493 2006-10-20 08:25 print-bind.cpp
1662558 2006-10-20 08:27 print-bind.ii
   6004 2006-10-20 08:27 print-bind.o
  22581 2006-10-20 08:27 print-bind.s
$ objdump -wh print-bind

print-bind:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn  Flags
  0 .interp       00000013  08048154  08048154  00000154  2**0  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  08048168  08048168  00000168  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
  2 .hash         00000094  08048188  08048188  00000188  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
  3 .dynsym       00000120  0804821c  0804821c  0000021c  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
  4 .dynstr       0000019e  0804833c  0804833c  0000033c  2**0  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
  5 .gnu.version  00000024  080484da  080484da  000004da  2**1  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
  6 .gnu.version_r 00000070  08048500  08048500  00000500  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
  7 .rel.dyn      00000010  08048570  08048570  00000570  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
  8 .rel.plt      00000070  08048580  08048580  00000580  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
  9 .init         00000017  080485f0  080485f0  000005f0  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, CODE
 10 .plt          000000f0  08048608  08048608  00000608  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, CODE
 11 .text         00000678  08048700  08048700  00000700  2**4  CONTENTS, 
ALLOC, LOAD, READONLY, CODE
 12 .fini         0000001c  08048d78  08048d78  00000d78  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, CODE
 13 .rodata       0000002c  08048d94  08048d94  00000d94  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
 14 .eh_frame_hdr 00000034  08048dc0  08048dc0  00000dc0  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
 15 .eh_frame     000000dc  08048df4  08048df4  00000df4  2**2  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
 16 .gcc_except_table 00000070  08048ed0  08048ed0  00000ed0  2**0  CONTENTS, 
ALLOC, LOAD, READONLY, DATA
 17 .init_array   00000000  08049000  08049000  00002000  2**0  CONTENTS, 
ALLOC, LOAD, DATA
 18 .ctors        00000008  08049000  08049000  00001000  2**2  CONTENTS, 
ALLOC, LOAD, DATA
 19 .dtors        00000008  08049008  08049008  00001008  2**2  CONTENTS, 
ALLOC, LOAD, DATA
 20 .jcr          00000004  08049010  08049010  00001010  2**2  CONTENTS, 
ALLOC, LOAD, DATA
 21 .dynamic      000000e0  08049014  08049014  00001014  2**2  CONTENTS, 
ALLOC, LOAD, DATA
 22 .got          00000004  080490f4  080490f4  000010f4  2**2  CONTENTS, 
ALLOC, LOAD, DATA
 23 .got.plt      00000044  080490f8  080490f8  000010f8  2**2  CONTENTS, 
ALLOC, LOAD, DATA
 24 .data         0000000c  0804913c  0804913c  0000113c  2**2  CONTENTS, 
ALLOC, LOAD, DATA
 25 .bss          00000020  08049148  08049148  00001148  2**3  ALLOC
 26 .comment      00000138  00000000  00000000  00002000  2**0  CONTENTS, 
READONLY


$ g++ print-bind.cpp -o print-bind -O1 --save-temps -s -m64
$ ls -la print-bind*
2104216 2006-10-20 08:29 print-bind
    493 2006-10-20 08:25 print-bind.cpp
1662139 2006-10-20 08:29 print-bind.ii
   7944 2006-10-20 08:29 print-bind.o
  21419 2006-10-20 08:29 print-bind.s
$ objdump -wh print-bind

print-bind:     file format elf64-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off  Algn  
Flags
  0 .interp       0000001c  0000000000400238  0000000000400238  00000238  2**0  
CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  0000000000400254  0000000000400254  00000254  2**2  
CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .hash         00000058  0000000000400278  0000000000400278  00000278  2**3  
CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .dynsym       00000198  00000000004002d0  00000000004002d0  000002d0  2**3  
CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynstr       00000191  0000000000400468  0000000000400468  00000468  2**0  
CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .gnu.version  00000022  00000000004005fa  00000000004005fa  000005fa  2**1  
CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version_r 00000070  0000000000400620  0000000000400620  00000620  
2**3  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .rela.dyn     00000030  0000000000400690  0000000000400690  00000690  2**3  
CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rela.plt     00000138  00000000004006c0  00000000004006c0  000006c0  2**3  
CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .init         00000018  00000000004007f8  00000000004007f8  000007f8  2**2  
CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .plt          000000e0  0000000000400810  0000000000400810  00000810  2**2  
CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .text         000006e8  00000000004008f0  00000000004008f0  000008f0  2**4  
CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .fini         0000000e  0000000000400fd8  0000000000400fd8  00000fd8  2**2  
CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .rodata       00000028  0000000000400fe8  0000000000400fe8  00000fe8  2**2  
CONTENTS, ALLOC, LOAD, READONLY, DATA
 14 .eh_frame_hdr 0000004c  0000000000401010  0000000000401010  00001010  2**2  
CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 .eh_frame     00000154  0000000000401060  0000000000401060  00001060  2**3  
CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .gcc_except_table 00000070  00000000004011b4  00000000004011b4  000011b4  
2**0  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .init_array   00000000  0000000000601224  0000000000601224  00201224  2**0  
CONTENTS, ALLOC, LOAD, DATA
 18 .ctors        00000010  0000000000601228  0000000000601228  00001228  2**3  
CONTENTS, ALLOC, LOAD, DATA
 19 .dtors        00000010  0000000000601238  0000000000601238  00001238  2**3  
CONTENTS, ALLOC, LOAD, DATA
 20 .jcr          00000008  0000000000601248  0000000000601248  00001248  2**3  
CONTENTS, ALLOC, LOAD, DATA
 21 .dynamic      000001c0  0000000000601250  0000000000601250  00001250  2**3  
CONTENTS, ALLOC, LOAD, DATA
 22 .got          00000008  0000000000601410  0000000000601410  00001410  2**3  
CONTENTS, ALLOC, LOAD, DATA
 23 .got.plt      00000080  0000000000601418  0000000000601418  00001418  2**3  
CONTENTS, ALLOC, LOAD, DATA
 24 .data         00000018  0000000000601498  0000000000601498  00001498  2**3  
CONTENTS, ALLOC, LOAD, DATA
 25 .bss          00000030  00000000006014b0  00000000006014b0  000014b0  2**4  
ALLOC
 26 .comment      00000138  0000000000000000  0000000000000000  00201224  2**0  
CONTENTS, READONLY
Comment 1 Pawel Sikora 2006-10-20 06:34:04 UTC
Created attachment 1380 [details]
testcase
Comment 2 Pawel Sikora 2006-10-20 06:34:48 UTC
Created attachment 1381 [details]
64-bit object.
Comment 3 Pawel Sikora 2006-10-20 06:42:51 UTC
Created attachment 1382 [details]
compressed exec.
Comment 4 H.J. Lu 2006-10-20 13:56:30 UTC

*** This bug has been marked as a duplicate of 3314 ***