From 554b34927cd6a2e0c0ce227108ebf8521bcba889 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 21 Apr 2013 08:29:17 +0200 Subject: Add 'cmake/glibc-compat-symbols.h' to force usage of minimal GLIBC symbols currently for memcpy only, used in our x86_32 and default gcc toolchain cmake file. Note: JogAmp's minimum GLIBC is 2.4 due to '__stack_chk_fail' (stack overflow checking) GLIBC 2.4 - March 2006 - Standard for LSB 4.0, Used in SLES 10 We could add compile/link option '-fno-stack-protector', however stack protection seems reasonable and a pre 2006 distribution a bit too 'far fetched' for our multimedia bindings anyway. --- cmake/glibc-compat-symbols.h | 15 +++++++++++++++ cmake/toolchain.gcc-default.cmake | 5 +++++ cmake/toolchain.gcc-x86_32.cmake | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 cmake/glibc-compat-symbols.h (limited to 'cmake') diff --git a/cmake/glibc-compat-symbols.h b/cmake/glibc-compat-symbols.h new file mode 100644 index 00000000..482e2326 --- /dev/null +++ b/cmake/glibc-compat-symbols.h @@ -0,0 +1,15 @@ +#ifndef __GLIBC_COMPAT_SYMBOLS_H__ +#define __GLIBC_COMPAT_SYMBOLS_H__ 1 + +/** + * add other architecures below + */ +#ifdef __amd64__ + #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.2.5"); +#else + #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.0"); +#endif /*__amd64__*/ + +GLIBC_COMPAT_SYMBOL(memcpy) + +#endif /*__GLIBC_COMPAT_SYMBOLS_H__*/ diff --git a/cmake/toolchain.gcc-default.cmake b/cmake/toolchain.gcc-default.cmake index 0f3c4ff6..3b2c9cfd 100644 --- a/cmake/toolchain.gcc-default.cmake +++ b/cmake/toolchain.gcc-default.cmake @@ -1,5 +1,10 @@ # For normal gcc compilation, but use static-libgcc +set(CMAKE_C_FLAGS "-include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h") + +set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") + set(LINKER_FLAGS "-static-libgcc") set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) diff --git a/cmake/toolchain.gcc-x86_32.cmake b/cmake/toolchain.gcc-x86_32.cmake index 33dee0e8..890f6e11 100644 --- a/cmake/toolchain.gcc-x86_32.cmake +++ b/cmake/toolchain.gcc-x86_32.cmake @@ -4,7 +4,7 @@ set(CMAKE_SYSTEM_PROCESSOR "x86") link_directories("/usr/lib32") -set(CMAKE_C_FLAGS "-m32") +set(CMAKE_C_FLAGS "-m32 -include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h") set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") -- cgit v1.2.3