This is the mail archive of the binutils@sourceware.org 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]

RE: No error for Linker Section Overlapping


Hi,

Thank you for the reply.	

>> The changes to lma assignment made using overlays considerably 	
>> simpler.  In particular, sections following an overlay area now	
>> don't need their LMAs set.	

Yes, this is correct. However, it now seems to me that keyword 	
"OVERLAY" has become redundant. Even if you do not use or intend 	
to use it, the sections having overlapped VMAs are going to be 	
considered as overlay sections.	
	
Let's consider this case,	
	
Following is the part of my linker script:	

/////////////////////////////////////////////////////////////////	
.
.
.
.data 0x040000 : AT(_mdata)	
{ 
   _data = .;	
   *(.data) 	
   _edata = .; 	
} > ram	

.mydata1 0x040004 :	
{ 
	.
	.
	BYTE(1);
        LONG(1);
        QUAD(1);
        .
        .
} > ram

.mydata 0x040008 :
{ 
	.
	.
	BYTE(1);
        LONG(1);
        QUAD(1);
        .
        .   
} > ram
.
.
.
//////////////////////////////////////////////////////////////////	

Here "_mdata" is some address of ROM region.	

All the above three sections are overlapping. User has miscalculated	
the sizes of the sections (which can happen quite often) and hence	
assigned the wrong VMAs.	 	

Some sort of alert in the form of warning or error is expected.	 	
Instead, different LMAs are assigned to the sections considering

that they might be overlay sections. So no warning/error is 		
generated.		

Following lines from the map file depict the same:		

///////////////////////////////////////////////////////////////////	
.
.
.
.data           0x00040000        0x8 load address 0x00000368
                0x00040000                _data = .
 *(.data)
 .data          0x00040000        0x0 hwinit.o
 .data          0x00040000        0x8 sample.o
                0x00040004                _z
                0x00040000                _p
 .data          0x00040008        0x0 start.o
 .data          0x00040008        0x0 vects.o
                0x00040008                _edata = .

.mydata1        0x00040004        0xd load address 0x00000370
                0x00040004        0x1 BYTE 0x1
                0x00040005        0x4 LONG 0x1
                0x00040009        0x8 QUAD 0x1

.mydata         0x00040008        0xd load address 0x0000037d
                0x00040008        0x1 BYTE 0x1
                0x00040009        0x4 LONG 0x1
                0x0004000d        0x8 QUAD 0x1
 .
 .
 .
/////////////////////////////////////////////////////////////////////	


>> Assign the LMA as well as the VMA.		
Yes, VMA overlapping error can be generated by this.		

But can't we add an additional check, whether the sections having 	
overlapped VMAs are overlay or not, before changing their LMAs?





Regards,
Deepen Mantri

KPIT Cummins InfoSystems Ltd.
Pune, India
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH, H8, R8C, M16C
and M32C Series. The following site also offers free technical support
to its users. Visit http://www.kpitgnutools.com for details. 
Latest versions of KPIT GNU tools were released on February 6, 2007.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

-----Original Message-----
From: Alan Modra [mailto:amodra@bigpond.net.au] 
Sent: Saturday, April 14, 2007 6:58 AM
To: Deepen Mantri
Cc: binutils@sources.redhat.com
Subject: Re: No error for Linker Section Overlapping

On Thu, Apr 12, 2007 at 06:51:26PM +0530, Deepen Mantri wrote:
> What is the benefit of assigning distinct LMAs to the non-overlay
> sections having overlapped VMAs? 

The changes to lma assignment made using overlays considerably
simpler.  In particular, sections following an overlay area now
don't need their LMAs set.

> Is there any way to generate an overlapping error for
> non-overlay/non-loadable
> sections (such as .bss section),if there VMAs get overlapped?

Assign the LMA as well as the VMA.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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