Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit a88d694

Browse files
alexcrichtonarielb1
authored andcommitted
Fix cross-compiling to FreeBSD
* When testing whether we need to pass `-Wl,-z,defs` the cmake files currently tests for FreeBSD, but only if the host system is FreeBSD. Instead we should test whether the target that we're compiling is FreeBSD so we correctly deduce that it should not be passed. * The `PATH_MAX` constant is defined in a different place for the dsymutil tool, so we just config that code out for now as it apparently doesn't include the right header?
1 parent 01e00ed commit a88d694

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cmake/modules/HandleLLVMOptions.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,12 @@ endif()
105105

106106
# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
107107
# build might work on ELF but fail on MachO/COFF.
108-
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
109-
${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
110-
${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
108+
if(NOT (${TARGET_TRIPLE} MATCHES "darwin" OR
109+
${TARGET_TRIPLE} MATCHES "windows" OR
110+
${TARGET_TRIPLE} MATCHES "mingw" OR
111+
${TARGET_TRIPLE} MATCHES "freebsd" OR
112+
${TARGET_TRIPLE} MATCHES "netbsd" OR
113+
${TARGET_TRIPLE} MATCHES "openbsd") AND
111114
NOT LLVM_USE_SANITIZER)
112115
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
113116
endif()

tools/dsymutil/DwarfLinker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ PointerIntPair<DeclContext *, 1> DeclContextTree::getChildDeclContext(
16471647
File);
16481648
(void)gotFileName;
16491649
assert(gotFileName && "Must get file name from line table");
1650-
#ifdef HAVE_REALPATH
1650+
#if defined(HAVE_REALPATH) && defined(PATH_MAX)
16511651
char RealPath[PATH_MAX + 1];
16521652
RealPath[PATH_MAX] = 0;
16531653
if (::realpath(File.c_str(), RealPath))

0 commit comments

Comments
 (0)