[Bug ld/10515] New: Linker corrupts the paddr and vaddr in program header

View: New views
5 Messages — Rating Filter:   Alert me  

[Bug ld/10515] New: Linker corrupts the paddr and vaddr in program header

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am attaching a sample program compiled using two different linker scripts
producing two different ELF files.

The two linker scripts are test_good.lds test_faulty.lds.
There is a trivial difference between two files.
In test_good.lds, 'ro_data' PHDRS entry is in first place.
In test_faulty.lds, 'ro_data' PHDRS entry is in second place.


The two elf files produced are test_good.elf, test_faulty.elf.

'objdump -p' of both the files is shown below.

[sample]$ objdump -p test_good.elf

test_good.elf:     file format elf32-big

Program Header:
    LOAD off    0x00000000 vaddr 0x0c000000 paddr 0x00100000 align 2**16
         filesz 0x00100000 memsz 0x00100000 flags r-x
    LOAD off    0x00100000 vaddr 0x00200000 paddr 0x00200000 align 2**16
         filesz 0x00100000 memsz 0x00100000 flags rw- 400000
    LOAD off    0x00200000 vaddr 0x08000000 paddr 0x08000000 align 2**16
         filesz 0x00000000 memsz 0x04000000 flags rw- 400000
    LOAD off    0x00200000 vaddr 0x00300000 paddr 0x00300000 align 2**16
         filesz 0x00010000 memsz 0x00070000 flags rw-
     0x8 off    0x00000000 vaddr 0x01000000 paddr 0x01000000 align 2**0
         filesz 0x00000000 memsz 0x07000000 flags rw-
     0x8 off    0x00000000 vaddr 0x2c000000 paddr 0x2c000000 align 2**0
         filesz 0x00000000 memsz 0x04000000 flags rw- 400000
     0x8 off    0x00000000 vaddr 0x10000000 paddr 0x10000000 align 2**0
         filesz 0x00000000 memsz 0x04000000 flags rw- a00000
     0x8 off    0x00000000 vaddr 0x28000000 paddr 0x28000000 align 2**0
         filesz 0x00000000 memsz 0x04000000 flags rw- 400000

[sample]$ objdump -p test_faulty.elf

test_faulty.elf:     file format elf32-big

Program Header:
    LOAD off    0x00010000 vaddr 0x00200000 paddr 0x00200000 align 2**16
         filesz 0x00100000 memsz 0x00100000 flags rw- 400000
    LOAD off    0x00000000 vaddr 0x0bf00000 paddr 0x00000000 align 2**16
         filesz 0x00200000 memsz 0x00200000 flags r-x
    LOAD off    0x00200000 vaddr 0x08000000 paddr 0x08000000 align 2**16
         filesz 0x00000000 memsz 0x04000000 flags rw- 400000
    LOAD off    0x00200000 vaddr 0x00300000 paddr 0x00300000 align 2**16
         filesz 0x00010000 memsz 0x00070000 flags rw-
     0x8 off    0x00000000 vaddr 0x01000000 paddr 0x01000000 align 2**0
         filesz 0x00000000 memsz 0x07000000 flags rw-
     0x8 off    0x00000000 vaddr 0x2c000000 paddr 0x2c000000 align 2**0
         filesz 0x00000000 memsz 0x04000000 flags rw- 400000
     0x8 off    0x00000000 vaddr 0x10000000 paddr 0x10000000 align 2**0
         filesz 0x00000000 memsz 0x04000000 flags rw- a00000
     0x8 off    0x00000000 vaddr 0x28000000 paddr 0x28000000 align 2**0
         filesz 0x00000000 memsz 0x04000000 flags rw- 400000



Check that in 'objdump -p test_faulty.elf ' output, the second segement entry
contains paddr as 0 and vaddr as 0x0bf00000. Where is it should have been
vaddr = 0x0c000000, paddr = 0x00100000.

--
           Summary: Linker corrupts the paddr and vaddr in program header
           Product: binutils
           Version: 2.18
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: harry dot he at freescale dot com
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: powerpc-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10515

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug ld/10515] Linker corrupts the paddr and vaddr in program header

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From harry dot he at freescale dot com  2009-08-13 05:22 -------
Created an attachment (id=4130)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=4130&action=view)
sample code and scripts produce different elfs


--


http://sourceware.org/bugzilla/show_bug.cgi?id=10515

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug ld/10515] Linker corrupts the paddr and vaddr in program header

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-08-26 01:22 -------
Subject: Bug 10515

CVSROOT: /cvs/src
Module name: src
Changes by: amodra@... 2009-08-26 01:21:56

Modified files:
        bfd            : ChangeLog linker.c

Log message:
        PR ld/10515
        * linker.c (bfd_find_version_for_sym): Override a "*" match by any
        other wildcard match.  Warn on multiple wildcard matches.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.4744&r2=1.4745
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&r1=1.70&r2=1.71



--


http://sourceware.org/bugzilla/show_bug.cgi?id=10515

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug ld/10515] Linker corrupts the paddr and vaddr in program header

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-08-26 04:33 -------
Subject: Bug 10515

CVSROOT: /cvs/src
Module name: src
Changes by: amodra@... 2009-08-26 04:33:42

Modified files:
        bfd            : ChangeLog linker.c

Log message:
        PR ld/10515
        * linker.c (bfd_find_version_for_sym): Revert warning.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.4745&r2=1.4746
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&r1=1.71&r2=1.72



--


http://sourceware.org/bugzilla/show_bug.cgi?id=10515

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug ld/10515] Linker corrupts the paddr and vaddr in program header

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From amodra at bigpond dot net dot au  2009-10-29 06:11 -------
ld now gives an error "PHDRS and FILEHDR are not supported when prior PT_LOAD
headers lack them"

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
            Summary|Linker corrupts the paddr   |Linker corrupts the paddr
                   |and vaddr in program header |and vaddr in program header


http://sourceware.org/bugzilla/show_bug.cgi?id=10515

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils