[Lldb-commits] [lldb] r185313 - Following the modification introduced in llvm by commit 185311

Sylvestre Ledru sylvestre at debian.org
Mon Jul 1 01:21:36 PDT 2013


Author: sylvestre
Date: Mon Jul  1 03:21:36 2013
New Revision: 185313

URL: http://llvm.org/viewvc/llvm-project?rev=185313&view=rev
Log:
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.


Modified:
    lldb/trunk/include/lldb/Host/Config.h
    lldb/trunk/lib/Makefile
    lldb/trunk/source/Host/Makefile
    lldb/trunk/source/Host/common/Host.cpp
    lldb/trunk/source/Plugins/Makefile
    lldb/trunk/source/Plugins/Platform/Makefile
    lldb/trunk/source/Plugins/Process/POSIX/Makefile
    lldb/trunk/tools/driver/Makefile
    lldb/trunk/tools/lldb-platform/Makefile

Modified: lldb/trunk/include/lldb/Host/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Config.h?rev=185313&r1=185312&r2=185313&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Config.h (original)
+++ lldb/trunk/include/lldb/Host/Config.h Mon Jul  1 03:21:36 2013
@@ -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"
 

Modified: lldb/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=185313&r1=185312&r2=185313&view=diff
==============================================================================
--- lldb/trunk/lib/Makefile (original)
+++ lldb/trunk/lib/Makefile Mon Jul  1 03:21:36 2013
@@ -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

Modified: lldb/trunk/source/Host/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/Makefile?rev=185313&r1=185312&r2=185313&view=diff
==============================================================================
--- lldb/trunk/source/Host/Makefile (original)
+++ lldb/trunk/source/Host/Makefile Mon Jul  1 03:21:36 2013
@@ -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
 

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=185313&r1=185312&r2=185313&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Mon Jul  1 03:21:36 2013
@@ -149,7 +149,7 @@ MonitorChildProcessThreadFunction (void
     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, ll
             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::s
     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 ProcessInstan
 }
 #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))

Modified: lldb/trunk/source/Plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Makefile?rev=185313&r1=185312&r2=185313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Makefile (original)
+++ lldb/trunk/source/Plugins/Makefile Mon Jul  1 03:21:36 2013
@@ -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
 

Modified: lldb/trunk/source/Plugins/Platform/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Makefile?rev=185313&r1=185312&r2=185313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Makefile (original)
+++ lldb/trunk/source/Plugins/Platform/Makefile Mon Jul  1 03:21:36 2013
@@ -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

Modified: lldb/trunk/source/Plugins/Process/POSIX/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/Makefile?rev=185313&r1=185312&r2=185313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/Makefile (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/Makefile Mon Jul  1 03:21:36 2013
@@ -24,7 +24,7 @@ CPPFLAGS += -I$(PROJ_SRC_DIR)/$(LLDB_LEV
 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

Modified: lldb/trunk/tools/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Makefile?rev=185313&r1=185312&r2=185313&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Makefile (original)
+++ lldb/trunk/tools/driver/Makefile Mon Jul  1 03:21:36 2013
@@ -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
 

Modified: lldb/trunk/tools/lldb-platform/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-platform/Makefile?rev=185313&r1=185312&r2=185313&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-platform/Makefile (original)
+++ lldb/trunk/tools/lldb-platform/Makefile Mon Jul  1 03:21:36 2013
@@ -18,6 +18,6 @@ ifeq ($(HOST_OS),Darwin)
 	LLVMLibsOptions += -Wl,-rpath, at 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





More information about the lldb-commits mailing list