ndk
ndk copied to clipboard
[BUG] CLEAR_VARS does not clear LOCAL_STRIP_MODE variable
Description
strip test1, but none stripped
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test1
LOCAL_SRC_FILES := test.c
LOCAL_STRIP_MODE := --strip-all
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := test2
LOCAL_SRC_FILES := test.c
LOCAL_STRIP_MODE := none
include $(BUILD_SHARED_LIBRARY)
md "obj\local\arm64-v8a\objs\test1" >NUL 2>NUL || rem
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "Compile ": "test1 <= test.c"
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -MMD -MP -MF ./obj/local/arm64-v8a/objs/test1/test.o.d -target aarch64-none-linux-android23 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -D_FORTIFY_SOURCE=2 -fpic -O2 -DNDEBUG -I. -DANDROID -Wformat -Werror=format-security -c ./test.c -o ./obj/local/arm64-v8a/objs/test1/test.o
md "obj\local\arm64-v8a" >NUL 2>NUL || rem
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "SharedLibrary ": "libtest1.so"
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -Wl,-soname,libtest1.so -shared ./obj/local/arm64-v8a/objs/test1/test.o -latomic -target aarch64-none-linux-android23 -no-canonical-prefixes -Wl,--gc-sections -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined -Wl,--fatal-warnings -Wl,--no-undefined-version -lc -lm -o ./obj/local/arm64-v8a/libtest1.so
md "libs\arm64-v8a" >NUL 2>NUL || rem
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "Install ": "libtest1.so => libs/arm64-v8a/libtest1.so"
copy /b/y ".\obj\local\arm64-v8a\libtest1.so" ".\libs\arm64-v8a\libtest1.so" > NUL
md "obj\local\arm64-v8a\objs\test2" >NUL 2>NUL || rem
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "Compile ": "test2 <= test.c"
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -MMD -MP -MF ./obj/local/arm64-v8a/objs/test2/test.o.d -target aarch64-none-linux-android23 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -D_FORTIFY_SOURCE=2 -fpic -O2 -DNDEBUG -I. -DANDROID -Wformat -Werror=format-security -c ./test.c -o ./obj/local/arm64-v8a/objs/test2/test.o
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "SharedLibrary ": "libtest2.so"
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -Wl,-soname,libtest2.so -shared ./obj/local/arm64-v8a/objs/test2/test.o -latomic -target aarch64-none-linux-android23 -no-canonical-prefixes -Wl,--gc-sections -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined -Wl,--fatal-warnings -Wl,--no-undefined-version -lc -lm -o ./obj/local/arm64-v8a/libtest2.so
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "Install ": "libtest2.so => libs/arm64-v8a/libtest2.so"
copy /b/y ".\obj\local\arm64-v8a\libtest2.so" ".\libs\arm64-v8a\libtest2.so" > NUL
strip test2, but all stripped
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test1
LOCAL_SRC_FILES := test.c
LOCAL_STRIP_MODE := none
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := test2
LOCAL_SRC_FILES := test.c
LOCAL_STRIP_MODE := --strip-all
include $(BUILD_SHARED_LIBRARY)
md "obj\local\arm64-v8a\objs\test1" >NUL 2>NUL || rem
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "Compile ": "test1 <= test.c"
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -MMD -MP -MF ./obj/local/arm64-v8a/objs/test1/test.o.d -target aarch64-none-linux-android23 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -D_FORTIFY_SOURCE=2 -fpic -O2 -DNDEBUG -I. -DANDROID -Wformat -Werror=format-security -c ./test.c -o ./obj/local/arm64-v8a/objs/test1/test.o
md "obj\local\arm64-v8a" >NUL 2>NUL || rem
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "SharedLibrary ": "libtest1.so"
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -Wl,-soname,libtest1.so -shared ./obj/local/arm64-v8a/objs/test1/test.o -latomic -target aarch64-none-linux-android23 -no-canonical-prefixes -Wl,--gc-sections -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined -Wl,--fatal-warnings -Wl,--no-undefined-version -lc -lm -o ./obj/local/arm64-v8a/libtest1.so
md "libs\arm64-v8a" >NUL 2>NUL || rem
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "Install ": "libtest1.so => libs/arm64-v8a/libtest1.so"
copy /b/y ".\obj\local\arm64-v8a\libtest1.so" ".\libs\arm64-v8a\libtest1.so" > NUL
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe --strip-all ./libs/arm64-v8a/libtest1.so
md "obj\local\arm64-v8a\objs\test2" >NUL 2>NUL || rem
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "Compile ": "test2 <= test.c"
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -MMD -MP -MF ./obj/local/arm64-v8a/objs/test2/test.o.d -target aarch64-none-linux-android23 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -D_FORTIFY_SOURCE=2 -fpic -O2 -DNDEBUG -I. -DANDROID -Wformat -Werror=format-security -c ./test.c -o ./obj/local/arm64-v8a/objs/test2/test.o
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "SharedLibrary ": "libtest2.so"
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -Wl,-soname,libtest2.so -shared ./obj/local/arm64-v8a/objs/test2/test.o -latomic -target aarch64-none-linux-android23 -no-canonical-prefixes -Wl,--gc-sections -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined -Wl,--fatal-warnings -Wl,--no-undefined-version -lc -lm -o ./obj/local/arm64-v8a/libtest2.so
ndk/build/../prebuilt/windows-x86_64/bin/echo.exe [arm64-v8a] "Install ": "libtest2.so => libs/arm64-v8a/libtest2.so"
copy /b/y ".\obj\local\arm64-v8a\libtest2.so" ".\libs\arm64-v8a\libtest2.so" > NUL
ndk/build/../toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe --strip-all ./libs/arm64-v8a/libtest2.so
Affected versions
r27
Canary version
No response
Host OS
Windows
Host OS version
Windows 10
Affected ABIs
arm64-v8a
Build system
ndk-build
Other build system
No response
minSdkVersion
23
Device API level
No response
Likely not a regression (I don't think that code has been touched since it was written a few years ago, but it'll be easy enough to confirm once I add the regression test), and I'm supposedly sending r27 to QA this week, so this will probably wait until r28 (I think the fix is innocuous, so I'll consider for r27b as well).
Yeah, almost certainly not a regression. Probably has been broken since the day it was added. https://android-review.googlesource.com/c/platform/ndk/+/3204733 is the fix. I'll cherry-pick to r27b. It risks "breaking" anyone that forgot to specify LOCAL_STRIP_MODE in each module and was accidentally relying on it carrying over from an earlier module, but that seems pretty unlikely, and it's a pretty trivial fix for the user even if it is a problem.