[lldb-dev] Pre-processor definition confusion

Ed Maste emaste at freebsd.org
Fri Sep 12 10:14:47 PDT 2014


On 12 September 2014 12:59, Zachary Turner <zturner at google.com> wrote:
> The important thing seems to be whether glibc implies linux, not the other
> way around.

It doesn't -- Debian k/FreeBSD has __GLIBC__ and __FreeBSD_kernel__,
and not __linux__.

> The issue is that all of our CMake decisions are based on OS platform.  If I
> want to conditionally compile an entire file based on one of these
> conditions, I need to translate it into something that fits well into the
> CMake build.

That should be fine, although in some cases there won't be a mapping
to a single OS if multiple macros are used.

An OS to macro map would include, for example:

FreeBSD: __FreeBSD__, __FreeBSD_kernel__
Linux distros: __linux__, __GLIBC__
kFreeBSD: __GLIBC__, __FreeBSD_kernel__

The kFreeBSD project needs to use the FreeBSD kernel's debugging
interface (e.g., the ptrace syscall and constants) and glibc's
userland interfaces (e.g., setting thread names).



More information about the lldb-dev mailing list