Commit graph

187 commits

Author SHA1 Message Date
Nick Kralevich
233d460f21 ARM: compile everything with relro / bind_now.
Enable relro / bind_now when compiling Android applications.
This marks certain regions of memory as read-only after linking,
making memory corruption security vulnerabilities are harder
to exploit.

See:
 * http://www.akkadia.org/drepper/nonselsec.pdf (section 6)
 * http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html

Stop using the custom linker script, which inhibits
relro / bind_now support.

Change-Id: Ie97ccdd2845886bbc2ba2fdd47eed0ff4b29b60b
2012-04-26 09:09:24 -07:00
Jean-Baptiste Queru
4e82d1fa7f On linux, always use the prebuilt host toolchain
Change-Id: I8077c4780e1e3540e5e2133cf0ffa61d474d3acc
2012-04-20 19:04:56 -07:00
Nick Kralevich
b3789be766 Revert "ARM: compile everything with relro / bind_now."
This reverts commit 020e4919e8.
2012-04-10 13:13:29 -07:00
Nick Kralevich
020e4919e8 ARM: compile everything with relro / bind_now.
Enable relro / bind_now when compiling Android applications.
This marks certain regions of memory as read-only after linking,
making memory corruption security vulnerabilities are harder
to exploit.

See:
 * http://www.akkadia.org/drepper/nonselsec.pdf (section 6)
 * http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html

Stop using the custom linker script, which inhibits
relro / bind_now support.

Change-Id: Iaebfbbb492299004f9da92b649985b6cd67d8c97
2012-04-09 12:04:32 -07:00
Jing Yu
f5172c7564 Switch default gcc toolchain from 4.4.3 to 4.6.
Switch both arm-linux-androideabi toolchainand arm-eabi toolchain.

Change-Id: I7b2771fe684853ab37e3b5b7cfe4146f9f901e02
2012-03-29 20:45:50 -07:00
Andrew Hsieh
0e63fd37dd Point to new linux prebuilt toolchain for SDK build
Change-Id: I21849119b0f3f45f950e9e6d1da0833aff381fb7
2012-03-13 02:17:35 -07:00
Andrew Hsieh
ed6b815505 BUILD_HOST_64bit=1 to build host tools in 64-bit
By default we build tool in 32-bit.  This flag allow individual tool and its
dependencies to be built in 64-bit (eg. Emulator).  Fixes to resolve 64-bit
porting issues (in other git) will be submitted seperately.

Change-Id: I486cf7ddac727d3c374ed890857d497c3a69e598
2012-02-28 10:24:39 -08:00
Ying Wang
92ca609cd1 Fix bug with the HOST_AR.
Change-Id: I28ab86d3b6e7cbd4391e2640cf8e2be269b03e76
2012-02-23 16:27:43 -08:00
Kenny Root
87f4d5a926 Enable TLS register by default for ARMv7a arch
Everything that is based on ARMv7a should have a cp15 TLS register.
Enable it by default so it's not accidentally missed in newer board
configurations. In fact, this could be enabled for ARMv6 as well, but we
currently don't distinguish between ARMv5 and ARMv6 in the build system.

This can still be disabled by setting it to "false" in the board
configuration, but this shouldn't ever be needed.

Change-Id: Ic2918f32899c8bcfa482f92c98f5a192fa318470
2012-02-21 09:17:18 -08:00
Ying Wang
5dea692715 Use @rpath and @loader_path to avoid absolute path
With "-Wl,-rpath,@loader_path/../lib" the linker embeds
@loader_path/../lib as the target binary's rpath.
Here @loader_path means the path of the binary that initiates the
loading.
With "-install_name @rpath/libfoo.dylib " the linker runtime searches
libfoo.dylib in the binary's embeded rpath.

With this change you can call dlopen() without specifying the full path
of the shared library.

Change-Id: If9beb3f6f4642a377bff603bab5ba3fdb96211bf
2012-02-01 13:20:30 -08:00
Ying Wang
80469e4d6c Delete unused var.
Change-Id: Ib6c295287f064529a8b4d8ada15a9fbb73064f1e
2012-02-01 11:28:00 -08:00
Ying Wang
b4c2a64040 Set install name with absolute path for Mac host shared libraries.
Before this change, path of the install name is relative to the top dir.
That means you can execute dynamically-linked binaries only in the top dir.
With this change, you can execute dynamically-linked binaries anywhere.

Change-Id: I1c6441579ffb68505ea678296aceb2e66a6df1be
2012-01-31 21:04:25 -08:00
Ying Wang
fcf246c989 Workaround for lack of "-Wl,--whole-archive" in MacOS's linker.
Change-Id: I2b1de0a253d341bcb7ee05fdc96bdc0d0967985e
2012-01-20 12:59:58 -08:00
Jean-Baptiste Queru
3b1dbe9302 Merge "Revert "Reference new location of SDK toolchain"" 2012-01-11 09:04:25 -08:00
Jean-Baptiste Queru
d75dbec617 Revert "Reference new location of SDK toolchain"
This reverts commit 1b834c6660.
2012-01-11 09:00:41 -08:00
Jean-Baptiste Queru
b6737c1366 Merge "Reference new location of SDK toolchain" 2012-01-11 06:36:55 -08:00
Jean-Baptiste Queru
cb8f66305c Revert "Point arm toolchain to the new gcc-4.6 one."
This reverts commit 1f87795eef.
2012-01-11 04:23:06 -08:00
Jean-Baptiste Queru
1b834c6660 Reference new location of SDK toolchain
Change-Id: If470d742a92061006d94b72f21df5c642348e179
2012-01-09 15:07:59 -08:00
Jean-Baptiste Queru
ea91f0a40e Reference x86 toolchain in its new location
Change-Id: I990b03107d1596a87a8d4cea6973735c60db4c64
2012-01-09 13:02:03 -08:00
Ying Wang
71b5cc1b8e Reference the new prebuilt ccache location.
Change-Id: I4450a8254fe82ed3a670ce653f49381d9c075c8e
2012-01-09 11:52:23 -08:00
Jing Yu
1f87795eef Point arm toolchain to the new gcc-4.6 one.
Tested build mysid-eng, sojus-eng, trygon-eng, yakju-eng.

Change-Id: I742cf9fcf2407b9098c99136d67161ecf062ac01

Conflicts:

	core/combo/TARGET_linux-arm.mk
2012-01-06 14:14:06 -08:00
Ying Wang
c7a10ddd31 Include toolchain makefile based on the current config.
So we can have the same set of module names in different host arch
/ toolchain version combinations.

Change-Id: Iec66584bf3de92aedd71a59f9dbe74b6ed025b2e
2012-01-06 11:59:30 -08:00
Al Sutton
f79ce15891 am 1964c8ed: am d8765f0f: am 80cfc37d: Partial fix for emulator under Lion.
* commit '1964c8ed2d6b1981ee991b5ecd95ab711affdf62':
  Partial fix for emulator under Lion.
2012-01-05 12:08:29 -08:00
Al Sutton
80cfc37d0f Partial fix for emulator under Lion.
Don't use -Wl,-dynamic on Lion
2012-01-04 15:16:50 -08:00
Al Sutton
a4f5991486 am 657aeac8: am 9ce06f11: Don\'t run ranlib on MacOS 10.7
* commit '657aeac8423d9e3cd31c0dffcecaad78a53d7604':
  Don't run ranlib on MacOS 10.7
2011-12-21 16:46:37 -08:00
Al Sutton
9ce06f11d6 Don't run ranlib on MacOS 10.7
Change-Id: I74f4623e6044dd804669aaa70c6e410fa8988d75
2011-12-21 13:12:33 -08:00
David 'Digit' Turner
6371da10f8 x86: Refine the way we configure the x86 build.
This is the result of a recent conversation around the x86 ABI
and its relationship with how we build platform images. Briefly:

- We want to use feature-based macros like ARCH_X86_HAVE_$FEATURE
  instead of relying on explicit compiler macros like -DUSE_$FEATURE

- We want to allow for other x86-based arch variants, e.g. if
  someone wants to build Android for a CPU that doesn't support
  the NDK x86 ABI. However, we need to ensure these are not
  tagged compatible by mistake (see check at the end of TARGET_linux-x86.mk)

- There are several flags which use is dubious now that we have
  a dedicated toolchain to build all the x86 stuff. Comment them
  as 'to be considered for removal'. We'll do the proper checks
  later.

Change-Id: I7768d7c34d73e274cbf4c09ae831b55280d6bb58
2011-12-14 18:08:47 +01:00
Bruce Beare
29371f157a am 38158161: am 3343b27c: x86: The default ATOM BSP flags need to be in sync with the NDK ABI
* commit '381581613aab988acc6f9d5b459fd4f533d8c2a5':
  x86: The default ATOM BSP flags need to be in sync with the NDK ABI
2011-12-12 15:39:05 -08:00
Bruce Beare
3343b27c53 x86: The default ATOM BSP flags need to be in sync with the NDK ABI
Change-Id: Ic741e1795c655ace1e33ae6708219f2708358090
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-12-09 13:27:08 -08:00
Jing Yu
7bf82e0171 Workaround for a gcc-4.6 bug on -fstrict-volatile-bitfields.
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01477.html
http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01390.html

-fstrict-volatile-bitfields is set on by default on gcc-4.6
for ARM target. This causes an inline asm() error. While
upstream gcc community is working on the patch, we shut
off this option temporarily.

This patch does not affect gcc-4.4.3 build.

Change-Id: Id7016dc5856a516e10f2617232945034728a74ab
2011-11-18 14:22:55 -08:00
Jim Huang
ba2c734f71 am e39ee4d5: am cb48497f: HOST_linux-x86: Avoid doubly define macro _FORTIFY_SOURCE
* commit 'e39ee4d5e043872b3ef8053678a9c6020d82d4b6':
  HOST_linux-x86: Avoid doubly define macro _FORTIFY_SOURCE
2011-11-10 21:35:56 +00:00
Jim Huang
cb48497ff2 HOST_linux-x86: Avoid doubly define macro _FORTIFY_SOURCE
While building Android with latest host gcc, it causes the following
build error:

Install: out/host/linux-x86/bin/mkbootimg
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors

In order to make build system happy, this patch does unset macro
_FORTIFY_SOURCE and then define it in host cflags.

Change-Id: Ic37a90f05081a2c3650b3335bc87e9e895900fb2
2011-11-10 13:28:13 -08:00
Nick Kralevich
d9d2e7a42c x86: enable PIE for dynamically linked executables
Compile all x86 programs on Android with -fPIE and -pie. This enables
PIE (Position Independent Executables), which helps protect Android
applications from exploitation due to memory management bugs.

Note 1: PIE *static* executables are not supported at this time and
require additional linker changes.

Note 2: This change compliments 026a85b129,
which was the exact same change, except for ARM.

Testing: Rebuilt the tree completely from scratch, and verified
that the system boots and basic functionality works in the emulator.

Change-Id: I990064c37da3d857e663b27f31fee05f689a2824
2011-11-04 13:15:24 -07:00
Nick Kralevich
4185447f2f stop using a custom linker script for static executables.
This is causing problems with making the linker relocatable.

Change-Id: I53e37fba52eabd3145130712d6e9bff074aed493
2011-11-01 12:09:29 -07:00
Jean-Baptiste Queru
e7d25da929 am 9a3dfc06: am 68eb6649: am 432f8d88: Reconcile with AOSP master
* commit '9a3dfc06b94a59bdc7005a8a944996c956527c19':
2011-10-28 15:28:28 +00:00
Jing Yu
6af4bb07e3 Merge "Fix build problems with gcc-4.6.x." 2011-10-27 10:47:40 -07:00
Conley Owens
5071047d7e Merge "HOST_linux-x86: Avoid doubly define macro _FORTIFY_SOURCE" 2011-10-27 10:36:13 -07:00
Nick Kralevich
026a85b129 enable PIE for dynamically linked executables
Compile all programs on Android with -fPIE and -pie. This enables
PIE (Position Independent Executables), which helps protect Android
applications from exploitation due to memory management bugs.

Stop using the armelf.x linker script. This script hard codes the
load address of the executable, defeating the position independence
PIE requires.

Note: PIE *static* executables are not supported at this time and
require additional linker changes.

Bug: 5323301
Change-Id: Ieafcc9c4f142495847e163881889d371a59d0878
2011-10-24 11:37:37 -07:00
Jim Huang
59d296623b HOST_linux-x86: Avoid doubly define macro _FORTIFY_SOURCE
While building Android with latest host gcc, it causes the following
build error:

Install: out/host/linux-x86/bin/mkbootimg
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors

In order to make build system happy, this patch does unset macro
_FORTIFY_SOURCE and then define it in host cflags.

Change-Id: Ic37a90f05081a2c3650b3335bc87e9e895900fb2
2011-10-24 10:23:21 -07:00
Doug Kwan
2b40757725 Fix build problems with gcc-4.6.x.
Change-Id: If02f18efde4cec39c97bb0e7226b008cd6b85dd4
2011-10-13 12:28:34 -07:00
Ying Wang
45bee774eb am a1b603a5: am 4b398749: am c5033a33: Merge "x86: remove obsolete comments"
* commit 'a1b603a556e338d4899a62ea37810aff81ab7fa1':
  x86: remove obsolete comments
2011-08-29 11:05:08 -07:00
Ying Wang
a1b603a556 am 4b398749: am c5033a33: Merge "x86: remove obsolete comments"
* commit '4b3987498eb15dc654fe572aadf53396aac36479':
  x86: remove obsolete comments
2011-08-26 12:12:48 -07:00
Chih-Wei Huang
aa1c321a58 x86: remove obsolete comments
Change-Id: Ifb12892c17a50f85c7700d6413ea295a4dad7047
2011-08-03 12:16:59 +08:00
Doug Kwan
be3689e981 Conditionally disable -Wno-unused-but-set-variable for gcc-4.6.
We used to do that unconditionally but that caused lots of spurious
warnings in gcc-4.4.x about an unrecognized gcc option.

Change-Id: Idb5118b069871859e07a7efa04914ab6ed0b1372
2011-07-14 16:34:26 -07:00
Jeff Brown
e33ba4c49e Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: Ie814f4c8d3aa1e7cc7f5735822ab25542f36cf62
2011-07-11 23:51:37 -07:00
Evgeniy Stepanov
8f77c9ded3 Add .gnu_debuglink when stripping DSOs.
This is used by debug tools to find symbols for the stripped binary.
Adds ~70 bytes to each DSO, ~25000 bytes total, which is about 0.01% of the
system image.

This change only affects -eng and -userdebug builds, and does not affect -user.

Change-Id: I0c92a9e09fbc97184dea66813923568cbcc2a3fe
2011-06-28 12:47:34 +04:00
Raphael
ecb957705c resolved conflicts for merge of 732936d9 to master
Change-Id: I1fc667057aebbbef19bde746ebcc650ac0e8c35c
2011-06-23 13:52:29 -07:00
Raphael
732936d99a resolved conflicts for merge of 8508a073 to honeycomb-plus-aosp
Change-Id: I376928881adb0e9fd62fabc1e21542bf0d700ca2
2011-06-22 14:35:32 -07:00
Raphael Moll
c639c787a0 Lunch: don't use a toolchain that doesn't exist.
"lunch sdk-eng" on cygwin tries to use a gcc.exe from the
prebuild arm toolchain, but it doesn't exist. This prevents
from setting variables to point on a gcc toolchain if there
is none for the given arch.

Change-Id: I3b72220663687f9fdaacc050899aef00632f2c3c
2011-06-21 06:11:05 -07:00
Martijn Coenen
3c22287c1b Revert "x86: Enable -fstack-protector"
This reverts commit e397dcccbb.
2011-06-07 08:57:34 -07:00