From eb52651fe05ec65a3ca28b14d167b293c658fe9c Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 17 Jan 2023 01:17:44 +0000 Subject: [PATCH] Pass fewer link-only args to compilation clang --- genbindings.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/genbindings.sh b/genbindings.sh index de0df2e8..ed326fcc 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -110,18 +110,18 @@ if [ "$2" = "c_sharp" ]; then echo "Building C# bindings..." COMPILE="$COMMON_COMPILE -mcpu=$LDK_TARGET_CPU -Isrc/main/jni -pthread -fPIC" LINK="-ldl -shared" - [ "$IS_MAC" = "false" ] && COMPILE="$COMPILE -Wl,--no-undefined" + [ "$IS_MAC" = "false" ] && LINK="$LINK -Wl,--no-undefined" [ "$IS_MAC" = "true" ] && COMPILE="$COMPILE -mmacosx-version-min=10.9" [ "$IS_MAC" = "true" -a "$IS_APPLE_CLANG" = "false" ] && LINK="$LINK -fuse-ld=lld" [ "$IS_MAC" = "true" -a "$IS_APPLE_CLANG" = "false" ] && echo "WARNING: Need at least upstream clang 13!" - [ "$IS_MAC" = "false" -a "$3" != "false" ] && COMPILE="$COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,malloc -Wl,-wrap,free" + [ "$IS_MAC" = "false" -a "$3" != "false" ] && LINK="$LINK -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,malloc -Wl,-wrap,free" exit 0 # Sadly compilation doesn't currently work if [ "$3" = "true" ]; then $COMPILE $LINK -o liblightningjni_debug$LDK_TARGET_SUFFIX.so -g -fsanitize=address -shared-libasan -rdynamic -I"$1"/lightning-c-bindings/include/ $2 c_sharp/bindings.c "$1"/lightning-c-bindings/target/$LDK_TARGET/debug/libldk.a -lm else - $COMPILE -o bindings.o -c -flto -O3 -Wl,--version-script=c_sharp/libcode.version -I"$1"/lightning-c-bindings/include/ $2 c_sharp/bindings.c - $COMPILE $LINK -o liblightningjni_release$LDK_TARGET_SUFFIX.so -flto -O3 -Wl,--lto-O3 -Wl,-O3 -Wl,--version-script=c_sharp/libcode.version -I"$1"/lightning-c-bindings/include/ $2 bindings.o "$1"/lightning-c-bindings/target/$LDK_TARGET/release/libldk.a -lm + $COMPILE -o bindings.o -c -flto -O3 -I"$1"/lightning-c-bindings/include/ $2 c_sharp/bindings.c + $COMPILE $LINK -o liblightningjni_release$LDK_TARGET_SUFFIX.so -Wl,--version-script=c_sharp/libcode.version -flto -O3 -Wl,--lto-O3 -Wl,-O3 -Wl,--version-script=c_sharp/libcode.version -I"$1"/lightning-c-bindings/include/ $2 bindings.o "$1"/lightning-c-bindings/target/$LDK_TARGET/release/libldk.a -lm llvm-strip liblightningjni_release$LDK_TARGET_SUFFIX.so fi elif [ "$2" = "wasm" ]; then @@ -249,17 +249,17 @@ else echo "Building Java bindings..." COMPILE="$COMMON_COMPILE -mcpu=$LDK_TARGET_CPU -Isrc/main/jni -pthread -fPIC" LINK="-ldl -shared" - [ "$IS_MAC" = "false" ] && COMPILE="$COMPILE -Wl,--no-undefined" + [ "$IS_MAC" = "false" ] && LINK="$LINK -Wl,--no-undefined" [ "$IS_MAC" = "true" ] && COMPILE="$COMPILE -mmacosx-version-min=10.9" [ "$IS_MAC" = "true" -a "$IS_APPLE_CLANG" = "false" ] && LINK="$LINK -fuse-ld=lld" [ "$IS_MAC" = "true" -a "$IS_APPLE_CLANG" = "false" ] && echo "WARNING: Need at least upstream clang 13!" - [ "$IS_MAC" = "false" -a "$3" != "false" ] && COMPILE="$COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,malloc -Wl,-wrap,free" + [ "$IS_MAC" = "false" -a "$3" != "false" ] && LINK="$LINK -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,malloc -Wl,-wrap,free" if [ "$3" = "true" ]; then $COMPILE $LINK -o liblightningjni_debug$LDK_TARGET_SUFFIX.so -g -fsanitize=address -shared-libasan -rdynamic -I"$1"/lightning-c-bindings/include/ $2 src/main/jni/bindings.c "$1"/lightning-c-bindings/target/$LDK_TARGET/debug/libldk.a -lm else LDK_LIB="$1"/lightning-c-bindings/target/$LDK_TARGET/release/libldk.a if [ "$IS_MAC" = "false" -a "$4" = "false" ]; then - COMPILE="$COMPILE -Wl,--version-script=libcode.version -fuse-ld=lld" + LINK="$LINK -Wl,--version-script=libcode.version -fuse-ld=lld" # __cxa_thread_atexit_impl is used to more effeciently cleanup per-thread local storage by rust libstd. # However, it is not available on glibc versions 2.17 or earlier, and rust libstd has a null-check and # fallback in case it is missing. -- 2.39.5