bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/15302] New: Branching to linker script symbol is resolved to imp


From: terry.guo at arm dot com
Subject: [Bug ld/15302] New: Branching to linker script symbol is resolved to improperly BLX instruction for cortex-m3
Date: Mon, 25 Mar 2013 06:13:01 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=15302

             Bug #: 15302
           Summary: Branching to linker script symbol is resolved to
                    improperly BLX instruction for cortex-m3
           Product: binutils
           Version: 2.24 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden
                CC: address@hidden
    Classification: Unclassified
              Host: i686
            Target: cortex-m3


In C file I have a call to function extFunc which is then defined in my linker
script as a script symbol "extFunc = 0x1000 + 1;". In assembly code I got
branch instruction "bl extFunc", but in final image this instruction is
resolved to "blx 0x1000" which is illegal for cortex-m3 and will cause a
HardFault.

Should the ld consider the limitation of cortex-m3 or this is illegal usage
model? Please advise.

Here are steps to reproduce this problem.

My test.c file is:

extern void extFunc (void);

void main (void) {
    extFunc ();
}

My link script file is simple as:

extFunc = 0x1000 + 1;

Command to compile the test.c is:

arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -c test.c

Command to build them together is:

arm-none-eabi-ld test.o -T link.ld

Disassemble the produced file and get:

address@hidden:latest$ ./install-native/bin/arm-none-eabi-objdump -d a.out 

a.out:     file format elf32-littlearm


Disassembly of section .text:

00000000 <main>:
   0:    b580          push    {r7, lr}
   2:    af00          add    r7, sp, #0
   4:    f000 effc     blx    1000 <main+0x1000>
   8:    bd80          pop    {r7, pc}
   a:    bf00          nop

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

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