[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gold: script_test_3.t output produces exec format error
From: |
Jan Blunck |
Subject: |
gold: script_test_3.t output produces exec format error |
Date: |
Fri, 28 Mar 2008 11:01:56 +0100 |
User-agent: |
Mutt/1.5.17 (2007-11-01) |
Although the linker script looks ok, the resulting binary isn't executable on
x86_64. Without defining the program headers in the linker script the
executable is working fine.
PHDRS
{
text PT_LOAD FILEHDR PHDRS FLAGS(5);
interp PT_INTERP;
dynamic PT_DYNAMIC FLAGS(4);
data PT_LOAD;
bss PT_LOAD;
}
SECTIONS
{
/* With luck this will work everywhere. */
. = 0x10000000;
/* With luck this will be enough to get the program working. */
.interp : { *(.interp) } :text :interp
.text : { *(.text) } :text
. += 0x100000;
. = ALIGN(0x100);
.dynamic : { *(.dynamic) } :data :dynamic
.data : { *(.data) } :data
. += 0x100000;
. = ALIGN(0x100);
.bss : { *(.bss) } :bss
}
This is the result with the self defined PHDRS:
testsuite> g++ -o jantest -Bgcctestdir/ basic_test.o -T
../../../gold/testsuite/script_test_3.t
testsuite> readelf -l jantest
Elf file type is EXEC (Executable file)
Entry point 0x10000480
There are 5 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
INTERP 0x001000 0x10000000 0x10000000 0x0047c 0x0047c R 0x8
[Requesting program interpreter: /lib/ld-linux.so.2]
LOAD 0x000000 0x0ffff000 0x0ffff000 0x01bf8 0x01bf8 R E 0x1000
LOAD 0x001c00 0x10100c00 0x10100c00 0x0015c 0x0015c RW 0x1000
LOAD 0x001e00 0x10200e00 0x10200e00 0x00000 0x00080 RW 0x1000
DYNAMIC 0x001c00 0x10100c00 0x10100c00 0x000d0 0x000d0 R 0x4
Section to Segment mapping:
Segment Sections...
00 .interp .gnu.version_r .gnu.version .hash .dynstr .dynsym .rel.dyn
.rel.plt .eh_frame_hdr .eh_frame .rodata .note
01 .interp .gnu.version_r .gnu.version .hash .dynstr .dynsym .rel.dyn
.rel.plt .eh_frame_hdr .eh_frame .rodata .note .text .plt .text .fini .init
02 .dynamic .data .got .jcr .dtors .ctors
03 .bss
04 .dynamic
And the same script without the self defined PHDRS:
testsuite> g++ -o jantest -Bgcctestdir/ basic_test.o -T
../../../gold/testsuite/jan.t
testsuite> readelf -l jantest
Elf file type is EXEC (Executable file)
Entry point 0x10000480
There are 10 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000034 0x0ffff034 0x0ffff034 0x00140 0x00140 R 0x4
INTERP 0x001000 0x10000000 0x10000000 0x00013 0x00013 R 0x1
[Requesting program interpreter: /lib/ld-linux.so.2]
LOAD 0x000000 0x0ffff000 0x0ffff000 0x00174 0x00174 R 0x1000
LOAD 0x001000 0x10000000 0x10000000 0x00bf8 0x00bf8 R E 0x1000
LOAD 0x001c00 0x10100c00 0x10100c00 0x0015c 0x0015c RW 0x1000
LOAD 0x001e00 0x10200e00 0x10200e00 0x00000 0x00080 RW 0x1000
DYNAMIC 0x001c00 0x10100c00 0x10100c00 0x000d0 0x000d0 RW 0x4
NOTE 0x001444 0x10000444 0x10000444 0x00038 0x00038 R 0x4
GNU_EH_FRAME 0x0012d8 0x100002d8 0x100002d8 0x00034 0x00034 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0
Section to Segment mapping:
Segment Sections...
00
01 .interp
02
03 .interp .gnu.version_r .gnu.version .hash .dynstr .dynsym .rel.dyn
.rel.plt .eh_frame_hdr .eh_frame .rodata .note .text .plt .text .fini .init
04 .dynamic .data .got .jcr .dtors .ctors
05 .bss
06 .dynamic
07 .note
08 .eh_frame_hdr
09
Any ideas?
Cheers,
Jan
--
Jan Blunck <address@hidden>
- gold: script_test_3.t output produces exec format error,
Jan Blunck <=