From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5837 invoked by alias); 25 Jan 2011 07:20:55 -0000 Received: (qmail 5826 invoked by uid 22791); 25 Jan 2011 07:20:54 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail.apical.co.uk (HELO srv1.office.apical.co.uk) (213.106.251.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Jan 2011 07:20:49 +0000 Received: from [10.250.148.115] (23.nat.acronis.net [91.195.22.23]) (authenticated bits=0) by srv1.office.apical.co.uk (8.14.4/8.14.4) with ESMTP id p0P7KdG8005772 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 25 Jan 2011 07:20:41 GMT Message-ID: <4D3E7692.4000500@sw.ru> Date: Tue, 25 Jan 2011 07:20:00 -0000 From: Vladimir Simonov User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 To: Ian Lance Taylor CC: binutils@sourceware.org Subject: gold doesn't accept object file as script Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2011-01/txt/msg00342.txt.bz2 Hi Ian, According "man ld" "If the linker cannot recognize the format of an object file, it will assume that it is a linker script." But gold doesn't follow above. For details, see test case below. Briefly, the command "gcc -fuse-ld=gold -o a.4 -shared exports.ld a.a" if exports.ld is linker script leads to warning "exports.ld:1:8: ignoring command OPTION; OPTION is only valid for scripts specified via -T/--script" and resulted shared library doesn't contain func_a. exports.ld contains only EXTERN(func_a) This feature is used to link func_a (located in static library) into shared one. Is it by gold design or a bug? Should I file it or it is duplicate? What is the best way to workaround the problem? --Wl,--undefined=func_a? Thank you in advance Vladimir Simonov $ cat exports.ld EXTERN(func_a) $ cat b.sh #!/bin/bash PREF=/opt/gcc-4.4.3-glibc-2.3.2/bin/i686-unknown-linux-gnu- rm -f a.o a.a a.1 a.2 a.3 a.4 ${PREF}gcc -c -o a.o -fPIC a.c ${PREF}ar rcs a.a a.o echo Build shared from obj by bfd ${PREF}gcc -o a.1 -shared a.o ${PREF}readelf -a a.1 | grep func_a echo Build shared from lib by bfd ${PREF}gcc -o a.2 -shared exports.ld a.a ${PREF}readelf -a a.2 | grep func_a echo Build shared from obj by gold ${PREF}gcc -fuse-ld=gold -o a.3 -shared a.o ${PREF}readelf -a a.3 | grep func_a echo Build shared from lib by gold ${PREF}gcc -fuse-ld=gold -o a.4 -shared exports.ld a.a ${PREF}readelf -a a.4 | grep func_a echo DONE $ ./b.sh Build shared from obj by bfd 1: 000003dc 38 FUNC GLOBAL DEFAULT 10 func_a 44: 000003dc 38 FUNC GLOBAL DEFAULT 10 func_a Build shared from lib by bfd 1: 000003dc 38 FUNC GLOBAL DEFAULT 10 func_a 44: 000003dc 38 FUNC GLOBAL DEFAULT 10 func_a Build shared from obj by gold 6: 0000043c 38 FUNC GLOBAL DEFAULT 11 func_a 27: 0000043c 38 FUNC GLOBAL DEFAULT 11 func_a Build shared from lib by gold /opt/gcc-4.4.3-glibc-2.3.2/bin/../lib/gcc/i686-unknown-linux-gnu/4.4.3/../../../../i686-unknown-linux-gnu/bin/ld.gold: warning: exports.ld:1:8: ignoring command OPTION; OPTION is only valid for scripts specified via -T/--script DONE