public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Deepen Mantri" <Deepen.Mantri@kpitcummins.com>
To: "Alan Modra" <amodra@bigpond.net.au>
Cc: <binutils@sources.redhat.com>
Subject: RE: No error for  Linker Section Overlapping
Date: Tue, 17 Apr 2007 13:17:00 -0000	[thread overview]
Message-ID: <B9D27836A814694B95A1C294F71457666D64AF@sohm.kpit.com> (raw)
In-Reply-To: <20070414012736.GP28088@bubble.grove.modra.org>

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

  reply	other threads:[~2007-04-17 11:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-12 13:50 Deepen Mantri
2007-04-14  1:42 ` Alan Modra
2007-04-17 13:17   ` Deepen Mantri [this message]
2007-04-18  4:10     ` Alan Modra
2007-04-19 17:05       ` Deepen Mantri
2007-04-21  5:01         ` Alan Modra
2007-04-23 15:08           ` Deepen Mantri
2007-04-23 15:32             ` Alan Modra
2007-04-24 10:59               ` Deepen Mantri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B9D27836A814694B95A1C294F71457666D64AF@sohm.kpit.com \
    --to=deepen.mantri@kpitcummins.com \
    --cc=amodra@bigpond.net.au \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).