diff options
author | David 'Digit' Turner <digit@google.com> | 2011-01-08 15:07:22 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2011-01-08 16:30:03 +0100 |
commit | 7a619be40e8594a961066a33b7cc9ef52f566988 (patch) | |
tree | e1e92458036410e6fc2c16b0a47cb5b3d9162a92 | |
parent | ca0d46d9ffb79e3353628ac1ada94b7c75c0cfa1 (diff) | |
download | ndk-android-2.3.3_r1a.tar.gz |
arm-linux-androideabi: Use -fpic by default instead of -fPICandroid-sdk-2.3.4_r1android-cts-2.3_r5android-cts-2.3_r4android-cts-2.3_r3android-cts-2.3_r2android-cts-2.3_r12android-cts-2.3_r11android-cts-2.3_r10android-cts-2.3_r1android-2.3.7_r1android-2.3.6_r1android-2.3.6_r0.9android-2.3.5_r1android-2.3.4_r1android-2.3.4_r0.9android-2.3.3_r1aandroid-2.3.3_r1.1android-2.3.3_r1gingerbread-releasegingerbread-mr4-releasegingerbread
Used to prevent a performance degradation compared to arm-eabi
when using the standalone toolchain. NDK toolchain not affected.
Change-Id: I4c603974fdc16dd6eb7be68dd0b72c4a98f25484
-rw-r--r-- | build/tools/toolchain-patches/gcc/0001-arm-linux-androideabi-make-fpic-the-default-instead-.patch | 36 | ||||
-rw-r--r-- | docs/CHANGES.html | 7 | ||||
-rwxr-xr-x | tests/run-standalone-tests.sh | 2 | ||||
-rw-r--r-- | tests/standalone/test-fpic/test-fpic.c | 35 |
4 files changed, 79 insertions, 1 deletions
diff --git a/build/tools/toolchain-patches/gcc/0001-arm-linux-androideabi-make-fpic-the-default-instead-.patch b/build/tools/toolchain-patches/gcc/0001-arm-linux-androideabi-make-fpic-the-default-instead-.patch new file mode 100644 index 000000000..1c6dce3d5 --- /dev/null +++ b/build/tools/toolchain-patches/gcc/0001-arm-linux-androideabi-make-fpic-the-default-instead-.patch @@ -0,0 +1,36 @@ +From 8fb36c2f3114aec33c84a43eb5fd14c845f65bfc Mon Sep 17 00:00:00 2001 +From: David 'Digit' Turner <digit@android.com> +Date: Sat, 8 Jan 2011 14:46:50 +0100 +Subject: [PATCH] arm-linux-androideabi: make -fpic the default, instead of -fPIC + +This patch modifies the arm-linux-androideabi configuration to use +-fpic by default, instead of -fPIC. + +This should only affect users the standalone Android NDK toolchain, +since both the Android platform and NDK build scripts will append +the -fpic flag at compile time for all generated object files. + +Note that this doesn't change the arm-eabi configuration to avoid +breaking stuff when building the kernel. + +Change-Id: Ib7f97a05bf1bb83778863f885628c1741896fb0a +--- + gcc-4.4.3/gcc/config/linux-android.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/gcc-4.4.3/gcc/config/linux-android.h b/gcc-4.4.3/gcc/config/linux-android.h +index a43bab5..ae4b26f 100644 +--- a/gcc-4.4.3/gcc/config/linux-android.h ++++ b/gcc-4.4.3/gcc/config/linux-android.h +@@ -37,7 +37,7 @@ + + #define ANDROID_CC1_SPEC \ + "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ +- "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}" ++ "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fpic}}}}" + + #define ANDROID_CC1PLUS_SPEC \ + "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ +-- +1.7.3.1 + diff --git a/docs/CHANGES.html b/docs/CHANGES.html index 62c6099d6..79ba224f8 100644 --- a/docs/CHANGES.html +++ b/docs/CHANGES.html @@ -70,6 +70,13 @@ OTHER FIXES & CHANGES: - <asm/byteorder.>: Replaced 'asm' with '__asm__' to allow compilation with -std=c99. See https://review.source.android.com/#change,20076 +- standalone toolchain: The -fpic flag is now the default for the + arm-linux-androideabi toolchain, instead of -fPIC. This avoids a performance + degradation when compared to the old android-eabi configuration. + + This only affects users of the standalone toolchain. The NDK build script + always enforced -fpic implicitely. + ------------------------------------------------------------------------------- android-ndk-r5 diff --git a/tests/run-standalone-tests.sh b/tests/run-standalone-tests.sh index b012959b0..f38c84341 100755 --- a/tests/run-standalone-tests.sh +++ b/tests/run-standalone-tests.sh @@ -60,7 +60,7 @@ compile_and_link_cxx () install_toolchain android-9 -for CXXSRC in $PROGDIR/standalone/*/*.cpp; do +for CXXSRC in $PROGDIR/standalone/*/*.cpp $PROGDIR/standalone/*/*.c; do compile_and_link_cxx $CXXSRC done diff --git a/tests/standalone/test-fpic/test-fpic.c b/tests/standalone/test-fpic/test-fpic.c new file mode 100644 index 000000000..dded543a8 --- /dev/null +++ b/tests/standalone/test-fpic/test-fpic.c @@ -0,0 +1,35 @@ +/* + * 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 test is used to check that -fpic is a default compiler option + * for the arm-linux-androideabi toolchain. + */ +#ifdef __arm__ +#ifndef __PIC__ +#error __PIC__ is not defined! +#endif +#if __PIC__ == 2 +#error -fPIC is the default, should be -fpic +#endif +#if __PIC__ != 1 +#error __PIC__ value is unsupported! Should be 1 to indicate -fpic is the default. +#endif +#endif + +int main(void) +{ + return 0; +} |