Skip to content

Commit

Permalink
Disable stack protector on x86 static executables
Browse files Browse the repository at this point in the history
Close #7274
  • Loading branch information
topjohnwu committed Sep 2, 2023
1 parent be50f17 commit 2dbb812
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions native/src/base/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ 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
# 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)
LOCAL_EXPORT_CFLAGS := -fno-stack-protector
endif
include $(BUILD_STATIC_LIBRARY)

1 comment on commit 2dbb812

@Mohamad1112we
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.