[parisc-linux] Problem with weak symbols

John David Anglin dave@hiauly1.hia.nrc.ca
Tue, 7 Jan 2003 12:47:53 -0500 (EST)


> Hi,
> 
> I have a problem with weak symbols on parisc. If I use the following
> small program, the result should be always (nil), but it isnīt:

> asm (".weak linux_bla");
> asm (".weak linux_foo");

Don't use asm's to weaken symbols.  Use GCC's attribute weak.  GCC
needs to know whether a symbol is weak or not.

> extern const char * linux_bla;
> extern const int linux_foo[];

> > ./weak
> linux_bla: 0x205f0
> linux_foo: (nil)
> 
> The main difference in compiling seems to be the different relocation
> type for both symbols:

What is printed in the first case is the value of the $dp register.
For some reason, $global$ is not being subtracted from the symbol value
(zero).  This is a linker bug, not a gcc bug.

We probably should be using DPREL relocations for linux_foo.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)