This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
64bit bfd_vma vs 32bit address space in linker
- From: Andreas Schwab <schwab at suse dot de>
- To: binutils at sources dot redhat dot com
- Cc: Stefan Reinauer <stepan at suse dot de>
- Date: Fri, 04 Apr 2003 17:46:14 +0200
- Subject: 64bit bfd_vma vs 32bit address space in linker
What is the expected behaviour of the linker when dot advances past the
32 bit address space and bfd_vma is 64 bits? Is this undefined, or
should the result wrap around as if bfd_vma is only 32 bits? Note the
address of .text in the linker map below.
$ objdump --info
BFD header file version 2.13.90.0.18 20030121 (SuSE Linux)
elf32-i386
(header little endian, data little endian)
i386
a.out-i386-linux
(header little endian, data little endian)
i386
efi-app-ia32
(header little endian, data little endian)
i386
elf32-little
(header little endian, data little endian)
i386
elf32-big
(header big endian, data big endian)
i386
elf64-x86-64
(header little endian, data little endian)
i386
elf64-little
(header little endian, data little endian)
i386
elf64-big
(header big endian, data big endian)
i386
srec
(header endianness unknown, data endianness unknown)
i386
symbolsrec
(header endianness unknown, data endianness unknown)
i386
tekhex
(header endianness unknown, data endianness unknown)
i386
binary
(header endianness unknown, data endianness unknown)
i386
ihex
(header endianness unknown, data endianness unknown)
i386
trad-core
(header endianness unknown, data endianness unknown)
elf32-i386 a.out-i386-linux efi-app-ia32 elf32-little elf32-big
i386 elf32-i386 a.out-i386-linux efi-app-ia32 elf32-little elf32-big
elf64-x86-64 elf64-little elf64-big srec symbolsrec tekhex
i386 elf64-x86-64 elf64-little elf64-big srec symbolsrec tekhex
binary ihex trad-core
i386 binary ihex ---------
$ cat rom.s
.section ".rom.text"
.code16
.globl _start
_start:
cli
.section ".reset"
.code16
.globl reset_vector
reset_vector:
jmp _start_offset
$ cat rom.lds
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
_RAMBASE = 0x4000;
_ROMBASE = 0xffff0000;
_start_offset = _start & 0xffff;
TARGET(binary)
SECTIONS
{
. = _ROMBASE;
.rom . : {
_rom = .;
*(.rom.text);
*(.rom.data);
. = ALIGN(16);
_erom = .;
}
/DISCARD/ : {
*(.comment)
*(.note)
}
}
SECTIONS {
_ROMTOP = (_ROMBASE >= 0xffff0000)? 0xfffffff0 : 0xffff0;
. = _ROMTOP;
.reset . : {
*(.reset)
. = 15 ;
BYTE(0x00);
}
}
$ as rom.s -o rom.o
$ ld rom.o -T rom.lds -M
rom.o(.reset+0x1): In function `reset_vector':
: relocation truncated to fit: R_386_PC16 _start_offset
Memory Configuration
Name Origin Length Attributes
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
LOAD rom.o
0x0000000000004000 _RAMBASE = 0x4000
0x00000000ffff0000 _ROMBASE = 0xffff0000
0x0000000000000000 _start_offset = (_start & 0xffff)
TARGET(binary)
0x00000000ffff0000 . = _ROMBASE
.rom 0x00000000ffff0000 0x10
0x00000000ffff0000 _rom = .
*(.rom.text)
.rom.text 0x00000000ffff0000 0x1 rom.o
0x00000000ffff0000 _start
*(.rom.data)
0x00000000ffff0010 . = ALIGN (0x10)
*fill* 0x00000000ffff0001 0x10000000f 00
0x00000000ffff0010 _erom = .
/DISCARD/
*(.comment)
*(.note)
0x00000000fffffff0 _ROMTOP = (_ROMBASE >= 0xffff0000)?0xfffffff0:0xffff0
0x00000000fffffff0 . = _ROMTOP
.reset 0x00000000fffffff0 0x10
*(.reset)
.reset 0x00000000fffffff0 0x3 rom.o
0x00000000fffffff0 reset_vector
0x00000000ffffffff . = 0xf
*fill* 0x00000000fffffff3 0x10000000c 00
0x00000000ffffffff 0x1 BYTE 0x0
OUTPUT(a.out elf32-i386)
.text 0x0000000100000000 0x0
.data 0x0000000100000000 0x0
.bss 0x0000000100000000 0x0
Andreas.
--
Andreas Schwab, SuSE Labs, schwab at suse dot de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."