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

Commit 6165aba

Browse files
committed
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 500c0af commit 6165aba

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
@@ -144,9 +144,12 @@ endif()
144144

145145
# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
146146
# build might work on ELF but fail on MachO/COFF.
147-
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
148-
${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
149-
${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
147+
if(NOT (${TARGET_TRIPLE} MATCHES "darwin" OR
148+
${TARGET_TRIPLE} MATCHES "windows" OR
149+
${TARGET_TRIPLE} MATCHES "mingw" OR
150+
${TARGET_TRIPLE} MATCHES "freebsd" OR
151+
${TARGET_TRIPLE} MATCHES "netbsd" OR
152+
${TARGET_TRIPLE} MATCHES "openbsd") AND
150153
NOT LLVM_USE_SANITIZER)
151154
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
152155
endif()

tools/dsymutil/DwarfLinker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ PointerIntPair<DeclContext *, 1> DeclContextTree::getChildDeclContext(
16531653
File);
16541654
(void)gotFileName;
16551655
assert(gotFileName && "Must get file name from line table");
1656-
#ifdef HAVE_REALPATH
1656+
#if defined(HAVE_REALPATH) && defined(PATH_MAX)
16571657
char RealPath[PATH_MAX + 1];
16581658
RealPath[PATH_MAX] = 0;
16591659
if (::realpath(File.c_str(), RealPath))

0 commit comments

Comments
 (0)