Drop reallocarray wrapper, enforcing that we don't need it
authorMatt Corallo <git@bluematt.me>
Fri, 24 Sep 2021 22:01:34 +0000 (22:01 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 25 Sep 2021 06:49:02 +0000 (06:49 +0000)
genbindings.sh

index d40539c18006c918b991b8aa00fe024a7a5cf05a..7bf369f5a4df3da54304d90f9515063275d2bb85 100755 (executable)
@@ -91,7 +91,7 @@ echo "Building Java bindings..."
 COMPILE="$COMMON_COMPILE -mcpu=$LDK_TARGET_CPU -Isrc/main/jni -pthread -ldl -shared -fPIC"
 [ "$IS_MAC" = "false" ] && COMPILE="$COMPILE -Wl,--no-undefined"
 [ "$IS_MAC" = "true" ] && COMPILE="$COMPILE -mmacosx-version-min=10.9"
-[ "$IS_MAC" = "false" -a "$3" != "false" ] && COMPILE="$COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,reallocarray -Wl,-wrap,malloc -Wl,-wrap,free"
+[ "$IS_MAC" = "false" -a "$3" != "false" ] && COMPILE="$COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,malloc -Wl,-wrap,free"
 if [ "$3" = "true" ]; then
        $COMPILE -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
@@ -146,6 +146,11 @@ else
                        echo "$GLIBC_SYMBS"
                        exit 1
                fi
+               REALLOC_ARRAY_SYMBS="$(objdump -T liblightningjni_release$LDK_TARGET_SUFFIX.so | grep reallocarray || echo)"
+               if [ "$REALLOC_ARRAY_SYMBS" != "" ]; then
+                       echo "Unexpected reallocarray dependency!"
+                       exit 1
+               fi
        fi
        if [ "$LDK_JAR_TARGET" = "true" ]; then
                # Copy to JNI native directory for inclusion in JARs