[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ld reloc error
From: |
Alan Modra |
Subject: |
Re: ld reloc error |
Date: |
Wed, 21 Apr 2004 14:39:03 +0930 |
User-agent: |
Mutt/1.4i |
On Tue, Apr 20, 2004 at 10:46:04AM -0400, address@hidden wrote:
> I define a global symbol, onetwothree=0x123 in defit.s. I reference it in
> another file, refit.s.
>
> If I link everything as one big executable, it comes out as 0x123 in the
> both the definition and reference files, which is what I want.
>
> If I put both the definition and reference in a shareable (.so) file, the
> reference gets relocated by the base of the shareable, which isn't right.
> The definition remains as 0x123, it does not get relocated.
Yes, this is a known problem that likely will not be fixed soon. To
fix it, you'd need to modify glibc's ld.so to not relocate absolute syms
at run time. That can't be done at the moment because ld emits some
absolute symbols that _do_ need to be relocated, eg. your .so has
12: 00001444 0 OBJECT GLOBAL DEFAULT ABS _DYNAMIC
16: 000014e8 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
18: 00000123 0 OBJECT GLOBAL DEFAULT ABS onetwothree
19: 000014e8 0 NOTYPE GLOBAL DEFAULT ABS _edata
20: 000014dc 0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
21: 000014e8 0 NOTYPE GLOBAL DEFAULT ABS _end
All of these need relocating relative to the start of the library,
except your onetwothree symbol.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
- ld reloc error, wmrieker, 2004/04/20
- Re: ld reloc error,
Alan Modra <=