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: SYMTAB and DYNSYM tables relationship question


On 07/01/2010 04:35 AM, Ian Lance Taylor wrote:
Vladimir Simonov<sv@sw.ru> writes:

I have ELF executable (EXE) dynamically linked with DSO (SO) on
some dos-like OS with ELF support. Some symbol A (FUNC GLOBAL DEFAULT)
is referenced only from SO(not from EXE itself). After link
(by ld, binutils 2.20.1) EXE contains info about symbol A only
in DYNSYM table. There is nothing about A in SYMTAB and .rel.text.
As result our runtime linker is unable to find symbol A during SO
loading. If I reference A from EXE, A appears in SYMTAB, DYNSYM
and .rel.text and runtime works OK.

Questions:
1. Must symbol A be in SYMTAB and .rel.text if it is not
referenced from EXE directly? By other words, is the problem
in ld or in runtime linker?

An ELF dynamic linker can be implemented to look only at the dynamic symbol table. In fact, an ELF dynamic linker should normally not look at the normal symbol at all. So I think there is something wrong with your dynamic linker.

2. If the problem is in runtime linker, then is it possible
to force such records creation without explicit reference on A
from EXE sources? Via ld's version-script, may be options...

I'm not aware of any way to do this.


Ian


Thank you for answers.


In reality all not so simple - our dos-like OS EXE requires TEXT and PLT
sections relocation (a program works in physical address space and can't
be loaded at desired address).

Investigations show that "strip --strip-all" and even "strip --strip-unneeded"
remove symtab and necessary relocation sections. As I understand EXE's "text"
relocation can't be done without symtab because relocation entry references
symtab.

Currently, looks like "strip --strip-debug --discard-all" keeps
all required info. Runtime somehow works :)

Thanks again
Regards
Vladimir Simonov


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