Wrap rename and renameat

This commit is contained in:
LoveSy
2023-06-16 01:40:50 +08:00
committed by John Wu
parent 2dbb812126
commit c072b4254d
2 changed files with 22 additions and 6 deletions

View File

@@ -28,12 +28,10 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcompat
# Add "hacky" libc.a missing symbols back
# All symbols in this library are weak, so a vanilla NDK should still link properly
LOCAL_SRC_FILES := compat/compat.cpp
# Fix static variables' ctor/dtor when using LTO
# See: https://github.com/android/ndk/issues/1461
LOCAL_EXPORT_LDFLAGS := -static -T src/lto_fix.lds
LOCAL_EXPORT_LDFLAGS := -static -T src/lto_fix.lds -Wl,--wrap=rename -Wl,--wrap=renameat
# For some reason, using the hacky libc.a with x86 will trigger stack protection violation
# when mixing Rust and C++ code. Disable stack protector to bypass this issue.
ifeq ($(TARGET_ARCH), x86)