bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/594] New: ld refuses to put data into PT_NOTE segment


From: pkoning at equallogic dot com
Subject: [Bug ld/594] New: ld refuses to put data into PT_NOTE segment
Date: 30 Nov 2004 20:27:58 -0000

I want to put data into a PT_NOTE segment without also putting it into the
program segment.  If I do put it into the program (PT_LOAD) segment, all is
well.  If I try to avoid that, by supplying data in a section that's marked as
not allocatable, I get contradictory results:

notedata.S:

        .section        notedata
        .byte   0
        .byte   1
        .byte   42

script:

PHDRS
{
  note PT_NOTE ;
  prog PT_LOAD ;
}

SECTIONS
{
  notedata :
  {
        notedata.o (notedata)
  } :note /*:prog*/
  .text 0x10000 :
  {
        *(.data .text .bss .reginfo)
  } :prog
}

Test run:

address@hidden src]$ gcc -c notedata.S
address@hidden src]$ ld -o test2 -T test.ld notedata.o
address@hidden src]$ objdump -p test2

test2:     file format elf32-i386

Program Header:
    NOTE off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**0
         filesz 0x00000000 memsz 0x00000003 flags r--
    LOAD off    0x00001000 vaddr 0x00010000 paddr 0x00010000 align 2**12
         filesz 0x00000000 memsz 0x00000000 flags r-x

address@hidden src]$ objdump -h test2

test2:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 notedata      00000003  00000000  00000000  00001000  2**0
                  CONTENTS, READONLY
  1 .text         00000000  00010000  00010000  00001000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE

No link warnings this time.  And the "notedata" section has a
"contents" attribute but not "alloc".

Now the filesz is zero, though the memsz reflects the size I wanted.
That's actually the reverse of what I expected to see -- given that
ALLOC and LOAD aren't set, I wouldn't have expected a memsize.

The above example is done with the stock ld from NetBSD 1.6 (which is version
2.11) but I see the identical failure with mips targeted tools version 2.14 and
2.15.
      paul

-- 
           Summary: ld refuses to put data into PT_NOTE segment
           Product: binutils
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: pkoning at equallogic dot com
                CC: bug-binutils at gnu dot org
 GCC build triplet: i386-netbsd
  GCC host triplet: i386-netbsd
GCC target triplet: i386-netbsd mipsel-netbsdelf


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

------- 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]