From owner-freebsd-current@FreeBSD.ORG Wed Feb 23 02:03:20 2011 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1E39106564A; Wed, 23 Feb 2011 02:03:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id A7CC38FC0A; Wed, 23 Feb 2011 02:03:19 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:794d:2247:36f9:4086] (unknown [IPv6:2001:7b8:3a7:0:794d:2247:36f9:4086]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B4D615C59; Wed, 23 Feb 2011 03:03:08 +0100 (CET) Message-ID: <4D646ADC.9090804@FreeBSD.org> Date: Wed, 23 Feb 2011 03:03:08 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.15pre) Gecko/20110221 Lanikai/3.1.9pre MIME-Version: 1.0 To: Jung-uk Kim References: <201102221423.30652.jkim@FreeBSD.org> In-Reply-To: <201102221423.30652.jkim@FreeBSD.org> Content-Type: multipart/mixed; boundary="------------090008070301020106080100" Cc: Rui Paulo , freebsd-current@FreeBSD.org Subject: Re: binutils 2.17.50 and ctfconvert X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Feb 2011 02:03:20 -0000 This is a multi-part message in MIME format. --------------090008070301020106080100 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2011-02-22 20:23, Jung-uk Kim wrote: > Since binutils 2.17.50 import, WITH_CTF=1& buildworld on amd64 stops > like this: ... > cc -m32 -march=i686 -mmmx -msse -msse2 -mfancy-math-387 -DCOMPAT_32BIT > -isystem /usr/obj/usr/src/lib32/usr/include/ > -L/usr/obj/usr/src/lib32/usr/lib32 > -B/usr/obj/usr/src/lib32/usr/lib32 -fpic -DPIC -O2 -pipe > -fno-omit-frame-pointer -I/usr/src/lib/librt/../libc/include > -I/usr/src/lib/librt -fexceptions -Winline -Wall -g -std=gnu99 > -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k > -Wno-uninitialized -Wno-pointer-sign -c /usr/src/lib/librt/aio.c -o > aio.So > ctfconvert -L VERSION aio.o ... > BFD: aio.So: invalid SHT_GROUP entry > BFD: aio.So: invalid SHT_GROUP entry > BFD: aio.So: no group info for section .text.__i686.get_pc_thunk.cx > BFD: aio.So: no group info for section .text.__i686.get_pc_thunk.bx > BFD: aio.So: unknown [0] section `' in group [__i686.get_pc_thunk.cx] > BFD: aio.So: unknown [0] section `' in group [__i686.get_pc_thunk.bx] > nm: aio.So: File format not recognized ... > Google found NetBSD has a similar looking PR but it is not exactly the > same: > > http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=42986 What I gather from that bug report is that apparently ctfconvert can corrupt object files with debug info, if you do not pass -g to it. There is some logic in bsd.lib.mk to add '-g' to CTFFLAGS, if DEBUG_FLAGS contains '-g', but in lib/librt/Makefile you can see: ... CFLAGS+=-Winline -Wall -g ... It looks like the -g flag is not detected, so ctfconvert is run without -g, and it corrupts the .So file. I have no clue yet why this suddenly appears after upgrading to binutils 2.17.50, but it is likely due to a slightly different output format. In any case, just removing the -g from CFLAGS in lib/librt/Makefile made the build32 stage complete successfully for me, and since that is the lsat stage of the amd64 build, I assume the rest will be OK too. For now, I propose to commit the attached diff, and then we try to find out why: 1) ctfconvert does not get -g passed when it is needed 2) ctfconvert corrupts .o files when -g is not passed :) --------------090008070301020106080100 Content-Type: text/plain; name="librt-ctf-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="librt-ctf-1.diff" Index: lib/librt/Makefile =================================================================== --- lib/librt/Makefile (revision 218951) +++ lib/librt/Makefile (working copy) @@ -6,7 +6,7 @@ .ifndef NO_THREAD_STACK_UNWIND CFLAGS+=-fexceptions .endif -CFLAGS+=-Winline -Wall -g +CFLAGS+=-Winline -Wall DPADD= ${LIBPTHREAD} LDADD= -lpthread --------------090008070301020106080100--