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: Linker Bug or Design Intent (Absolute symbols in zero sized sections)


H. J. Lu wrote:
On Tue, Sep 26, 2006 at 12:14:36PM -0400, Vivek Goyal wrote:

H. J. Lu wrote:

On Tue, Sep 26, 2006 at 11:06:19AM -0400, Vivek Goyal wrote:


Daniel Jacobowitz wrote:


On Tue, Sep 26, 2006 at 07:51:59AM -0700, H. J. Lu wrote:



I think for --emit-relocs, we can keep an empty output section if its
address is taken.

Of course, we need to update linker doc.


I think we're being too specific to this case.

Why are we changing what the linker script clearly defines as section
relative symbols to absolute symbols?  This isn't the only use case
I've encountered where that will break.  We should either discard the
symbols, or leave the empty section.


I think retaining the zero sized section might be more logical otherwise a user who has specifically defined a section relative symbol in linker script file will be surprised to know that in some cases symbol is not present at all.



I think removing empty output sections isn't a bad idea. Otherwise, a normal executable/DSO may have many empty output sections since the default linker scripts may have many unused output sections.

However, I agree that removing empty output sections shouldn't lead
to many surprises for user. I think linker

1. Should remove an empty output section if it isn't used to define
section relative symbol which may be changed at run time.
2. Shouldn't convert a section relative symbol to absolute symbol
if it may be changed at run time.

How does one determine at compile time if a section relative symbol will be modified or not? ("if it may be changed at run time?").


How can you reasonably modify a section relative symbol at run time?
Do you need to use --emit-relocs?

I need --emit-relocs as it retains the relocation information in finally linked executable and I use that relocation information to relocate the image to a different address at run time. It is just a matter of going through all the relocation entries and adding an offset value.


Sorry I don't understand the first question very well. The moment a symbol is section relative and if section is moved at run time, I will be walking through and procesing all the relocations generated wrt to that symbol at run time.


Thanks Vivek


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