On Wed, Oct 10, 2012 at 12:30 PM, Andreas Tobler
<andreast-l...@fgznet.ch> wrote:
> On 10.10.12 17:36, Ian Lance Taylor wrote:
>>
>> On Wed, Oct 10, 2012 at 6:45 AM, Andreas Tobler <andreast-l...@fgznet.ch>
>> wrote:
>>>
>>>
>>> FreeBSD has already defined the various Elf_ stuff for 32 and 64-bit
>>> targets.
>>>
>>> Currently compilation in libbacktrace fails due to redefinition of these:
>>>
>>> - Elf_Ehdr
>>> - Elf_Sym
>>> - Elf_Shdr
>>>
>>> I 'fixed' this with ifndef'ing. See below.
>>
>>
>> I don't think that is the right patch.  I think the right patch is to
>> unconditionally rename the structs in libbacktrace/elf.c.  Do you want
>> to try a patch along those lines?
>
>
> Np.
>
>
>> I suppose we might want to rename the types as well.  It's nice to use
>> the same names as the ELF ABI, but I guess that conflicts with system
>> header files are too likely.
>
>
> On the quick I did it this way, etc.
>
> -      const Elf_Shdr *strtab_shdr;
> +      const elf_shdr *strtab_shdr;
>
> If we keep small letters then we're consistent with the other variables in
> this file.
>
> Or do you prefer some fancier names?

Thanks.  I decided that starting with b_elf would be safer.  I wrote
the patch and committed it to mainline.  Bootstrapped and ran
libbacktrace testsuite on x86_64-unknown-linux-gnu.  Please let me
know if there are still problems on FreeBSD.

Ian


2012-10-10  Ian Lance Taylor  <i...@google.com>

        * elf.c: Rename all Elf typedefs to start with b_elf, and be all
        lower case.

Attachment: foo.patch
Description: Binary data

Reply via email to