diff options
author | David 'Digit' Turner <digit@google.com> | 2010-12-14 12:37:11 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2010-12-14 12:37:11 +0100 |
commit | b1b7c642b46447e0df78a08d51eb26a8808d7e3e (patch) | |
tree | cf1094be3f0fcd960bc36304b70026f6a983f8f0 | |
parent | 61e547de892f7dda62cc76c582326f307922b0d0 (diff) | |
download | ndk-b1b7c642b46447e0df78a08d51eb26a8808d7e3e.tar.gz |
Fix compiler bug (invalud thumb instructions for signed chars)
This change modifies the reference git date used when downloading the
toolchain sources in order to get the following fix which was submitted
on 2010-12-13:
https://review.source.android.com/#change,19474
+ Add a unit-test to check for the bad code generation
+ Slight reformating of docs/CHANGES.html
Change-Id: Iea9e6dc717e7a256743c276f00be6767151c2776
-rw-r--r-- | build/tools/prebuilt-common.sh | 2 | ||||
-rw-r--r-- | docs/CHANGES.html | 26 | ||||
-rw-r--r-- | tests/device/test-compiler-bug-1/jni/Android.mk | 6 | ||||
-rw-r--r-- | tests/device/test-compiler-bug-1/jni/main.c | 49 |
4 files changed, 74 insertions, 9 deletions
diff --git a/build/tools/prebuilt-common.sh b/build/tools/prebuilt-common.sh index b308fd8e4..ee83cfbf2 100644 --- a/build/tools/prebuilt-common.sh +++ b/build/tools/prebuilt-common.sh @@ -665,4 +665,4 @@ GNUSTL_SUBDIR=sources/cxx-stl/gnu-libstdc++ # The date to use when downloading toolchain sources from android.git.kernel.org # Leave it empty for tip of tree. -TOOLCHAIN_GIT_DATE=2010-11-25 +TOOLCHAIN_GIT_DATE=2010-12-13 diff --git a/docs/CHANGES.html b/docs/CHANGES.html index 0205a4672..930a84fd8 100644 --- a/docs/CHANGES.html +++ b/docs/CHANGES.html @@ -5,16 +5,30 @@ android-ndk-r5b This release fixes a few bugs in r5. There are no new features. -OTHER FIXES & CHANGES: +IMPORTANT BUG FIXES: -- ndk-build: Handle installation paths containing spaces when checking - cygwin installation. Before that, the script complained that the user - was using an incorrect version of GNU Make (even if he had the right one). +- Fix a compiler bug in the arm-linux-androideabi-4.4.3 toolchain. + The previous binary generated invalid thumb instruction sequences when + dealing with signed chars. This problem was first reported on the + android-ndk forum and fixed by the following change in the toolchain + sources: + + https://review.source.android.com/#change,19474 - docs/CPLUSPLUS-SUPPORT.html: Add missing documentation for the "gnustl_static" value for APP_STL, that allows you to link against a static library version of GNU libstdc++. +- ndk-build: Fix a bug that created inconsistent dependency files when a + compilation error occured on Windows, preventing building properly after + the error was fixed in the source code. + +OTHER FIXES & CHANGES: + +- ndk-build: Handle installation paths containing spaces when checking + cygwin installation. Before that, the script complained that the user + was using an incorrect version of GNU Make (even if he had the right one). + - Fixed a typo that prevented several NDK_MODULE_PATH to work properly when it contained multiple directories separated with ":" @@ -25,10 +39,6 @@ OTHER FIXES & CHANGES: - prebuilt-common.sh: Fix the toolchain rebuild scripts to work when using a 32-bit host toolchain. -- ndk-build: Fix a bug that created inconsistent dependency files when a - compilation error occured on Windows, preventing building properly after - the error was fixed in the source code. - ------------------------------------------------------------------------------- android-ndk-r5 diff --git a/tests/device/test-compiler-bug-1/jni/Android.mk b/tests/device/test-compiler-bug-1/jni/Android.mk new file mode 100644 index 000000000..21a8fb366 --- /dev/null +++ b/tests/device/test-compiler-bug-1/jni/Android.mk @@ -0,0 +1,6 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_MODULE := test_compiler_bug1 +LOCAL_SRC_FILES := main.c +include $(BUILD_EXECUTABLE) diff --git a/tests/device/test-compiler-bug-1/jni/main.c b/tests/device/test-compiler-bug-1/jni/main.c new file mode 100644 index 000000000..58a2c4a89 --- /dev/null +++ b/tests/device/test-compiler-bug-1/jni/main.c @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* This program tests for a compiler bug that was found in the + * arm-linux-androideabi-4.4.3 toolchain and fixed by the change at + * https://review.source.android.com/#change,19474 + * + * The bug generated an invalid sequence of thumb machine instructions + * when signed chars were being used. + */ +#include <stdio.h> + +int test(signed char anim_col) +{ + if (anim_col >= 31) { + return 1; + } else if (anim_col <= -15) { + return -2; + } + return 0; +} + +int main(void) +{ + const int testval = -7; + const int expected = 0; + int ret = test(testval); + + if (ret != expected) { + fprintf(stderr, "ERROR: test(%d) returned %d instead of %d\n", + testval, ret, expected); + return 1; + } + printf("OK: test(%d) returned %d\n", testval, expected); + return 0; +} |