This is the mail archive of the
binutils@sourceware.org
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: Ian Lance Taylor <iant at google dot com>
- To: Jiong WANG <wong dot kwongyuan at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 13 Aug 2012 08:21:10 -0700
- 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>
On Mon, Aug 13, 2012 at 3:25 AM, Jiong WANG <wong.kwongyuan@gmail.com> wrote:
>
> 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",
> (gold::options::String_set*)¶meters->options().undefined());
>
> which is bad, so, could anyone give me some suggestion on this?
I assume that the symbol is defined somewhere. You probably want to
add a do_is_defined_by_abi method to your Target. See the examples in
existing targets.
Ian