This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ARM-Thumb interwork and relocatable link


I tried to make interwork program, which linked relocatable format.
But output file seems have no interworking code like
__funcname_from_arm.
When I tried to link same program which linked Absolute format, output
file seems correct.
Is it bug or my misunderstanding?
 
Thanks.
 
------
tanaka@personal-media.co.jp
   
***
host system is redhat linux 7.1
binutils-2.13 configration is
../binutils-2.13/configure --prefix=/usr/local/te/tool/Linux-i686
--target=xscale-elf
 
gcc-3.2 configuration is
~/$ xscale-elf-gcc -v
Reading specs from
/usr/local/te/tool/Linux-i686/lib/gcc-lib/xscale-elf/3.2/specs
Configured with: ../gcc-3.2/configure
--prefix=/usr/local/te/tool/Linux-i686
    --target=xscale-elf --with-gnu-as --with-gnu-ld
--enable-languages=c,c++
    --enable-version-specific-runtime-libs --with-dwarf2
Thread model: single
gcc version 3.2

*** sample source main.c ***
int thumb2arm();
int (*get_thumb_func())();

static int (*thumb_funcv)();
int arm_func()
{
    return 2;
}

int (*arm_foo())()
{  
    return arm_func;
}

int start()
{
    thumb_funcv = get_thumb_func();
    (*thumb_funcv)();
    thumb2arm();
    return 0;
}
*** sample source thumb.c ***
int (*arm_foo())();
static int (*arm_func)();

int thumb_func()
{
    return 2;
}
int (*get_thumb_func())()
{
    return thumb_func;
}

static int static_thumb_func()
{  
    return 3;
}

int thumb2arm()
{
    arm_func = arm_foo();
    (*arm_func)();   
    static_thumb_func();
    return 0;
}

*** Absolute link ***
xscale-elf-gcc
-B/usr/local/te/tool/Linux-i686/lib/gcc-lib/xscale-elf/3.2/
    -mthumb-interwork -msoft-float -save-temps -c ../src/main.c -o
main.o
xscale-elf-gcc
-B/usr/local/te/tool/Linux-i686/lib/gcc-lib/xscale-elf/3.2/
    -mthumb-interwork -msoft-float -save-temps -mthumb -c ../src/thumb.c
-o thumb.o
xscale-elf-ld -nostdlib -static -o sample main.o thumb.o
   
/usr/local/te/tool/Linux-i686/lib/gcc-lib/xscale-elf/3.2/interwork/libgcc.a
 
*** Absolute link output ***
0000803c <start>:
    803c:   e1a0c00d    mov ip, sp
    8040:   e92dd800    stmdb   sp!, {fp, ip, lr, pc}
    8044:   e24cb004    sub fp, ip, #4  ; 0x4
    8048:   eb000034    bl  8120 <__get_thumb_func_from_arm>
    804c:   e1a02000    mov r2, r0
        .
00008090 <get_thumb_func>:
    8090:   b580        push    {r7, lr}
    8092:   466f        mov r7, sp
        .
00008120 <__get_thumb_func_from_arm>:
    8120:   e59fc000    ldr ip, [pc, #0]    ; 8128
<__get_thumb_func_from_arm+0x8>
    8124:   e12fff1c    bx  ip
    8128:   00008091    muleq   r0, r1, r0
        .

*** Relocatable link ***
xscale-elf-gcc
-B/usr/local/te/tool/Linux-i686/lib/gcc-lib/xscale-elf/3.2/
    -mthumb-interwork -msoft-float -save-temps -c ../src/main.c -o
main.o
xscale-elf-gcc
-B/usr/local/te/tool/Linux-i686/lib/gcc-lib/xscale-elf/3.2/
    -mthumb-interwork -msoft-float -save-temps -mthumb -c ../src/thumb.c
-o thumb.o
xscale-elf-ld -nostdlib -r -o sample main.o thumb.o
   
/usr/local/te/tool/Linux-i686/lib/gcc-lib/xscale-elf/3.2/interwork/libgcc.a

*** Relocatable link output ***
0000003c <start>:
  3c:   e1a0c00d    mov ip, sp
  40:   e92dd800    stmdb   sp!, {fp, ip, lr, pc}
  44:   e24cb004    sub fp, ip, #4  ; 0x4
  48:   ebfffffe    bl  0 <arm_func>
  4c:   e1a02000    mov r2, r0
  50:   e59f3024    ldr r3, [pc, #36]   ; 7c <start+0x40>

* Can't find <__get_thumb_func_from_arm>.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]