From d033163efa48716c85de3b1e1f387babd1ee1866 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Mon, 27 Jun 2016 23:26:09 -0700 Subject: [PATCH] Fix detection of single source crtbegin. Before this, if an older platform level had separate source files for crtbegin_dynamic.o and crtbegin_static.o and a newer platform level had a shared source file, the shared source would not be used for the static version because the destination directory would have been pre-populated by the old version. Test: Together with the other CLs in the topic, built the ARM NDK and ran tests/device/static-executable with and without `--platform android-21`. Bug: https://github.com/android-ndk/ndk/issues/132 Change-Id: I8d656076a64361935c427d6cbb7f7f418db8af21 --- build/tools/gen-platforms.sh | 7 +++++-- tests/device/static-executable/test_config.py | 5 ----- 2 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 tests/device/static-executable/test_config.py diff --git a/build/tools/gen-platforms.sh b/build/tools/gen-platforms.sh index 79e5066b..ebca6429 100755 --- a/build/tools/gen-platforms.sh +++ b/build/tools/gen-platforms.sh @@ -514,6 +514,7 @@ gen_crt_objects () for SRC_FILE in $(cd "$SRC_DIR" && ls crt*.[cS]); do DST_FILE=${SRC_FILE%%.c} DST_FILE=${DST_FILE%%.S}.o + COPY_CRTBEGIN=false case "$DST_FILE" in "crtend.o") @@ -533,10 +534,11 @@ gen_crt_objects () DST_FILE=crtbegin_dynamic.o # Add .note.ABI-tag section SRC_FILE=$SRC_FILE" $CRTBRAND_S" + COPY_CRTBEGIN=true ;; esac - log "Generating $ARCH C runtime object: $DST_FILE" + log "Generating $ARCH C runtime object: $SRC_FILE -> $DST_FILE" (cd "$SRC_DIR" && $CC \ -I$SRCDIR/../../bionic/libc/include \ -I$SRCDIR/../../bionic/libc/arch-common/bionic \ @@ -547,7 +549,8 @@ gen_crt_objects () dump "ERROR: Could not generate $DST_FILE from $SRC_DIR/$SRC_FILE" exit 1 fi - if [ ! -s "$DST_DIR/crtbegin_static.o" ]; then + if [ "$COPY_CRTBEGIN" = "true" ]; then + dump "cp $DST_DIR/crtbegin_dynamic.o $DST_DIR/crtbegin_static.o" cp "$DST_DIR/crtbegin_dynamic.o" "$DST_DIR/crtbegin_static.o" fi done diff --git a/tests/device/static-executable/test_config.py b/tests/device/static-executable/test_config.py deleted file mode 100644 index 70f43cb1..00000000 --- a/tests/device/static-executable/test_config.py +++ /dev/null @@ -1,5 +0,0 @@ -def match_broken(abi, platform, device_platform, toolchain, subtest=None): - bug = 'https://github.com/android-ndk/ndk/issues/132' - if platform >= 21: - return 'android-{}'.format(platform), bug - return None, None