This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Possible bug in ld with NOLOAD sections.


Hi,

On Thu, Nov 19, 2009 at 09:40:14AM +1100, Tony Breeds wrote:

> I'm trying to include a section in an ELF executable but NOT have that section
> covered by the PT_LOAD.

Are you trying to do an overlay? If so, you probably want the OVERLAY
attribute instead of NOLOAD:

--- Makefile.orig       2009-11-19 10:08:54.000000000 +0100
+++ Makefile    2009-11-19 10:18:18.000000000 +0100
@@ -32,7 +32,7 @@
 lds-noload: Makefile
        $(LD) --verbose | \
        sed -e '0,/===/ d ; /===/ d' \
-       -e '/__bss_start/ i .blob (NOLOAD) : { *(.blob) }' >$@
+       -e '/__bss_start/ i .blob (OVERLAY) : { *(.blob) }' >$@
 
 blob.test-noload: main-noload
        objcopy -O binary -j .blob $< $@


-rw-r--r-- 1 richter richter 6128 2009-11-19 10:18 blob.o
-rwxr-xr-x 1 richter richter 4096 2009-11-19 10:18 blob.test
-rwxr-xr-x 1 richter richter    0 2009-11-19 10:18 blob.test-noload
-rw-r--r-- 1 richter richter 7680 2009-11-19 10:18 lds
-rw-r--r-- 1 richter richter 7690 2009-11-19 10:18 lds-noload
-rwxr-xr-x 1 richter richter 6880 2009-11-19 10:18 main
-rwxr-xr-x 1 richter richter 6816 2009-11-19 10:18 main-noload


Program Header:
    LOAD off    0x0000000000000000 vaddr 0x0000000000400000 paddr 0x0000000000400000 align 2**21
         filesz 0x00000000000000f8 memsz 0x00000000000000f8 flags r-x
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-

Hope this helps,

   Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]