This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
NOLOAD attribute
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 14 Mar 2006 15:16:24 +0000
- Subject: NOLOAD attribute
Whet exactly should be the behaviour of the NOLOAD section attribute in a linker
script?
I find that it doesn't inhibit an elf load segment for the region, but it does
set the file size of that segment to zero. It also doesn't affect whether the
output section is PROGBITS or not. Is this correct, or should it also set the
section type to NOBITS?
I attach an assembly file and linker script. On i686-gnu-linux, the executable
has the following attributes,
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .progbits PROGBITS 00010000 000074 000002 00 A 0 0 1
[ 2] .nobits NOBITS 00020000 000076 000002 00 A 0 0 1
[ 3] .shstrtab STRTAB 00000000 000076 00002d 00 0 0 1
[ 4] .symtab SYMTAB 00000000 000194 000060 10 5 6 4
[ 5] .strtab STRTAB 00000000 0001f4 000001 00 0 0 1
Key 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)
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x00010000 0x00010000 0x00000 0x00002 R 0x1000
LOAD 0x000000 0x00020000 0x00020000 0x00000 0x00002 R 0x1000
Section to Segment mapping:
Segment Sections...
00 .progbits
01 .nobits
*) is it correct to even create the LOAD segments?
*) is it correct for .progbits section type to be PROGBITS?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
.section ".progbits","a",@progbits
.word 0
.section ".nobits","a",@nobits
.word 0
MEMORY
{
other (w) : ORIGIN = 0, LENGTH = 0x10000
progbits (w) : ORIGIN = 0x10000, LENGTH = 0x10000
nobits (w) : ORIGIN = 0x20000, LENGTH = 0x10000
}
SECTIONS
{
PROVIDE(_start = .);
.text : { *(.text) *(.data) *(.bss) } > other
.progbits (NOLOAD): { *(.progbits) } >progbits
.nobits (NOLOAD): { *(.nobits) } >nobits
}