[cfe-commits] [patch] Use the system unwind.h when that's available

Jeffrey Yasskin jyasskin at gmail.com
Sat Feb 18 20:21:05 PST 2012


On Sat, Feb 18, 2012 at 8:05 PM, Chandler Carruth <chandlerc at google.com> wrote:
> On Sat, Feb 18, 2012 at 7:36 PM, Jeffrey Yasskin <jyasskin at gmail.com> wrote:
>>
>> When trying to build libcxxabi on linux, I discovered that clang's
>> unwind.h doesn't provide enough definitions. This patch allows linux
>> builds to take advantage of libunwind if that's installed.
>>
>> Another option would be to just copy the interfaces out of
>>
>> http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libgcc-s-ddefs.html,
>> but since we're relying on the system to provide definitions anyway,
>> it seems more sensible to try to pull the interface from the system
>> too.
>
>
> Personally, I'd rather see us do all of the above. Use libunwind's header if
> present, and provide the right interfaces otherwise. Still, this patch is
> clearly an improvement.

Is it ok to just copy from LSB? It appears to be under the GFDL, but
interfaces may not be copyrightable.

> Can you only define _GNU_SOURCE (and associated silliness) on Linux? Or
> would BSDs need this as well? Essentially, I'd like to only define
> _GNU_SOURCE if absolutely necessary.

Presumably the BSDs wouldn't refer to _GNU_SOURCE in their headers, so
it'd be harmless. Or the BSDs might use libunwind (it's MIT licensed),
in which case we need to define _GNU_SOURCE after all.

> Can we name _SHOULD_UNDEFINE_GNU_SOURCE something still less likely to
> collide? I could see exactly that macro used in other GNU_SOURCE
> manipulating contexts...

But hopefully with the same meaning, in which case this use will just work.

> Maybe just prefix with _CLANG_UNWIND_H? No strong
> opinion here.

No opinion here either. If no one else with an opinion shows up, I'll
add the _CLANG_UNWIND_H prefix.




More information about the cfe-commits mailing list