weak alias in gas on arm-elf

Daniel Jacobowitz drow@false.org
Mon Jul 2 22:00:00 GMT 2007

On Mon, Jul 02, 2007 at 03:19:39PM +0100, Brian Sidebotham wrote:
> As can be seen at address 24: the label srSWI which was given the weak 
> attribute in the assembler file has gone because there is an srSWI in the main 
> C code which takes precedence. That makes sense, except that the weak label 
> code is still present, AND the instruction at address 8 is still loading the PC 
> with the weak symbol address.
> This is what originally threw me. I presume this output is intended in this 
> situation?

The symbol is weak, not the code following it.  Weakness only affects
the definitions of symbols.

Also, using objdump -d on unlinked object files is a good way to get
confused.  Try adding -r to see what's really happening.

The ldr version you posted does not make any sense, by the way.
You want the address of the symbol moved to pc, not the contents of
the instruction there!  I suspect the original version was supposed to
load the symbol value from a constant pool.

Daniel Jacobowitz

More information about the Binutils mailing list