Skip to content

Commit

Permalink
Fix detection of single source crtbegin.
Browse files Browse the repository at this point in the history
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: android/ndk#132

Change-Id: I8d656076a64361935c427d6cbb7f7f418db8af21
  • Loading branch information
DanAlbert committed Jun 28, 2016
1 parent 0e75a4b commit d033163
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 5 additions & 2 deletions build/tools/gen-platforms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 \
Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions tests/device/static-executable/test_config.py

This file was deleted.

0 comments on commit d033163

Please sign in to comment.