summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Meyer <cse.cem@gmail.com>2018-01-26 13:31:21 -0800
committerJan Vorlicek <janvorli@microsoft.com>2018-01-26 22:31:21 +0100
commitc8fef83569d8b39b7d8a634579d75b091980d9e9 (patch)
tree9256e228e7251c1ef42a95009417fe4da3c478d0
parentd08b5fd08ea73bebe4acd1af842ef8f212429944 (diff)
downloadcoreclr-c8fef83569d8b39b7d8a634579d75b091980d9e9.tar.gz
coreclr-c8fef83569d8b39b7d8a634579d75b091980d9e9.tar.bz2
coreclr-c8fef83569d8b39b7d8a634579d75b091980d9e9.zip
Fix FreeBSD build and update build instructions (#15998)
Move test code include in global CMakeLists before PAL runtime includes to avoid conflicts between PAL and system headers. (ForeignThreadExceptionsNative.cpp -> thread -> functional -> memory -> cassert -> pal rt "assert.h".) Drop no longer needed remove_definitions lines -- they're only set by the clrdefinitions.cmake include later in the file. Update build instructions to include needed components (ninja, lttng-ust, python27). Add missing ElfW() definition when libunwind does not define it. FreeBSD alloca() is defined in stdlib.h, so include that instead of alloca.h on FreeBSD.
-rw-r--r--CMakeLists.txt19
-rw-r--r--Documentation/building/freebsd-instructions.md3
-rw-r--r--src/pal/src/exception/remote-unwind.cpp3
-rw-r--r--src/pal/src/numa/numa.cpp4
4 files changed, 17 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8057d67a28..e59995ddcf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -588,6 +588,13 @@ if(WIN32)
add_compile_options(/Zl) # omit default library name in .OBJ
endif(WIN32)
+#------------------------------
+# Add Test Directory
+#------------------------------
+if(CLR_CMAKE_BUILD_TESTS)
+ add_subdirectory(tests)
+endif(CLR_CMAKE_BUILD_TESTS)
+
#--------------------------------
# Definition directives
# - all clr specific compile definitions should be included in this file
@@ -622,16 +629,4 @@ set(BuildToolsDir "${CLR_CMAKE_PACKAGES_DIR}/Microsoft.DotNet.BuildTools.CoreCLR
#------------------------------
add_subdirectory(src)
-#------------------------------
-# Add Test Directory
-#------------------------------
-if(CLR_CMAKE_BUILD_TESTS)
- # remove some definitions for test build
- remove_definitions(-D_SECURE_SCL=0)
- remove_definitions(-DUNICODE)
- remove_definitions(-D_UNICODE)
-
- add_subdirectory(tests)
-endif(CLR_CMAKE_BUILD_TESTS)
-
include(definitionsconsistencycheck.cmake)
diff --git a/Documentation/building/freebsd-instructions.md b/Documentation/building/freebsd-instructions.md
index e925f6b539..9d29a930cb 100644
--- a/Documentation/building/freebsd-instructions.md
+++ b/Documentation/building/freebsd-instructions.md
@@ -23,6 +23,9 @@ Install the following packages for the toolchain:
- libunwind
- gettext
- icu
+- ninja (optional)
+- lttng-ust
+- python27
To install the packages you need:
diff --git a/src/pal/src/exception/remote-unwind.cpp b/src/pal/src/exception/remote-unwind.cpp
index 18733ded52..33920eaca8 100644
--- a/src/pal/src/exception/remote-unwind.cpp
+++ b/src/pal/src/exception/remote-unwind.cpp
@@ -63,6 +63,9 @@ SET_DEFAULT_DEBUG_CHANNEL(EXCEPT);
#include <elf.h>
#include <link.h>
+#ifndef ElfW
+#define ElfW(foo) Elf_ ## foo
+#endif
#define Ehdr ElfW(Ehdr)
#define Phdr ElfW(Phdr)
#define Shdr ElfW(Shdr)
diff --git a/src/pal/src/numa/numa.cpp b/src/pal/src/numa/numa.cpp
index 17b71abd89..9b2de94b2b 100644
--- a/src/pal/src/numa/numa.cpp
+++ b/src/pal/src/numa/numa.cpp
@@ -31,7 +31,11 @@ SET_DEFAULT_DEBUG_CHANNEL(NUMA);
#include <pthread.h>
#include <dlfcn.h>
+#ifdef __FreeBSD__
+#include <stdlib.h>
+#else
#include <alloca.h>
+#endif
#include <algorithm>