bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/797] Alignment in empty section changes the output layout


From: hjl at lucon dot org
Subject: [Bug ld/797] Alignment in empty section changes the output layout
Date: 22 Mar 2005 17:28:49 -0000

------- Additional Comments From hjl at lucon dot org  2005-03-22 17:28 -------
Created an attachment (id=441)
 --> (http://sources.redhat.com/bugzilla/attachment.cgi?id=441&action=view)
A testcase

address@hidden empty-4]$ make
as -o foo.o foo.s
./ld -shared -o normal.so -T normal.x foo.o
./ld -shared -o align.so -T align.x foo.o
readelf -lS normal.so
There are 11 section headers, starting at offset 0x1154:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al  [ 0]                   NULL            00000000 000000 000000 00      0   0
 0  [ 1] .text             PROGBITS        00000000 001000 000004 00  AX  0   0
 4  [ 2] .dynsym           DYNSYM          00000004 001004 000060 10   A  3   3
 4  [ 3] .dynstr           STRTAB          00000064 001064 00000a 00   A  0   0
 1  [ 4] .hash             HASH            00000070 001070 00002c 04   A  2   0
 4  [ 5] .data             PROGBITS        0000009c 00109c 000004 00  WA  0   0
 4  [ 6] .dynamic          DYNAMIC         000000a0 0010a0 000058 08  WA  3   0
 4  [ 7] .got.plt          PROGBITS        000000f8 0010f8 00000c 04  WA  0   0
 4  [ 8] .shstrtab         STRTAB          00000000 001104 00004f 00      0   0
 1  [ 9] .symtab           SYMTAB          00000000 00130c 0000d0 10     10  12
 4  [10] .strtab           STRTAB          00000000 0013dc 000020 00      0   0
 1Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 2 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00000000 0x00000000 0x00104 0x00104 RWE 0x1000
  DYNAMIC        0x0010a0 0x000000a0 0x000000a0 0x00058 0x00058 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00     .text .dynsym .dynstr .hash .data .dynamic .got.plt
   01     .dynamic
readelf -lS align.so
There are 12 section headers, starting at offset 0x20c0:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al  [ 0]                   NULL            00000000 000000 000000 00      0   0
 0  [ 1] .text             PROGBITS        00000000 001000 000004 00  AX  0   0
 4  [ 2] .dynsym           DYNSYM          00000004 001004 000060 10   A  3   3
 4  [ 3] .dynstr           STRTAB          00000064 001064 00000a 00   A  0   0
 1  [ 4] .hash             HASH            00000070 001070 00002c 04   A  2   0
 4  [ 5] .text2            NOBITS          0000009c 00109c 000f64 00  WA  0   0
 1  [ 6] .data             PROGBITS        00001000 002000 000004 00  WA  0   0
 4  [ 7] .dynamic          DYNAMIC         00001004 002004 000058 08  WA  3   0
 4  [ 8] .got.plt          PROGBITS        0000105c 00205c 00000c 04  WA  0   0
 4  [ 9] .shstrtab         STRTAB          00000000 002068 000056 00      0   0
 1  [10] .symtab           SYMTAB          00000000 0022a0 0000e0 10     11  13
 4  [11] .strtab           STRTAB          00000000 002380 000020 00      0   0
 1Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 3 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00000000 0x00000000 0x0009c 0x01000 RWE 0x1000
  LOAD           0x002000 0x00001000 0x00001000 0x00068 0x00068 RW  0x1000
  DYNAMIC        0x002004 0x00001004 0x00001004 0x00058 0x00058 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00     .text .dynsym .dynstr .hash .text2
   01     .data .dynamic .got.plt
   02     .dynamic

Shouldn't linker totally remove .text2 and .text3 sections as if they aren't
in the linker script?


-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=797

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]