Initial crt0 implementation

Builds but cannot link, missing a lot of symbols
This commit is contained in:
topjohnwu
2024-02-22 16:50:18 -08:00
parent 7e9abe6e90
commit 6d79de7d71
12 changed files with 865 additions and 18 deletions

View File

@@ -22,18 +22,3 @@ LOCAL_SRC_FILES := \
base-rs.cpp \
../external/cxx-rs/src/cxx.cc
include $(BUILD_STATIC_LIBRARY)
# All static executables should link with libcompat
include $(CLEAR_VARS)
LOCAL_MODULE := libcompat
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 -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)
LOCAL_EXPORT_CFLAGS := -fno-stack-protector
endif
include $(BUILD_STATIC_LIBRARY)