mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
Fat runtime
This commit is contained in:
@@ -11,7 +11,8 @@ else ()
|
||||
endif ()
|
||||
|
||||
|
||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS}")
|
||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ARCH_C_FLAGS}")
|
||||
|
||||
# ensure we have the minimum of SSSE3 - call a SSSE3 intrinsic
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
int main() {
|
||||
@@ -19,10 +20,6 @@ int main() {
|
||||
(void)_mm_shuffle_epi8(a, a);
|
||||
}" HAVE_SSSE3)
|
||||
|
||||
if (NOT HAVE_SSSE3)
|
||||
message(FATAL_ERROR "A minimum of SSSE3 compiler support is required")
|
||||
endif ()
|
||||
|
||||
# now look for AVX2
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
#if !defined(__AVX2__)
|
||||
@@ -34,9 +31,5 @@ int main(){
|
||||
(void)_mm256_xor_si256(z, z);
|
||||
}" HAVE_AVX2)
|
||||
|
||||
if (NOT HAVE_AVX2)
|
||||
message(STATUS "Building without AVX2 support")
|
||||
endif ()
|
||||
|
||||
unset (CMAKE_REQUIRED_FLAGS)
|
||||
unset (INTRIN_INC_H)
|
||||
|
3
cmake/attrib.cmake
Normal file
3
cmake/attrib.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
# tests for compiler properties
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("int foo(int) __attribute__ ((ifunc(\"foo_i\"))); int f1(int i) { return i; } void (*foo_i()) { return f1; } int main(void) { return 0; }" HAS_C_ATTR_IFUNC)
|
27
cmake/build_wrapper.sh
Executable file
27
cmake/build_wrapper.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh -e
|
||||
# This is used for renaming symbols for the fat runtime, don't call directly
|
||||
# TODO: make this a lot less fragile!
|
||||
PREFIX=$1
|
||||
KEEPSYMS_IN=$2
|
||||
shift 2
|
||||
BUILD=$@
|
||||
OUT=$(echo $BUILD | sed 's/.* -o \(.*\.o\).*/\1/')
|
||||
SYMSFILE=/tmp/${PREFIX}_rename.syms.$$
|
||||
KEEPSYMS=/tmp/keep.syms.$$
|
||||
# grab the command without the target obj or src file flags
|
||||
# we don't just call gcc directly as there may be flags modifying the arch
|
||||
CC_CMD=$(echo $BUILD | sed 's/ -o .*\.o//;s/ -c //;s/ .[^ ]*\.c//;')
|
||||
# find me a libc
|
||||
LIBC_SO=$(${CC_CMD} --print-file-name=libc.so.6)
|
||||
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}
|
||||
# build the object
|
||||
${BUILD}
|
||||
# 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}
|
||||
if test -s ${SYMSFILE}
|
||||
then
|
||||
objcopy --redefine-syms=${SYMSFILE} ${OUT}
|
||||
fi
|
||||
rm -f ${SYMSFILE} ${KEEPSYMS}
|
@@ -15,6 +15,9 @@
|
||||
/* internal build, switch on dump support. */
|
||||
#cmakedefine DUMP_SUPPORT
|
||||
|
||||
/* Define if building "fat" runtime. */
|
||||
#cmakedefine FAT_RUNTIME
|
||||
|
||||
/* Define to 1 if `backtrace' works. */
|
||||
#cmakedefine HAVE_BACKTRACE
|
||||
|
||||
|
11
cmake/keep.syms.in
Normal file
11
cmake/keep.syms.in
Normal file
@@ -0,0 +1,11 @@
|
||||
# names to exclude
|
||||
hs_misc_alloc
|
||||
hs_misc_free
|
||||
hs_free_scratch
|
||||
hs_stream_alloc
|
||||
hs_stream_free
|
||||
hs_scratch_alloc
|
||||
hs_scratch_free
|
||||
hs_database_alloc
|
||||
hs_database_free
|
||||
^_
|
Reference in New Issue
Block a user