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]

Re: Query reg. unallocated section


> 
> > 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
-------------------------------------------------------------------------------------------------------------------------
Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and
is intended for use only by the individual or entity to which it is
addressed, and may contain information that is privileged, confidential or
exempt from disclosure under applicable law. If you are not the intended
recipient or it appears that this mail has been forwarded to you without
proper authority, you are notified that any use or dissemination of this
information in any manner is strictly prohibited. In such cases, please
notify us immediately at mailto:mailadmin@wipro.com and delete this mail
from your records.
----------------------------------------------------------------------------------------------------------------------

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