Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] CLEAR_VARS does not clear LOCAL_STRIP_MODE variable #2039

Closed
vvb2060 opened this issue Jul 2, 2024 · 2 comments
Closed

[BUG] CLEAR_VARS does not clear LOCAL_STRIP_MODE variable #2039

vvb2060 opened this issue Jul 2, 2024 · 2 comments
Assignees
Labels

Comments

@vvb2060
Copy link

vvb2060 commented Jul 2, 2024

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

@vvb2060 vvb2060 added the bug label Jul 2, 2024
yujincheng08 added a commit to LSPosed/Metagisk that referenced this issue Jul 10, 2024
sn-o-w pushed a commit to sn-o-w/Magisk that referenced this issue Jul 10, 2024
@github-project-automation github-project-automation bot moved this to Triaged in NDK r28 Jul 10, 2024
@DanAlbert
Copy link
Member

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).

@github-project-automation github-project-automation bot moved this to Unconfirmed in NDK r27 Jul 10, 2024
@DanAlbert DanAlbert self-assigned this Jul 10, 2024
@DanAlbert DanAlbert removed this from NDK r27 Jul 10, 2024
@github-project-automation github-project-automation bot moved this to Unconfirmed in NDK r27b Jul 10, 2024
topjohnwu pushed a commit to topjohnwu/Magisk that referenced this issue Jul 12, 2024
@DanAlbert
Copy link
Member

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.

@github-project-automation github-project-automation bot moved this from Unconfirmed to Merged in NDK r27b Aug 8, 2024
@github-project-automation github-project-automation bot moved this from Triaged to Merged in NDK r28 Aug 8, 2024
@DanAlbert DanAlbert moved this from Merged to Needs cherry-pick in NDK r27b Aug 8, 2024
@DanAlbert DanAlbert removed the status in NDK r27b Aug 29, 2024
@DanAlbert DanAlbert moved this to Merged in NDK r27b Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Merged
Status: Merged
Development

No branches or pull requests

2 participants