[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ld x86-64 bug
From: |
Jan Stoess |
Subject: |
ld x86-64 bug |
Date: |
Mon, 27 Jan 2003 21:51:58 +0100 |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) XEmacs/21.4 (Military Intelligence, i386-debian-linux) |
Hi,
compiled for an x86_64 target and using the ld places sections on a
wrong offset within the file:
My ld:
GNU ld version 2.13.2 built for the target x86_64-pc-linux-gnu
My gcc:
Reading specs from /usr/local/cross/lib/gcc-lib/x86_64-pc-linux-gnu/\
3.2.1/specs
Configured with: ../gcc-3.2.1/configure --target=x86_64-pc-linux-gnu\
--prefix=/usr/local/cross --enable-languages=c,c++ --enable-threads=\
posix --disable-multilib
Thread model: posix
gcc version 3.2.1
My Host:
Linux 2.4.20-pre8-ac1 GNU/Linux
<-------------------The Linker Script ldbug.lds--------------------->
OUTPUT_FORMAT("elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
#This should toggle LMA and VMA in the ELF file but NOT the
#offset within the FILE!
start_text = 0x123456;
SECTIONS
{
.text start_text : AT (start_text)
{
*(.text)
}
}
<-------------------Dummy C Source ldbug.c -------------------------->
int main(void)
{
return 0;
}
<----------------------------Compile it --------------------------->
$x86_64-pc-linux-gnu-gcc -o ldbug.o ldbug.c
$x86_64-pc-linux-gnu-ld -T ldbug.lds ldbug.o -o ldbug
<----------------------------Inspect it --------------------------->
$x86_64-pc-linux-gnu-objdump -dhx ldbug | less
[...]
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000192 0000000000123456 0000000000123456 00023456 2**6
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .init 00000013 00000000001235e8 00000000001235e8 000235e8 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .plt 00000020 00000000001235fc 00000000001235fc 000235fc 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .fini 0000000e 000000000012361c 000000000012361c 0002361c 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
[...]
Looking at the 6th column, the file offset of the text section is
equal to the maximum of the LMA of text section (Column 5) and
0x100000; i tried several values for start_text in the Linker Script.
This makes the file unnecessarily big...
I attached the object file, the binary and a Makefile for your
convenience
yours,
jan stoess
ldbug.tgz
Description: Binary data
--
"Our design team decided to include a few meaningless Windows error
messages to make ex Microsft's comfortable."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- ld x86-64 bug,
Jan Stoess <=