Elf program header not correctly generated (glibc-2.3.3 and gnu ld on RHLinux 3.0)

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

 



Hi all ,

I am trying to compile posix testuite on RHLinux using a linker
script with MEMORY constraint (see attached linker script).

I am getting some problems in generated elf files .

==============================================================
objdump -p ../busybox/posixtestsuite/conformance/interfaces/asctime/1-1.test

../busybox/posixtestsuite/conformance/interfaces/asctime/1-1.test:     file format elf32-i386

Program Header:
    LOAD off    0x00001000 vaddr 0x00001000 paddr 0x00001000 align 2**12
         filesz 0x00059ed0 memsz 0x0005abf4 flags rwx
    NOTE off    0x00001000 vaddr 0x00001000 paddr 0x00001000 align 2**2
         filesz 0x00000020 memsz 0x00000020 flags r--
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags rw-
=======================================================================
As you will notice in the program header, the offset is 0x1000 and vaddr is also
0x1000 ,I noticed in the elf loader of linux that the generated program header is
put at the address (vaddr - offset) which becomes address 0 .
Now address 0 is NULL page and is not accessible from user address space. the glibc
initialization code accesses this program header resulting in a segmentation fault.

(I am using glibc-2.3.3 ld version 2.14.90)
Can anybody throw some light on what can be the problem ?

With same ld script for other posix testsuite I get correct headers
(offset = 0 , vaddr =5b000).
=======================================================================
 objdump -p ../busybox/posixtestsuite/conformance/interfaces/ctime/1-1.test

../busybox/posixtestsuite/conformance/interfaces/ctime/1-1.test:     file format elf32-i386

Program Header:
    LOAD off    0x00000000 vaddr 0x0005b000 paddr 0x0005b000 align 2**12
         filesz 0x0005a2d0 memsz 0x0005aff0 flags rwx
    NOTE off    0x000007f0 vaddr 0x0005b7f0 paddr 0x0005b7f0 align 2**2
         filesz 0x00000020 memsz 0x00000020 flags r--
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags rw-
=======================================================================

Any help (reference to resources on net) or some direction to go about solving this
problem will be useful.
If some more information is required please do let me know.

Thanks & Regards
Kshitiz

Attachment: script.ld
Description: Binary data

_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux