public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* NOLOAD attribute
@ 2006-03-14 15:16 Nathan Sidwell
  2006-03-14 22:55 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Sidwell @ 2006-03-14 15:16 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1881 bytes --]

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


[-- Attachment #2: 576.s --]
[-- Type: text/plain, Size: 87 bytes --]

	.section ".progbits","a",@progbits
	.word 0

	.section ".nobits","a",@nobits
	.word 0

[-- Attachment #3: 576.ld --]
[-- Type: text/plain, Size: 333 bytes --]


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
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: NOLOAD attribute
  2006-03-14 15:16 NOLOAD attribute Nathan Sidwell
@ 2006-03-14 22:55 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2006-03-14 22:55 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: binutils

Nathan Sidwell <nathan@codesourcery.com> writes:

> Whet exactly should be the behaviour of the NOLOAD section attribute
> in a linker script?

I don't think anybody really knows.

The original meaning was that it set the STYP_NOLOAD bit for a COFF
section.  What that means in the ELF world is anybody's guess.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-14 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-14 15:16 NOLOAD attribute Nathan Sidwell
2006-03-14 22:55 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).