From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113726 invoked by alias); 16 Feb 2017 22:54:21 -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 113716 invoked by uid 89); 16 Feb 2017 22:54:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*MI:sk:50c2f5a, collision, H*f:sk:50c2f5a, H*i:sk:50c2f5a X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Feb 2017 22:54:19 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 825FE3D942; Thu, 16 Feb 2017 22:54:19 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 896822D5C8; Thu, 16 Feb 2017 22:54:17 +0000 (UTC) Subject: Re: [PATCH 1/8] Rename read_unsigned_leb128 to gdb_read_unsigned_leb128 To: Jan Kratochvil References: <148693097396.9024.2288256732840761882.stgit@host1.jankratochvil.net> <463df715-da64-57a4-3237-99826918def1@redhat.com> <20170216194026.GA30138@host1.jankratochvil.net> <50c2f5aa-dedf-5c32-438f-1f9023795ec0@redhat.com> Cc: gdb-patches@sourceware.org, Victor Leschuk From: Pedro Alves Message-ID: Date: Thu, 16 Feb 2017 22:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <50c2f5aa-dedf-5c32-438f-1f9023795ec0@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-02/txt/msg00457.txt.bz2 On 02/16/2017 08:00 PM, Pedro Alves wrote: > On 02/16/2017 07:40 PM, Jan Kratochvil wrote: >> On Thu, 16 Feb 2017 16:23:51 +0100, Pedro Alves wrote: >>> Can't we just use bfd's version? >> >> bfd's version is in libbfd.c: >> /* Assorted BFD support routines, only used internally. >> and libbfd.h: >> /* libbfd.h -- Declarations used by bfd library *implementation*. >> (This include file is not for users of the library.) >> >> And I think GDB is a user of libbfd library. >> >> (One could argue libbfd should use visibility and/or C++ namespaces but for >> historical reasons libbfd does not use either.) >> >> I do not mind any solution, I have just complied with the libbfd policy. >> > > Bah, there are copies of leb128 reading code all over the toolchain. > binutils/ has read_leb128, gold/ has read_unsigned_LEB_128, gcc > has a copy or two as well. And then the bfd version (and gdb's > version, which seems to have been copied from bfd's) needs a bfd > pointer, but it's not really necessary. Cleaning this all > up quickly falls out of scope, so... > > Patch is OK. Actually, I think visibility wouldn't work given bfd is linked statically. And C++ namespaces are out of question obviously given bfd is written in C. That leaves avoiding namespace collision by renaming something, but I think that given that it's bfd that is a library, that it should be bfd that should have its internal-with-external-linkage symbols renamed, giving them a "_bfd_" prefix, as other internal symbols have. I quickly hacked up a mini-series to rename these plus a few others I noticed by playing with nm + grep. I'll post it to binutils@ in a bit. Thanks, Pedro Alves