This is the mail archive of the
mailing list for the binutils project.
Re: [GOLD] How can I add a undefined symbol in target implementation, not by "-u SYM" from command line ?
- From: Jiong WANG <wong dot kwongyuan at gmail dot com>
- To: binutils at sourceware dot org
- Cc: Ian Lance Taylor <iant at google dot com>
- Date: Mon, 13 Aug 2012 22:10:16 +0800
- Subject: Re: [GOLD] How can I add a undefined symbol in target implementation, not by "-u SYM" from command line ?
- References: <CA++uP6PDeCNCXwkwLXZEVE8tPsHUOGJH7MsCkK8nefUwqnBtmA@mail.gmail.com>
2012/8/13 Jiong WANG <email@example.com>:
> Hi All,
> How can I predefine a undefined symbol in target implementation?
> actually, I am porting gold for tilegx, and our arch's tls
> implementation requires predefiniation of "_tls_get_addr" because the
> assembler generate relocation which use this symbol implicitly.
> I know there are interfaces, "define_in_output_data/segment" to
> predefined symbol with value, but there is no interface to predefine
> "undefined" symbol ?
> gold linker do support this by command line "-u SYMBOL", but it's
> a compile time decision not link time.
> currently, I managed to support this by the following ugly code:
> options::parse_set(NULL, "_tls_get_addr",
> which is bad, so, could anyone give me some suggestion on this?
and it seems there is another problem:
the symbol "_tls_get_addr" should get a dynamic sym index in
.dynsym, but it not, just because it's added by the way of "-u XXX"
I suspect this is caused by gold linker generate .dynsym in a
relatively early stage, just after it analyze all relocations and
symtabs from .o files, so that if there are some other symbols added
in the middle of linking stage, and some other relocations generated
against them for dynamic linking, gold linker's .dynsym table does
Is this right? and how could we solve this problem?
thanks very much.
> thanks very much