SPEC2006: Allow building on FreeBSD
For FreeBSD, we also have to pass -DSPEC_CPU_MACOSX to avoid the use of
gcvt() in 400.perlbench as this function is not available on FreeBSD.
This define is also required to successfully build 462.libquantum and
483.xalancbmk since SPEC_CPU_BSD is not handled in those benchmarks.
Reviewed By: Meinersbur, fhahn
Differential Revision: https://reviews.llvm.org/D124393
diff --git a/External/SPEC/SpecCPU2006.cmake b/External/SPEC/SpecCPU2006.cmake
index 5b682b9..94fd0e8 100644
--- a/External/SPEC/SpecCPU2006.cmake
+++ b/External/SPEC/SpecCPU2006.cmake
@@ -22,6 +22,16 @@
list(APPEND CPPFLAGS -DSPEC_CPU_MACOSX)
elseif(TARGET_OS STREQUAL "Linux")
list(APPEND CPPFLAGS -DSPEC_CPU_LINUX)
+ elseif(TARGET_OS STREQUAL "FreeBSD")
+ list(APPEND CPPFLAGS -DSPEC_CPU_BSD)
+ # As support for SPEC_CPU_BSD is incomplete in SPEC2006, we also have to
+ # pass -DSPEC_CPU_MACOSX to avoid the use of gcvt() in 400.perlbench as
+ # this function is not available on FreeBSD. Additionally, this define
+ # ensures that all required functions are compiled in 483.xalancbmk and
+ # that complex.h is included in 462.libquantum.
+ list(APPEND CPPFLAGS -DSPEC_CPU_MACOSX)
+ else()
+ message(WARNING "Unsupported SPEC2006 TARGET_OS: ${TARGET_OS}")
endif()
if(ARCH STREQUAL "x86")