[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/5522] Section contents partially overwritten with zero
From: |
hjl at lucon dot org |
Subject: |
[Bug ld/5522] Section contents partially overwritten with zero |
Date: |
27 Dec 2007 01:12:17 -0000 |
------- Additional Comments From hjl at lucon dot org 2007-12-27 01:12 -------
There are
/* An instruction to the linker to not output the section
even if it has information which would normally be written. */
#define SEC_NEVER_LOAD 0x200
`NOLOAD'
The section should be marked as not loadable, so that it will not
be loaded into memory when the program is run.
case noload_section:
flags &= ~SEC_LOAD;
flags |= SEC_NEVER_LOAD;
What happens when an output section is marked as NOLOAD? From the linker
manual, it seems implies that the output section won't be loaded into
memory, but may still occupy space in file. But linker comments say that
the output section is ignored. But we got
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00400090 000090 00058c 00 AX 0 0 16
[ 2] .bs.required PROGBITS 0040061c 00061c 000004 00 0 0 1
[ 3] .bs.server.name PROGBITS 00400620 000620 00000e 00 W 0 0 1
[ 4] .bs.server.servic PROGBITS 0040062e 00062e 000017 00 W 0 0 1
[ 5] .rodata NOBITS 00400645 00061c 000003 00 WA 0 0 1
[ 6] .trampoline PROGBITS 00401000 000645 0004c0 00 X 0 0 1
[ 7] .data.server NOBITS 00400648 00061c 00000c 00 WA 0 0 1
[ 8] .stab PROGBITS 00000000 000b08 0018b4 0c 9 0 4
[ 9] .stabstr STRTAB 00000000 0023bc 007404 00 0 0 1
[10] .shstrtab STRTAB 00000000 0097c0 000081 00 0 0 1
[11] .symtab SYMTAB 00000000 009a4c 001da0 10 12 419 4
[12] .strtab STRTAB 00000000 00b7ec 000ed0 00 0 0 1
./ld-next -m elf_i386 -o next -T bss.lds attention.o libbss.a
objdump -s -j .bs.server.name attention.o
attention.o: file format elf32-i386
Contents of section .bs.server.name:
0000 41747465 6e74696f 6e536967 6e00 AttentionSign.
objdump -s -j .bs.server.name next
next: file format elf32-i386
Contents of section .bs.server.name:
400620 00000000 00000000 6e536967 6e00 ........nSign.
objdump -s -j .data.server attention.o
attention.o: file format elf32-i386
Contents of section .data.server:
0000 00000000 00000000 00000000 ............
That is linker writes out the .data.server section marked with SHT_NOBITS
and overrides the next section.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=5522
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug ld/5522] Section contents partially overwritten with zero, (continued)
- [Bug ld/5522] Section contents partially overwritten with zero, SebastianR at gmx dot de, 2007/12/24
- [Bug ld/5522] Section contents partially overwritten with zero, SebastianR at gmx dot de, 2007/12/24
- [Bug ld/5522] Section contents partially overwritten with zero, SebastianR at gmx dot de, 2007/12/24
- [Bug ld/5522] Section contents partially overwritten with zero, SebastianR at gmx dot de, 2007/12/24
- [Bug ld/5522] Section contents partially overwritten with zero, hjl at lucon dot org, 2007/12/25
- [Bug ld/5522] Section contents partially overwritten with zero, SebastianR at gmx dot de, 2007/12/26
- [Bug ld/5522] Section contents partially overwritten with zero, hjl at lucon dot org, 2007/12/26
- [Bug ld/5522] Section contents partially overwritten with zero, hjl at lucon dot org, 2007/12/26
- [Bug ld/5522] Section contents partially overwritten with zero, SebastianR at gmx dot de, 2007/12/26
- [Bug ld/5522] Section contents partially overwritten with zero, hjl at lucon dot org, 2007/12/26
- [Bug ld/5522] Section contents partially overwritten with zero,
hjl at lucon dot org <=
- [Bug ld/5522] Section contents partially overwritten with zero, hjl at lucon dot org, 2007/12/26