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

Commit be89e4b

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 deb2692 commit be89e4b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cmake/modules/HandleLLVMOptions.cmake

+5-3
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ endif()
131131

132132
# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
133133
# build might work on ELF but fail on MachO/COFF.
134-
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
135-
${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
136-
${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
134+
if(NOT (${TARGET_TRIPLE} MATCHES "darwin" OR
135+
${TARGET_TRIPLE} MATCHES "windows" OR
136+
${TARGET_TRIPLE} MATCHES "freebsd" OR
137+
${TARGET_TRIPLE} MATCHES "netbsd" OR
138+
${TARGET_TRIPLE} MATCHES "openbsd") AND
137139
NOT LLVM_USE_SANITIZER)
138140
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
139141
endif()

tools/dsymutil/DwarfLinker.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ PointerIntPair<DeclContext *, 1> DeclContextTree::getChildDeclContext(
16351635
File)) {
16361636
Line = DIE->getAttributeValueAsUnsignedConstant(
16371637
&U.getOrigUnit(), dwarf::DW_AT_decl_line, 0);
1638-
#ifdef HAVE_REALPATH
1638+
#if defined(HAVE_REALPATH) && defined(PATH_MAX)
16391639
// Cache the resolved paths, because calling realpath is expansive.
16401640
if (const char *ResolvedPath = U.getResolvedPath(FileNum)) {
16411641
File = ResolvedPath;

0 commit comments

Comments
 (0)