mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
united the static fat runtime dispatcher with the BSD support.
This commit is contained in:
@@ -15,13 +15,21 @@ SYMSFILE=$(mktemp -p /tmp ${PREFIX}_rename.syms.XXXXX)
|
||||
KEEPSYMS=$(mktemp -p /tmp keep.syms.XXXXX)
|
||||
# find the libc used by gcc
|
||||
LIBC_SO=$("$@" --print-file-name=libc.so.6)
|
||||
NM_FLAG="-f"
|
||||
if [ `uname` = "FreeBSD" ]; then
|
||||
# for freebsd, we will specify the name,
|
||||
# we will leave it work as is in linux
|
||||
LIBC_SO=/lib/libc.so.7
|
||||
# also, in BSD, the nm flag -F corresponds to the -f flag in linux.
|
||||
NM_FLAG="-F"
|
||||
fi
|
||||
cp ${KEEPSYMS_IN} ${KEEPSYMS}
|
||||
# get all symbols from libc and turn them into patterns
|
||||
nm -f p -g -D ${LIBC_SO} | sed -s 's/\([^ @]*\).*/^\1$/' >> ${KEEPSYMS}
|
||||
nm ${NM_FLAG} p -g -D ${LIBC_SO} | sed 's/\([^ @]*\).*/^\1$/' >> ${KEEPSYMS}
|
||||
# build the object
|
||||
"$@"
|
||||
# rename the symbols in the object
|
||||
nm -f p -g ${OUT} | cut -f1 -d' ' | grep -v -f ${KEEPSYMS} | sed -e "s/\(.*\)/\1\ ${PREFIX}_\1/" >> ${SYMSFILE}
|
||||
nm ${NM_FLAG} p -g ${OUT} | cut -f1 -d' ' | grep -v -f ${KEEPSYMS} | sed -e "s/\(.*\)/\1\ ${PREFIX}_\1/" >> ${SYMSFILE}
|
||||
if test -s ${SYMSFILE}
|
||||
then
|
||||
objcopy --redefine-syms=${SYMSFILE} ${OUT}
|
||||
|
@@ -4,14 +4,13 @@ endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set(FREEBSD true)
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
||||
set(NETBSD true)
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
||||
|
||||
if (LINUX AND (ARCH_IA32 OR ARCH_X86_64))
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON)
|
||||
else()
|
||||
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" OFF)
|
||||
@@ -19,26 +18,22 @@ endif()
|
||||
|
||||
if (FAT_RUNTIME)
|
||||
message("Checking Fat Runtime Requirements...")
|
||||
if (NOT LINUX)
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Linux OS")
|
||||
else()
|
||||
if (USE_CPU_NATIVE AND FAT_RUNTIME)
|
||||
message(FATAL_ERROR "Fat runtime is not compatible with Native CPU detection")
|
||||
endif()
|
||||
if (USE_CPU_NATIVE AND FAT_RUNTIME)
|
||||
message(FATAL_ERROR "Fat runtime is not compatible with Native CPU detection")
|
||||
endif()
|
||||
|
||||
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
|
||||
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
|
||||
else()
|
||||
message(STATUS "Building Fat runtime for multiple microarchitectures")
|
||||
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
||||
if (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
|
||||
(CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
|
||||
message (FATAL_ERROR "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
|
||||
else()
|
||||
message(STATUS "Building Fat runtime for multiple microarchitectures")
|
||||
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
||||
if (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
|
||||
(CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
|
||||
message (FATAL_ERROR "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
|
||||
else()
|
||||
include (${CMAKE_MODULE_PATH}/attrib.cmake)
|
||||
if (NOT HAS_C_ATTR_IFUNC)
|
||||
message(FATAL_ERROR "Compiler does not support ifunc attribute, cannot build fat runtime")
|
||||
endif()
|
||||
include (${CMAKE_MODULE_PATH}/attrib.cmake)
|
||||
if (NOT HAS_C_ATTR_IFUNC)
|
||||
message(FATAL_ERROR "Compiler does not support ifunc attribute, cannot build fat runtime")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user