Query reg. unallocated section
Shankara Raman S
shankara.raman@wipro.com
Mon Oct 29 18:23:00 GMT 2001
>
> > If a section (.mysect) in an assembly file is not allocable, then its start
> > address is 0x0 by default. If a symbol is defined in such a section, then the
> > symbol is resolved relative to the start (0x0) of that section.
> >
> > If another section (which is allocable) starts at address 0x0, then the symbol
> > in section .mysect will be resolved incorrectly.
>
> Do you have a test case that demonstrates this problem? Also, you don't say
> what version of binutils you are using.
>
I am using binutils 2.11.2
The assembly file is:
.text
nop
nop
b sym
nop
.section .mynoalloc
sym: nop
nop
.section .myalloc, "ax"
nop
I am doing the following:
as file.s -o file.o
ld file.o -Ttext 0x0 -o file (to force the .text to start at 0x0)
and
objdump -D file shows:
00000000 <.text>:
0: e1a00000 nop (mov r0,r0)
4: e1a00000 nop (mov r0,r0)
8: eafffffc b 0 <sym>
c: e1a00000 nop (mov r0,r0)
Disassembly of section .myalloc:
00000010 <.myalloc>:
10: e1a00000 nop (mov r0,r0)
Disassembly of section .data:
The address of "sym" has been resolved to 0, which is now the beginning
of the
text section.
I am not sure if this behaviour is incorrect, but should the linker
print
a warning ?
Shankar
More information about the Binutils
mailing list