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 #16444.

Patch by Robert Millan in the context of Debian.

llvm-svn: 185311
This commit is contained in:
Sylvestre Ledru 2013-07-01 08:07:52 +00:00
parent 9319db2ce9
commit 93a491bbf4
5 changed files with 27 additions and 9 deletions

View File

@ -275,10 +275,12 @@ ifeq ($(ENABLE_OPTIMIZED),1)
BuildMode := Release BuildMode := Release
# Don't use -fomit-frame-pointer on Darwin or FreeBSD. # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
ifneq ($(HOST_OS),FreeBSD) ifneq ($(HOST_OS),FreeBSD)
ifneq ($(HOST_OS),GNU/kFreeBSD)
ifneq ($(HOST_OS),Darwin) ifneq ($(HOST_OS),Darwin)
OmitFramePointer := -fomit-frame-pointer OmitFramePointer := -fomit-frame-pointer
endif endif
endif endif
endif
CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
@ -1451,7 +1453,7 @@ LD.Flags += -Wl,-exported_symbol,_main
endif endif
endif endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU)) ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU/kFreeBSD GNU))
ifneq ($(ARCH), Mips) ifneq ($(ARCH), Mips)
LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
endif endif

View File

@ -222,11 +222,16 @@ AC_CACHE_CHECK([type of operating system we're going to host on],
llvm_cv_no_link_all_option="-Wl,-noall_load" llvm_cv_no_link_all_option="-Wl,-noall_load"
llvm_cv_os_type="Minix" llvm_cv_os_type="Minix"
llvm_cv_platform_type="Unix" ;; llvm_cv_platform_type="Unix" ;;
*-*-freebsd* | *-*-kfreebsd-gnu) *-*-freebsd*)
llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="FreeBSD" llvm_cv_os_type="FreeBSD"
llvm_cv_platform_type="Unix" ;; llvm_cv_platform_type="Unix" ;;
*-*-kfreebsd-gnu)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="GNU/kFreeBSD"
llvm_cv_platform_type="Unix" ;;
*-*-openbsd*) *-*-openbsd*)
llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
@ -317,8 +322,10 @@ AC_CACHE_CHECK([type of operating system we're going to target],
llvm_cv_target_os_type="Darwin" ;; llvm_cv_target_os_type="Darwin" ;;
*-*-minix*) *-*-minix*)
llvm_cv_target_os_type="Minix" ;; llvm_cv_target_os_type="Minix" ;;
*-*-freebsd* | *-*-kfreebsd-gnu) *-*-freebsd*)
llvm_cv_target_os_type="FreeBSD" ;; llvm_cv_target_os_type="FreeBSD" ;;
*-*-kfreebsd-gnu)
llvm_cv_target_os_type="GNU/kFreeBSD" ;;
*-*-openbsd*) *-*-openbsd*)
llvm_cv_target_os_type="OpenBSD" ;; llvm_cv_target_os_type="OpenBSD" ;;
*-*-netbsd*) *-*-netbsd*)

11
llvm/configure vendored
View File

@ -3826,11 +3826,16 @@ else
llvm_cv_no_link_all_option="-Wl,-noall_load" llvm_cv_no_link_all_option="-Wl,-noall_load"
llvm_cv_os_type="Minix" llvm_cv_os_type="Minix"
llvm_cv_platform_type="Unix" ;; llvm_cv_platform_type="Unix" ;;
*-*-freebsd* | *-*-kfreebsd-gnu) *-*-freebsd*)
llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="FreeBSD" llvm_cv_os_type="FreeBSD"
llvm_cv_platform_type="Unix" ;; llvm_cv_platform_type="Unix" ;;
*-*-kfreebsd-gnu)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="GNU/kFreeBSD"
llvm_cv_platform_type="Unix" ;;
*-*-openbsd*) *-*-openbsd*)
llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
@ -3927,8 +3932,10 @@ else
llvm_cv_target_os_type="Darwin" ;; llvm_cv_target_os_type="Darwin" ;;
*-*-minix*) *-*-minix*)
llvm_cv_target_os_type="Minix" ;; llvm_cv_target_os_type="Minix" ;;
*-*-freebsd* | *-*-kfreebsd-gnu) *-*-freebsd*)
llvm_cv_target_os_type="FreeBSD" ;; llvm_cv_target_os_type="FreeBSD" ;;
*-*-kfreebsd-gnu)
llvm_cv_target_os_type="GNU/kFreeBSD" ;;
*-*-openbsd*) *-*-openbsd*)
llvm_cv_target_os_type="OpenBSD" ;; llvm_cv_target_os_type="OpenBSD" ;;
*-*-netbsd*) *-*-netbsd*)

View File

@ -208,10 +208,12 @@ ifeq ($(ENABLE_OPTIMIZED),1)
BuildMode := Release BuildMode := Release
# Don't use -fomit-frame-pointer on Darwin or FreeBSD. # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
ifneq ($(HOST_OS),FreeBSD) ifneq ($(HOST_OS),FreeBSD)
ifneq ($(HOST_OS),GNU/kFreeBSD)
ifneq ($(HOST_OS),Darwin) ifneq ($(HOST_OS),Darwin)
OmitFramePointer := -fomit-frame-pointer OmitFramePointer := -fomit-frame-pointer
endif endif
endif endif
endif
# Darwin requires -fstrict-aliasing to be explicitly enabled. # Darwin requires -fstrict-aliasing to be explicitly enabled.
# Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues
@ -1372,7 +1374,7 @@ LD.Flags += -Wl,-exported_symbol,_main
endif endif
endif endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD)) ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU/kFreeBSD))
ifneq ($(ARCH), Mips) ifneq ($(ARCH), Mips)
LD.Flags += -Wl,--version-script=$(PROJ_SRC_ROOT)/autoconf/ExportMap.map LD.Flags += -Wl,--version-script=$(PROJ_SRC_ROOT)/autoconf/ExportMap.map
endif endif

View File

@ -62,18 +62,18 @@ ifeq ($(HOST_OS),Darwin)
endif endif
endif endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD GNU Bitrig)) ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU/kFreeBSD OpenBSD GNU Bitrig))
# Include everything from the .a's into the shared library. # Include everything from the .a's into the shared library.
LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \ LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
-Wl,--no-whole-archive -Wl,--no-whole-archive
endif endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU)) ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU/kFreeBSD GNU))
# Add soname to the library. # Add soname to the library.
LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT) LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT)
endif endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU)) ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU GNU/kFreeBSD))
# Don't allow unresolved symbols. # Don't allow unresolved symbols.
LLVMLibsOptions += -Wl,--no-undefined LLVMLibsOptions += -Wl,--no-undefined
endif endif