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: PATCH: ld/2300: ld does not report duplicate symbols defined in script file


On Thu, Feb 16, 2006 at 10:15:18AM +1030, Alan Modra wrote:
> On Wed, Feb 08, 2006 at 04:06:29PM -0800, H. J. Lu wrote:
> > We don't check if a symbol is already defined when we make assignment.
> > This patch handle that. I can't use multiple_definition to check if
> > a multiple definition is real or not since it always returns TRUE.
> > 
> > I am not sure about the bfd_link_hash_defweak check. Can an
> > assignment override a weak definition?
> 
> I think you should allow a link script assignment to override a weakly
> defined symbol, and not warn.
> 

It turns out that Linux x86-64 kernel linker script uses it to overide
a defintion:

[hjl@gnu-13 linux-2.6.15]$ grep wall_jiffies kernel/*.c
kernel/timer.c:unsigned long wall_jiffies = INITIAL_JIFFIES;
kernel/timer.c: ticks = jiffies - wall_jiffies;
kernel/timer.c:         wall_jiffies += ticks;
[hjl@gnu-13 linux-2.6.15]$ grep wall_jiffies
arch/x86_64/kernel/vmlinux.lds
  .wall_jiffies : AT((ADDR(.wall_jiffies) - ((-10*1024*1024) -
((LOADADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) &
~(4095))))) { *(.wall_jiffies) }
  wall_jiffies = (ADDR(.wall_jiffies) - ((-10*1024*1024) -
((ADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) &
~(4095))));
[hjl@gnu-13 linux-2.6.15]$

I guess we may have to live with this feature :-).


H.J.


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