Following the modification introduced in llvm by commit 185311

The build system is currently miss-identifying GNU/kFreeBSD as FreeBSD.
This kind of simplification is sometimes useful, but in general it's not correct. 

As GNU/kFreeBSD is an hybrid system, for kernel-related issues we want to match the
build definitions used for FreeBSD, whereas for userland-related issues we want to
match the definitions used for other systems with Glibc.

The current modification adjusts the build system so that they can be distinguished,
and explicitly adds GNU/kFreeBSD to the build checks in which it belongs.

Fixes bug #16446.

Patch by Robert Millan in the context of Debian.

llvm-svn: 185313
This commit is contained in:
Sylvestre Ledru 2013-07-01 08:21:36 +00:00
parent 103b51c72e
commit 594058394e
9 changed files with 24 additions and 16 deletions

View File

@ -18,7 +18,7 @@
#include "lldb/Host/linux/Config.h"
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
#include "lldb/Host/freebsd/Config.h"

View File

@ -100,7 +100,7 @@ ifeq ($(HOST_OS),Linux)
lldbPluginDynamicLoaderMacOSX.a
endif
ifeq ($(HOST_OS),FreeBSD)
ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
USEDLIBS += lldbHostFreeBSD.a \
lldbPluginProcessPOSIX.a \
lldbPluginProcessFreeBSD.a
@ -133,7 +133,7 @@ ifeq ($(HOST_OS),Darwin)
endif
endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU))
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU GNU/kFreeBSD))
# Include everything from the .a's into the shared library.
ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
-Wl,--no-whole-archive

View File

@ -21,7 +21,7 @@ ifeq ($(HOST_OS),Linux)
DIRS += linux
endif
ifeq ($(HOST_OS),FreeBSD)
ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
DIRS += freebsd
endif

View File

@ -149,7 +149,7 @@ MonitorChildProcessThreadFunction (void *arg)
delete info;
int status = -1;
#if defined (__FreeBSD__)
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
#define __WALL 0
#endif
const int options = __WALL;
@ -522,7 +522,7 @@ Host::WillTerminate ()
{
}
#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__linux__) // see macosx/Host.mm
#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) && !defined (__linux__) // see macosx/Host.mm
void
Host::ThreadCreated (const char *thread_name)
@ -542,7 +542,7 @@ Host::GetEnvironment (StringList &env)
return 0;
}
#endif // #if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__linux__)
#endif // #if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) && !defined (__linux__)
struct HostThreadCreateInfo
{
@ -682,7 +682,7 @@ Host::SetThreadName (lldb::pid_t pid, lldb::tid_t tid, const char *name)
return true;
}
return false;
#elif defined (__linux__)
#elif defined (__linux__) || defined (__GLIBC__)
void *fn = dlsym (RTLD_DEFAULT, "pthread_setname_np");
if (fn)
{
@ -740,7 +740,7 @@ Host::GetProgramFileSpec ()
exe_path[len] = 0;
g_program_filespec.SetFile(exe_path, false);
}
#elif defined (__FreeBSD__)
#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
int exe_path_mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid() };
size_t exe_path_size;
if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0)
@ -1178,7 +1178,7 @@ Host::GetGroupName (uint32_t gid, std::string &group_name)
return NULL;
}
#if !defined (__APPLE__) && !defined (__FreeBSD__) // see macosx/Host.mm
#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) // see macosx/Host.mm
bool
Host::GetOSBuildString (std::string &s)
{
@ -1227,7 +1227,7 @@ Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstance
}
#endif // #if !defined (__APPLE__) && !defined(__linux__)
#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined(__linux__)
#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) && !defined(__linux__)
bool
Host::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info)
{
@ -1441,7 +1441,7 @@ Host::GetNumberCPUS ()
static uint32_t g_num_cores = UINT32_MAX;
if (g_num_cores == UINT32_MAX)
{
#if defined(__APPLE__) or defined (__linux__) or defined (__FreeBSD__)
#if defined(__APPLE__) or defined (__linux__) or defined (__FreeBSD__) or defined (__FreeBSD_kernel__)
g_num_cores = ::sysconf(_SC_NPROCESSORS_ONLN);
@ -1458,7 +1458,11 @@ Host::GetNumberCPUS ()
g_num_cores = 0;
int num_cores = 0;
size_t num_cores_len = sizeof(num_cores);
#ifdef HW_AVAILCPU
int mib[] = { CTL_HW, HW_AVAILCPU };
#else
int mib[] = { CTL_HW, HW_NCPU };
#endif
/* get the number of CPUs from the system */
if (sysctl(mib, sizeof(mib)/sizeof(int), &num_cores, &num_cores_len, NULL, 0) == 0 && (num_cores > 0))

View File

@ -36,7 +36,7 @@ DIRS += DynamicLoader/MacOSX-DYLD
DIRS += Process/Linux Process/POSIX
endif
ifeq ($(HOST_OS),FreeBSD)
ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
DIRS += Process/FreeBSD Process/POSIX
endif

View File

@ -24,5 +24,9 @@ DIRS := gdb-server MacOSX Linux FreeBSD
# ifeq ($(HOST_OS),FreeBSD)
# DIRS += FreeBSD
# endif
#
# ifeq ($(HOST_OS),GNU/kFreeBSD)
# DIRS += FreeBSD
# endif
include $(LLDB_LEVEL)/Makefile

View File

@ -24,7 +24,7 @@ CPPFLAGS += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/Linux
CPPFLAGS += -Wno-extended-offsetof
endif
ifeq ($(HOST_OS),FreeBSD)
ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
# Extend the include path so we may locate ProcessMonitor
CPPFLAGS += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/FreeBSD
endif

View File

@ -21,7 +21,7 @@ ifeq ($(HOST_OS),Darwin)
LLVMLibsOptions += -Wl,-sectcreate -Wl,__TEXT -Wl,__info_plist -Wl,"$(PROJ_SRC_DIR)/lldb-Info.plist"
endif
ifeq ($(HOST_OS),Linux)
ifneq (,$(filter $(HOST_OS), Linux GNU/kFreeBSD))
LLVMLibsOptions += -Wl,-rpath,$(LibDir)
endif

View File

@ -18,6 +18,6 @@ ifeq ($(HOST_OS),Darwin)
LLVMLibsOptions += -Wl,-rpath,@loader_path/../lib/
endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD))
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU/kFreeBSD))
LLVMLibsOptions += -Wl,-rpath,$(LibDir)
endif