From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111934 invoked by alias); 11 Sep 2018 14:13:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 111641 invoked by uid 89); 11 Sep 2018 14:13:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RDNS_DYNAMIC,TVD_RCVD_IP autolearn=no version=3.3.2 spammy=Hx-languages-length:1774 X-HELO: brightrain.aerifal.cx Received: from 216-12-86-13.cv.mvl.ntelos.net (HELO brightrain.aerifal.cx) (216.12.86.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Sep 2018 14:13:24 +0000 Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1fzjPk-0006ey-00; Tue, 11 Sep 2018 14:13:12 +0000 Date: Tue, 11 Sep 2018 14:13:00 -0000 From: Rich Felker To: Pedro Alves Cc: Sergio Durigan Junior , Romain Naour , Thomas Petazzoni , Romain Naour , buildroot@buildroot.org, gdb-patches@sourceware.org Subject: Re: [Buildroot] [PATCH 2/2] package/gdb: use stat() privided by the system Message-ID: <20180911141312.GU1878@brightrain.aerifal.cx> References: <20180909163750.14196-1-romain.naour@gmail.com> <20180909163750.14196-2-romain.naour@gmail.com> <20180910174900.0b9f4133@windsurf> <20180910224128.GT1878@brightrain.aerifal.cx> <87lg88oolv.fsf@redhat.com> <13772de6-1197-4182-e13f-3b4f27dfa22d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13772de6-1197-4182-e13f-3b4f27dfa22d@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2018-09/txt/msg00337.txt.bz2 On Tue, Sep 11, 2018 at 10:51:20AM +0100, Pedro Alves wrote: > On 09/11/2018 01:38 AM, Sergio Durigan Junior wrote: > > > This is happening because, before the commit mentioned above, > > 'common-utils.c' (which gets transformed into 'common-utils-ipa.c' > > during the gdbserver build) wasn't calling 'stat'. It doesn't seem like > > a regression; it seems like a hidden problem that was uncovered by the > > need of 'stat'. > > > > I don't know why this problem is manifesting only when compiling IPA, > > and not when compiling 'common-utils.c' during GDB's/gdbserver's build. > > Because the IPA doesn't link with gnulib. And the answer to that wouldn't > be as simple as "just link it in", because the IPA objects are supposed > to be compiled with -fPIC and -fvisibility=hidden. So we'd need a third > build of gnulib for the IPA. > > It doesn't seem like this code that calls stat (is_regular_file?) is > useful for the IPA, so a quicker/simpler fix would be to simply move > that function out of common-utils.c into some other file that is not > shared with the IPA. Eew, I just looked up what IPA is. Yes, it's buggy to be including gnulib headers in files used for this unless you have another copy compiled with hidden visibility. Alternatively, you could put all the gnulib files into a static archive and link with -Wl,--exclude-libs=ALL to make them hidden at link-time, without having to compile them again. As an aside, the whole idea of running in-process code referencing/using functions in the process being debugged (like stat in libc) seems fragile and broken; perhaps aside from this inadvertently-added use in is_regular_file, there is no such code in the IPA stuff? Rich