diff options
author | Sven Gothel <[email protected]> | 2015-01-30 20:50:02 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-01-30 20:50:02 +0100 |
commit | 3caf446e29a3934900b9983dfd72cb8aa0d9e8d7 (patch) | |
tree | 6400dad527db09db50b6f3691f22ec3c85acd7c6 | |
parent | 6eba192bec7cc6258fbc0c97b448fe4a4d45de9a (diff) |
Bug 1122: Reflect __LP64__ and _aarch64__ in GlueGen's stdint/stddef and Android compilerflags
-rwxr-xr-x | make/gluegen-cpptasks-base.xml | 9 | ||||
-rw-r--r-- | make/lib/gluegen-cpptasks-android-aarch64.xml | 44 | ||||
-rw-r--r-- | make/lib/gluegen-cpptasks-android-armv6.xml | 40 | ||||
-rw-r--r-- | make/lib/gluegen-cpptasks-android-armv7.xml | 1 | ||||
-rw-r--r-- | make/stub_includes/platform/glibc-compat-symbols.h | 8 | ||||
-rw-r--r-- | make/stub_includes/platform/gluegen_stddef.h | 2 | ||||
-rw-r--r-- | make/stub_includes/platform/gluegen_stdint.h | 2 |
7 files changed, 80 insertions, 26 deletions
diff --git a/make/gluegen-cpptasks-base.xml b/make/gluegen-cpptasks-base.xml index e896fc0..58c539c 100755 --- a/make/gluegen-cpptasks-base.xml +++ b/make/gluegen-cpptasks-base.xml @@ -986,6 +986,8 @@ <compilerarg value="-fPIC"/> <compilerarg value="-m64"/> <defineset> + <define name="__LP64__" /> <!-- default pre-defined macro for 64bit unix --> + <define name="__unix__"/> <define name="__X11__" if="isX11"/> <define name="_DEBUG" if="c.compiler.use-debug"/> @@ -1015,6 +1017,9 @@ <compiler id="compiler.cfg.linux.aarch64" name="${gcc.compat.compiler}"> <defineset> + <define name="__LP64__" /> <!-- default pre-defined macro for 64bit unix --> + <define name="__aarch64__" /> <!-- default pre-defined macro for armv8-a, 64bit --> + <define name="__unix__"/> <define name="__X11__" if="isX11"/> <define name="_DEBUG" if="c.compiler.use-debug"/> @@ -1104,6 +1109,8 @@ <!-- compilerarg value="-xarch=amd64" / --> <!-- compilerarg value="-xcache=64/64/2:1024/64/16" / --> <defineset> + <define name="__LP64__" /> <!-- default pre-defined macro for 64bit unix --> + <define name="__unix__"/> <define name="__X11__" if="isX11"/> <define name="_DEBUG" if="c.compiler.use-debug"/> @@ -1170,6 +1177,8 @@ <compilerarg value="-O0" if="c.compiler.use-debug"/> <compilerarg value="-O2" unless="c.compiler.use-debug"/> <defineset> + <define name="__LP64__" /> <!-- default pre-defined macro for 64bit unix --> + <define name="_DEBUG" if="c.compiler.use-debug"/> <define name="DEBUG" if="c.compiler.use-debug"/> <define name="NDEBUG" unless="c.compiler.use-debug"/> diff --git a/make/lib/gluegen-cpptasks-android-aarch64.xml b/make/lib/gluegen-cpptasks-android-aarch64.xml index 7096ecc..fcf2875 100644 --- a/make/lib/gluegen-cpptasks-android-aarch64.xml +++ b/make/lib/gluegen-cpptasks-android-aarch64.xml @@ -41,25 +41,34 @@ NOTE: This is not necessary if using '$TARGET_TRIPLE-gcc' from $NDK_TOOLCHAIN_ROOT/bin. --> <compilerarg value="-B${env.NDK_TOOLCHAIN_ROOT}/libexec/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}" /> + <compilerarg value="-fpic" /> + <!-- compilerarg value="-fPIE" / --> <!-- not for shared libs, won't produce symbols --> + <!-- compilerarg value="-pie" / --> <!-- not for shared libs, won't produce symbols --> <compilerarg value="-ffunction-sections" /> <compilerarg value="-funwind-tables" /> <compilerarg value="-fstack-protector" /> - <compilerarg value="-fpic" /> + <!-- compilerarg value="-no-canonical-prefixes" / --> <!-- will disallow creating shared library --> + <compilerarg value="-Wa,--noexecstack" /> - <compilerarg value="-mabi=lp64" /> + + <!-- compilerarg value="-mabi=lp64" /> <compilerarg value="-mlittle-endian" /> - <compilerarg value="-march=armv8-a" /> + <compilerarg value="-march=armv8-a" / --> <!-- compilerarg value="-mfloat-abi=softfp" / --> - <compilerarg value="-g" if="c.compiler.use-debug" /> - <compilerarg value="-O0" if="c.compiler.use-debug" /> - <compilerarg value="-Os" unless="c.compiler.use-debug" /> - <!--<compilerarg value="-O2" /> --> + <!-- Generic ARM Flags --> + <compilerarg value="-O2" unless="c.compiler.use-debug" /> + <!-- compilerarg value="-g" unless="c.compiler.use-debug" / --> + <compilerarg value="-fomit-frame-pointer" unless="c.compiler.use-debug"/> + <compilerarg value="-fstrict-aliasing" unless="c.compiler.use-debug"/> + <compilerarg value="-funswitch-loops" unless="c.compiler.use-debug"/> + <compilerarg value="-finline-limit=300" unless="c.compiler.use-debug"/> + + <compilerarg value="-O0" if="c.compiler.use-debug" /> + <compilerarg value="-g" if="c.compiler.use-debug" /> + <compilerarg value="-fno-omit-frame-pointer" if="c.compiler.use-debug" /> + <compilerarg value="-fno-strict-aliasing" if="c.compiler.use-debug" /> - <compilerarg value="-fomit-frame-pointer" /> - <compilerarg value="-fno-strict-aliasing" /> - <!-- compilerarg value="-finline-limit=64" /--> - <compilerarg value="-Wa,--noexecstack" /> <includepath path="${env.NDK_TOOLCHAIN_ROOT}/lib/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}/include" /> <!-- for stdarg.h --> <defineset> <define name="__unix__" /> @@ -67,6 +76,9 @@ <define name="__ARM_ARCH_5T__" /> <define name="__ARM_ARCH_5E__" /> <define name="__ARM_ARCH_5TE__" / --> + <define name="__LP64__" /> <!-- default pre-defined macro for 64bit unix --> + <define name="__aarch64__" /> <!-- default pre-defined macro for armv8-a, 64bit --> + <define name="ANDROID" /> <define name="_DEBUG" if="c.compiler.use-debug"/> <define name="DEBUG" if="c.compiler.use-debug"/> @@ -76,12 +88,17 @@ <linker id="linker.cfg.android" name="gcc"> <linkerarg value="--sysroot=${env.TARGET_PLATFORM_ROOT}" /> + <linkerarg value="-fpic" /> + <!-- linkerarg value="-fPIE" / --> <!-- not for shared libs, won't produce symbols --> + <!-- linkerarg value="-pie" / --> <!-- not for shared libs, won't produce symbols --> + <!-- linkerarg value="-no-canonical-prefixes" / --> <!-- will disallow creating shared library --> + <linkerarg value="-fno-use-linker-plugin" /> - <linkerarg value="-mabi=lp64" /> + <!-- linkerarg value="-mabi=lp64" /> <linkerarg value="-mlittle-endian" /> - <linkerarg value="-march=armv8-a" /> + <linkerarg value="-march=armv8-a" / --> <!-- linkerarg value="-mfloat-abi=softfp" / --> <linkerarg value="-nostdlib" /> @@ -99,6 +116,7 @@ enforce that libgcc is linked after source files but before other shared libraries. --> <libset dir="${env.NDK_TOOLCHAIN_ROOT}/lib/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}" libs="gcc" /> + <!-- libset libs="c,m,dl,log" / --> <libset libs="c,m,dl" /> </linker> diff --git a/make/lib/gluegen-cpptasks-android-armv6.xml b/make/lib/gluegen-cpptasks-android-armv6.xml index 733f623..bcb3f53 100644 --- a/make/lib/gluegen-cpptasks-android-armv6.xml +++ b/make/lib/gluegen-cpptasks-android-armv6.xml @@ -40,24 +40,38 @@ NOTE: This is not necessary if using '$TARGET_TRIPLE-gcc' from $NDK_TOOLCHAIN_ROOT/bin. --> <compilerarg value="-B${env.NDK_TOOLCHAIN_ROOT}/libexec/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}" /> + <compilerarg value="-fpic" /> <compilerarg value="-ffunction-sections" /> <compilerarg value="-funwind-tables" /> <compilerarg value="-fstack-protector" /> - <compilerarg value="-fpic" /> + <!-- compilerarg value="-no-canonical-prefixes" / --> <!-- will disallow creating shared library --> + <compilerarg value="-Wa,--noexecstack" /> <compilerarg value="-march=armv6" /> <compilerarg value="-mfloat-abi=softfp" /> <compilerarg value="-marm" /> - <compilerarg value="-g" if="c.compiler.use-debug" /> - <compilerarg value="-O0" if="c.compiler.use-debug" /> - <compilerarg value="-Os" unless="c.compiler.use-debug" /> - <!--<compilerarg value="-O2" /> --> + <!-- Generic ARM Flags --> + <compilerarg value="-O2" unless="c.compiler.use-debug" /> + <!-- compilerarg value="-g" unless="c.compiler.use-debug" /--> + <compilerarg value="-fomit-frame-pointer" unless="c.compiler.use-debug"/> + <compilerarg value="-fstrict-aliasing" unless="c.compiler.use-debug"/> + <compilerarg value="-funswitch-loops" unless="c.compiler.use-debug"/> + <compilerarg value="-finline-limit=300" unless="c.compiler.use-debug"/> + + <!-- THUMB Flags .. + <compilerarg value="-Os" unless="c.compiler.use-debug" /> + <compilerarg value="-g" unless="c.compiler.use-debug" /> + <compilerarg value="-fomit-frame-pointer" unless="c.compiler.use-debug"/> + <compilerarg value="-fno-strict-aliasing" unless="c.compiler.use-debug" /> + <compilerarg value="-finline-limit=64" unless="c.compiler.use-debug"/> + --> + + <compilerarg value="-O0" if="c.compiler.use-debug" /> + <compilerarg value="-g" if="c.compiler.use-debug" /> + <compilerarg value="-fno-omit-frame-pointer" if="c.compiler.use-debug" /> + <compilerarg value="-fno-strict-aliasing" if="c.compiler.use-debug" /> - <compilerarg value="-fomit-frame-pointer" /> - <compilerarg value="-fno-strict-aliasing" /> - <compilerarg value="-finline-limit=64" /> - <compilerarg value="-Wa,--noexecstack" /> <includepath path="${env.NDK_TOOLCHAIN_ROOT}/lib/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}/include" /> <!-- for stdarg.h --> <defineset> <define name="__unix__" /> @@ -74,7 +88,14 @@ <linker id="linker.cfg.android" name="gcc"> <linkerarg value="--sysroot=${env.TARGET_PLATFORM_ROOT}" /> + <linkerarg value="-fpic" /> + <linkerarg value="-ffunction-sections" /> + <linkerarg value="-funwind-tables" /> + <linkerarg value="-fstack-protector" /> + <!-- linkerarg value="-no-canonical-prefixes" / --> <!-- will disallow creating shared library --> + <linkerarg value="-Wa,--noexecstack" /> + <linkerarg value="-fno-use-linker-plugin" /> <linkerarg value="-march=armv6" /> @@ -96,6 +117,7 @@ enforce that libgcc is linked after source files but before other shared libraries. --> <libset dir="${env.NDK_TOOLCHAIN_ROOT}/lib/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}" libs="gcc" /> + <!-- libset libs="c,m,dl,log" / --> <libset libs="c,m,dl" /> </linker> diff --git a/make/lib/gluegen-cpptasks-android-armv7.xml b/make/lib/gluegen-cpptasks-android-armv7.xml index d854d4f..d13c190 100644 --- a/make/lib/gluegen-cpptasks-android-armv7.xml +++ b/make/lib/gluegen-cpptasks-android-armv7.xml @@ -96,6 +96,7 @@ enforce that libgcc is linked after source files but before other shared libraries. --> <libset dir="${env.NDK_TOOLCHAIN_ROOT}/lib/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}/armv7-a" libs="gcc" /> + <!-- libset libs="c,m,dl,log" / --> <libset libs="c,m,dl" /> </linker> diff --git a/make/stub_includes/platform/glibc-compat-symbols.h b/make/stub_includes/platform/glibc-compat-symbols.h index 3599b82..1163c78 100644 --- a/make/stub_includes/platform/glibc-compat-symbols.h +++ b/make/stub_includes/platform/glibc-compat-symbols.h @@ -17,7 +17,9 @@ */ #if defined(__linux__) /* Actually we like to test whether we link against GLIBC .. */ #if defined(__GNUC__) - #if defined(__arm__) + #if defined(__aarch64__) + #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.4"); + #elif defined(__arm__) #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.4"); #elif defined(__amd64__) #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.2.5"); @@ -25,7 +27,9 @@ #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.0"); #endif /*__amd64__*/ #elif defined(__clang__) - #if defined(__arm__) + #if defined(__aarch64__) + #define GLIBC_COMPAT_SYMBOL(FFF) asm(".symver " #FFF "," #FFF "@GLIBC_2.4"); + #elif defined(__arm__) #define GLIBC_COMPAT_SYMBOL(FFF) asm(".symver " #FFF "," #FFF "@GLIBC_2.4"); #elif defined(__amd64__) #define GLIBC_COMPAT_SYMBOL(FFF) asm(".symver " #FFF "," #FFF "@GLIBC_2.2.5"); diff --git a/make/stub_includes/platform/gluegen_stddef.h b/make/stub_includes/platform/gluegen_stddef.h index 6272bd1..1500684 100644 --- a/make/stub_includes/platform/gluegen_stddef.h +++ b/make/stub_includes/platform/gluegen_stddef.h @@ -15,7 +15,7 @@ #elif defined(_WIN32) typedef __int32 ptrdiff_t; typedef unsigned __int32 size_t; -#elif defined(__ia64__) || defined(__x86_64__) +#elif defined(__LP64__) || defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__) typedef long ptrdiff_t; typedef unsigned long size_t; #else diff --git a/make/stub_includes/platform/gluegen_stdint.h b/make/stub_includes/platform/gluegen_stdint.h index 8b1dbe3..b277817 100644 --- a/make/stub_includes/platform/gluegen_stdint.h +++ b/make/stub_includes/platform/gluegen_stdint.h @@ -33,7 +33,7 @@ typedef __int32 intptr_t; typedef unsigned __int32 uintptr_t; -#elif defined(__ia64__) || defined(__x86_64__) +#elif defined(__LP64__) || defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__) typedef signed char int8_t; typedef unsigned char uint8_t; typedef signed short int16_t; |