Commit graph

937 commits

Author SHA1 Message Date
Nick Kralevich
100acd1001 host compiler: enable compiler hardening flags
Enable the following compiler hardening flags:

* -Wl,-z,relro
* -Wl,-z,now
* -fstack-protector

relro / bind_now make the relro region read-only after linking,
preventing certain attacks against ELF data structures.

stack-protector adds stack canaries, which can detect exploits
which overwrite parts of the stack.

Explicitly not added in this change is FORTIFY_SOURCE=2. Adding that
option turns on glibc's warn_unused_result attributes. This generates
a huge number of new compile time warnings, and for the multiple
makefiles which have -Werror in them, turns those warnings into errors.
I'm not able to fix all the errors right away.

Bug: 20558757
Change-Id: I86791177c6695f5325233d9dd9a5dd3ccc2b1a2f
2015-04-24 21:26:08 -07:00
Dmitriy Ivanov
8bd30fe3cb Pack relocations for mips64
Bug: http://b/18051137
Change-Id: I063c5d6cf007658c0efe9cb1d65ed8026b3e7dae
2015-04-24 16:34:09 -07:00
Dmitriy Ivanov
9dc1a7359f Pack relocations for mips
Bug: http://b/18051137
Change-Id: Id5e0adfb55273f23e1c99b4eecb318c6b8d19989
2015-04-24 12:20:02 -07:00
Dmitriy Ivanov
1d4804ccd1 Pack relocations for x86
Bug: http://b/18051137
Change-Id: I3f316343e9bbd2037a9583d5b6fb41a06be153cd
2015-04-24 10:34:59 -07:00
Dmitriy Ivanov
4c2d1a64fb Pack relocation tables for dynamic executables
Add replocation-packer step for dynmic executables.

  Enable it by default for arm and arm64 platforms.

Bug: http://b/18051137
Change-Id: I0c88fd31595bcea62a087f219acb9ecf9c80f2e5
2015-04-23 12:07:16 -07:00
Dimitry Ivanov
1eca10fa9d Revert "Pack relocation tables for all dynamic executables"
This reverts commit e7a1b8a0c6.

Change-Id: I1a2185e1c68d364941e3b3e525a8c4a7a42e0cc1
2015-04-23 04:22:33 +00:00
Dmitriy Ivanov
e7a1b8a0c6 Pack relocation tables for all dynamic executables
Bug: http://b/18051137
Change-Id: I277277d5f5eb450ef9b4a23cfec16d75d977eb89
2015-04-22 13:30:43 -07:00
Andrew Hsieh
f37e96e232 Merge "Revert "Enable linker -fix-cortex-a53-843419"" 2015-04-13 23:48:28 +00:00
Andrew Hsieh
32e1689684 Revert "Enable linker -fix-cortex-a53-843419"
This reverts commit 54b22a5a70.

Change-Id: I23613490030783fb6da678de5a25f37caebe5f97
2015-04-13 23:39:45 +00:00
Andrew Hsieh
7bd978c2b3 Merge "Enable linker -fix-cortex-a53-843419" 2015-04-13 03:06:50 +00:00
Stephen Hines
69bd465b6e Merge "Don't use -Wl,--fix-cortex-a8 for Cortex A7, A9, A15, Krait or Denver" 2015-04-10 16:17:52 +00:00
Ying Wang
aaf9a5b0cc Remove ancient ranlib workaround on Mac OS X.
Apparently we don't need it for Mac OS X 10.7 and above.

Change-Id: I5ee81700c16e8c66b2d5f2b373fd2d523b5ec018
2015-04-09 10:06:33 -07:00
Andrew Hsieh
54b22a5a70 Enable linker -fix-cortex-a53-843419
Change-Id: Icb8a4ce4d5688847cfe536eba2139cdf7f6406f3
2015-04-09 12:37:36 +08:00
Nick Kralevich
9b44afb452 AndroidConfig.h: ensure HAVE_MALLOC_H always has a value.
Some programs (cough sqlite cough) do an improper check to see if
HAVE_MALLOC_H is defined. Instead of defining it with no value,
define it with a value so those checks pass.

Needed for bug: 20099586

Change-Id: I4c293b2c1b5f4caad85ffc1fc34ac385bab23f5c
2015-04-08 12:21:54 -07:00
Elliott Hughes
98ff711a5d There's no such thing as _THREAD_SAFE.
At least, as far as I can tell from the internet and from grep in /usr/include
on a Mac.

Change-Id: I7f39bb2013db88e59f604e4491344d0d342e5f0b
2015-04-03 13:41:10 -07:00
Elliott Hughes
8a11491bc9 Remove HAVE_PRINTF_ZD.
Change-Id: Ie7677e4816ad886c13a8ac869e7c7342082a350f
2015-04-03 13:05:53 -07:00
Elliott Hughes
dbaee628ec Merge "Remove HAVE_STRLCPY." 2015-04-03 19:42:06 +00:00
Elliott Hughes
8f06d8afb8 Remove HAVE_STRLCPY.
Change-Id: I27864a9075183de5bd83569d53a00fc2f53c96df
2015-04-02 16:43:52 -07:00
Dan Albert
343ed674e3 Use prebuilt libclang_rt.profile.
Bug: 17574078
Change-Id: I4838cd5d125a0b2bf76aad2fdaef1ee3122687e8
2015-04-01 19:03:22 -07:00
Christopher Ferris
c9d2952e1e Revert "Switch x86 and x86_64 to 4.9. Attempt #2."
This reverts commit 6fb735b071.

Change-Id: I64b868cdfb3571de5e8b01e4257b5dfa9ee44d0d
2015-03-25 18:27:21 +00:00
Bernhard Rosenkränzer
4da707176b Don't use -Wl,--fix-cortex-a8 for Cortex A7, A9, A15, Krait or Denver
-Wl,--fix-cortex-a8 is a workaround for an Erratum in Cortex-A8
processors. It slightly increases code size and decreases performance,
and there's no point in using it on non-A8 CPUs.

Instead of forcing it unconditionally, use it when targeting
Cortex-A8 or generic armv7-a (which might or might not be A8).

Change-Id: Ifa59765d380445237edccfe5440a67b3ba1e459a
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
2015-03-25 17:21:02 +01:00
Alexander Ivchenko
6fb735b071 Switch x86 and x86_64 to 4.9. Attempt #2.
BUG=16407835

Change-Id: I45161bf4701bef4540b51168f771c5e9da8c8750
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
2015-03-20 17:07:34 +03:00
Christopher Ferris
f123057f5e Revert "Switch x86 and x86_64 build to use GCC 4.9"
This reverts commit 533c7aa6a2.

Change-Id: I5203db8454d9af8fb438af6308106945e5dc0dbf
2015-03-17 01:29:51 +00:00
Andrew Hsieh
533c7aa6a2 Switch x86 and x86_64 build to use GCC 4.9
Change-Id: I41a7650d0e56c820a59c261d16afd6f0b9ec38c2
2015-03-16 13:17:59 +08:00
Przemyslaw Szczepaniak
0e2d00ff1f Switch NDK libraries to 4.9 for x86_64 and mips64
Android NDK r10b doesn't even provide 4.8 for those
archs.

Change-Id: I10840c6c7bbc0dd9028a794162d021d8b3e6b19a
(cherry picked from commit fabd383bc8)
2015-03-13 11:36:15 -07:00
Ying Wang
d791463511 Support "LOCAL_FDO_SUPPORT := always".
"LOCAL_FDO_SUPPORT := always" enables FDO without user specifying
"BUILD_FDO_OPTIMIZE := true", i.e. it turns on FDO for a
module in any build configuration.

Change-Id: I05d8db2edb2b3f5db073fa14d5bf1083a04571c0
(cherry picked from commit 45d0143ab1)
2015-03-13 11:36:15 -07:00
Christopher Ferris
62d5e2acf5 Merge "Update x86_64 minimal ISA instruction set" 2015-03-13 04:18:18 +00:00
Mingwei Shi
357778de34 Update x86_64 minimal ISA instruction set
Change-Id: I3ca7f8a0799e6aef09ab1dfb719d218c7338ebf8
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2015-03-12 22:45:27 +08:00
Ying Wang
168357aeda Merge "Support .asm being compiled by yasm targeted for x86_64." 2015-03-11 16:37:25 +00:00
Ying Wang
fe1e5c3453 Support .asm being compiled by yasm targeted for x86_64.
Change-Id: Ia6425c38dd2f7ad2dc697213cd61b7515b9e7aff
2015-03-09 18:57:40 -07:00
Elliott Hughes
2c5b6ab5ac am 8389deee: Merge "mips64 should avoid common LP64 errors just like arm64 and x86-64."
* commit '8389deee6b355f7dd6b1ff3579179414c6a41e5c':
  mips64 should avoid common LP64 errors just like arm64 and x86-64.
2015-02-25 19:01:07 +00:00
Elliott Hughes
d1ea5fbf7b mips64 should avoid common LP64 errors just like arm64 and x86-64.
Change-Id: Ibce5863bee3175671862c1889869b43bcb39a074
2015-02-24 16:04:31 -08:00
Elliott Hughes
36f179711d am ca15af1b: Merge "Turn on -Werror=implicit-function-declaration for arm64."
* commit 'ca15af1bcde972b6ba3546d45913c9bb51bd93b0':
  Turn on -Werror=implicit-function-declaration for arm64.
2015-02-23 21:35:17 +00:00
Elliott Hughes
ca15af1bcd Merge "Turn on -Werror=implicit-function-declaration for arm64." 2015-02-23 21:29:58 +00:00
Elliott Hughes
5081cbf009 am faeae397: Merge "Turn on -Werror=implicit-function-declaration for x86-64."
* commit 'faeae3977159b0b4ca2021c4c657a090eaeb4a56':
  Turn on -Werror=implicit-function-declaration for x86-64.
2015-02-23 18:29:13 +00:00
Elliott Hughes
faeae39771 Merge "Turn on -Werror=implicit-function-declaration for x86-64." 2015-02-23 18:23:24 +00:00
Elliott Hughes
f5e204b3f4 Turn on -Werror=implicit-function-declaration for arm64.
Implicit function declarations are much more dangerous on LP64 because
sizeof(int) != sizeof(void*), so any function that returns a pointer will
lose its top bits, leading to relatively hard to debug crashes.

Change-Id: Ia05beffb949ca747833c2e12c40daf896f7a60a5
2015-02-21 13:21:20 -08:00
Elliott Hughes
b97d8c78e2 Turn on -Werror=implicit-function-declaration for x86-64.
Implicit function declarations are much more dangerous on LP64 because
sizeof(int) != sizeof(void*), so any function that returns a pointer will
lose its top bits, leading to relatively hard to debug crashes.

Change-Id: Ib2570326dde1b1cde09c63c9b4c973d741528ee2
2015-02-21 11:01:11 -08:00
Narayan Kamath
ae25aed3c9 am 940632f1: Merge "Remove references to __CYGWIN__ and HAVE_WINSOCK2_H."
* commit '940632f1a1af056ea8f87d2fa7a0c7e22cd1556b':
  Remove references to __CYGWIN__ and HAVE_WINSOCK2_H.
2015-02-21 10:15:54 +00:00
Narayan Kamath
2fad00c56e Remove references to __CYGWIN__ and HAVE_WINSOCK2_H.
We don't support platform builds under CYGWIN and can safely
assume that all windows host builds are for MinGW32.

HAVE_WINSOCK2_H is currently unused. The only references to it
are in code that define it themselves or in application code that
by definition isn't compiled for windows.

Change-Id: I236d6e070df93f713cb716bb8a461c9c1d32a180
2015-02-21 09:55:05 +00:00
Ying Wang
e9bc7b472d am 4d0f56fb: Merge "Disable transitive dependency library symbol resolving for mips."
* commit '4d0f56fba3cb89d871e1277d9314da12406394e5':
  Disable transitive dependency library symbol resolving for mips.
2015-02-03 19:43:52 +00:00
Ying Wang
624ef02a50 Disable transitive dependency library symbol resolving for mips.
The transitive symbol resolving causes build breakage when a binary
linked against NDK has indirect dependency on platform libraries, or
vice versa.

Change-Id: Idbfe76079c1db14eb1156d0f396e13d26f0ff582
2015-02-03 10:58:50 -08:00
Yabin Cui
d22d6a537d am 9560d317: Merge "Kill HAVE_PTHREADS."
* commit '9560d31716319be62c97d929f6172c84e267a673':
  Kill HAVE_PTHREADS.
2015-01-27 23:12:05 +00:00
Yabin Cui
0d1f0f8e5a Kill HAVE_PTHREADS.
Bug: 19083585
Change-Id: I5be0d2f95c3c45e7f67de6a8daeb49709ef1f9e9
2015-01-27 14:34:36 -08:00
Ying Wang
c0ff83aebd am 17967eb7: Merge "[MIPSR6] Adjust prebuilts/ndk libraries for mips32r6"
* commit '17967eb72f0eb7f495800d5065b64db4a0174362':
  [MIPSR6] Adjust prebuilts/ndk libraries for mips32r6
2015-01-16 18:32:18 +00:00
Duane Sand
1a07487493 [MIPSR6] Adjust prebuilts/ndk libraries for mips32r6
Change-Id: Ice2d0f65eced4fb7dd209fb15610ba555dd45f2c
2015-01-16 18:13:17 +00:00
Ying Wang
758a029e2a am 59cbe2c6: Merge "Emit unique linker buildid in all binaries."
* commit '59cbe2c65cdd2dc3f1ef7a64a4bf6e3543d07207':
  Emit unique linker buildid in all binaries.
2015-01-16 00:28:48 +00:00
Dehao Chen
734de7a8b4 Emit unique linker buildid in all binaries.
We want to store the symbol information for all android binaries in a global database.

* We ingest unstripped binaries into the global database
* When we collect address data from device (e.g. instruction pointer address), we want to lookup its symbol information through the global database. The key of the mapping is a unique build id, which is the same between binaries on device (stripped) and unstripped binaries.

After applying this patch, the system.img size increases by 0.0047% (16.3KB).

Change-Id: Id92faf2951f43a30947e8d2b690c1af6bf7e3f54
2015-01-15 23:09:35 +00:00
Elliott Hughes
32ecc29996 am c56a6045: Merge "Remove HAVE_SYMLINKS."
* commit 'c56a60451188da6385ae9f52e0adbef14c647f21':
  Remove HAVE_SYMLINKS.
2015-01-13 03:25:04 +00:00
Elliott Hughes
5877c21436 Remove HAVE_SYMLINKS.
Change-Id: I685357292af45a048439f0df0ae45f513479841a
2015-01-12 17:21:01 -08:00