From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4118 invoked by alias); 13 Aug 2012 15:21:26 -0000 Received: (qmail 4110 invoked by uid 22791); 13 Aug 2012 15:21:24 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-yw0-f41.google.com (HELO mail-yw0-f41.google.com) (209.85.213.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 13 Aug 2012 15:21:11 +0000 Received: by yhr47 with SMTP id 47so3588184yhr.0 for ; Mon, 13 Aug 2012 08:21:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=jgQC3IN8EnQp7PCmM81AyRAft8wBtFo6MCYEz1lNA20=; b=SbeDSSsqietDfPzpgSaO/ne58UMdzjOUO6WSw0bJHlJJwj0coes113alKVwVfP4C3P OX4rw57j1D2rHR+junv+6ludPszx1enBWbU7Yrb/YJrbAdTFLCpRaDCePqPws1JVZeio MX/LuSlpvvqeRXskHt8bHYV93Mqirfe2UV43wSCpuOph0NxbWZu2MUgmbsStU5vCOnmN Ee1PoVK9RC/9anGlvKovq8tdFJfrUia1/CJOjaAn3zA/Al3ZondrTC/BlWNLR63c9NlZ NPAdopGPF9cGLsaovf5oVCVEvB0tVshLG4TB/q+HCPvw+I+dTLPHJs7CcsjnjtHUfeD3 G9vA== Received: by 10.68.221.70 with SMTP id qc6mr20742275pbc.92.1344871270635; Mon, 13 Aug 2012 08:21:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.221.70 with SMTP id qc6mr20742270pbc.92.1344871270523; Mon, 13 Aug 2012 08:21:10 -0700 (PDT) Received: by 10.68.8.9 with HTTP; Mon, 13 Aug 2012 08:21:10 -0700 (PDT) In-Reply-To: References: Date: Mon, 13 Aug 2012 15:39:00 -0000 Message-ID: Subject: Re: [GOLD] How can I add a undefined symbol in target implementation, not by "-u SYM" from command line ? From: Ian Lance Taylor To: Jiong WANG Cc: binutils@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-Gm-Message-State: ALoCoQnV/NKl1/VCkwBz3+K69yOn3zRODh8nZEPovCqVxcPva5mRmbIGW4xhZD/wtW0gwoF+R60kJG6u5kOnigIehp9mP3hZOrxL69MX9fWx3waT6SxX+vHFSiwJ/OXvXQMnOrZlgM72rtluhSNaiJA73fArPv7fb+4MO/gg0yANWz0IRuMjOM285x/mAB0P/l2sjtlnEzSS X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00232.txt.bz2 On Mon, Aug 13, 2012 at 3:25 AM, Jiong WANG 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