This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/8] Rename read_unsigned_leb128 to gdb_read_unsigned_leb128
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