bug-gnu-utils
[Top][All Lists]
Advanced

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

binutils 2.11: another ARM relocation problem in linker


From: Eberhard Mattes
Subject: binutils 2.11: another ARM relocation problem in linker
Date: Mon, 6 Aug 2001 02:16:21 +0200

Binutils version: 2.11
Configuration:    --target=arm-epoc-pe (PE/COFF)

For the appended set of input files, ld writes a relocation with
incorrect offset.  The files are built with this shell script:

------------------------------------------------------------------------
#! /bin/sh

rm -f main.o main.dll imp.a tmp.bas tmp.exp tmp.lib tmp.pex

arm-epoc-pe-dlltool --output-lib imp.a --input-def imp.def --dllname imp
arm-epoc-pe-as -o main.o main.s
arm-epoc-pe-ld -v --dll -e entry --base-file tmp.bas -o tmp.pex main.o imp.a
arm-epoc-pe-dlltool --output-lib tmp.lib --input-def main.def \
        --dllname main --base-file tmp.bas --output-exp tmp.exp
arm-epoc-pe-ld -v --dll -e entry -o main.dll tmp.exp main.o imp.a
arm-epoc-pe-objdump -pd main.dll
------------------------------------------------------------------------

Here are the relevant lines from the output of objdump:

------------------------------------------------------------------------
PE File Base Relocations (interpreted .reloc section contents)

Virtual Address: 00001000 Chunk size 12 (0xc) Number of fixups 2
        reloc    0 offset    8 [1008] HIGHLOW
        reloc    1 offset   1c [101c] HIGHLOW
[...]
Disassembly of section .text:

10001000 <__bss_end__>:
10001000:       e59fc000        ldr     ip, [pc, #0]    ; 10001008 
<__bss_end__+0x8>
10001004:       e59cf000        ldr     pc, [ip]
10001008:       1000303c        andne   r3, r0, ip, lsr r0

1000100c <foo>:
1000100c:       e59fc000        ldr     ip, [pc, #0]    ; 10001014 <foo+0x8>
10001010:       e59cf000        ldr     pc, [ip]
10001014:       10003040        andne   r3, r0, r0, asr #32

10001018 <__CTOR_LIST__>:
10001018:       ffffffff        swinv   0x00ffffff
1000101c:       00000000        andeq   r0, r0, r0
------------------------------------------------------------------------

reloc 1 should have offset 14 [1014] instead of 1c [101c].

Here are the input files:

main.s:
------------------------------------------------------------------------
        .text
        .global entry
entry:
        .section .rdata
        .word   foo
------------------------------------------------------------------------

main.def:
------------------------------------------------------------------------
EXPORTS
        bar     @ 1 NONAME
------------------------------------------------------------------------

imp.def:
------------------------------------------------------------------------
EXPORTS
        foo     @ 1 NONAME
        bar     @ 2 NONAME
------------------------------------------------------------------------

Eberhard Mattes



reply via email to

[Prev in Thread] Current Thread [Next in Thread]