Commit graph

56 commits

Author SHA1 Message Date
Elliott Hughes
09ba4c870d Turn on stack protector for mips64.
Go straight to -fstack-protector-strong, since it works to boot the emulator.

Change-Id: I2b65a0ab4426856ae05f66c1e294951e45bd72b6
2015-12-14 14:46:38 -08:00
Dan Willemsen
da9c00da5f Enforce linker version-scripts are valid
Currently, if a version script is passed to the linker (using
-Wl,--version-script,...), it is used to limit symbol visibility and
assign symbol versions. But if a symbol is listed in the version script
but is not present in the binary, no error or warning is given.

Pass -Wl,--no-undefined-version to the linker so that it verifies all
(non-wildcard, C) entries in the version script match symbols in the
binary.

Change-Id: I65878931ab61124ae75e2c738cc733adfb107afc
2015-12-02 19:19:04 -08:00
Shinichiro Hamaji
0e7587a9ea Use .KATI_RESTAT to reduce unnecessary rebuilds of binaries
When a shared object is rebuilt, all dependent libraries and
executables are rebuilt. Such rebuild is unnecessary when there
is no interface change. With this patch, .toc files will be
generated for all .so files. The rule which generates .toc files
has ninja's restat=1 and .toc files are not changed ninja won't
rebuild dependent targets.

Performance:

$ m && touch bionic/libc/stdio/stdio.c && time m
Before: 1m03s (2563 targets)
After: 21s (90 targets)

Bug: 24597504
Change-Id: Ia5dd950273d143f4e99eee8bef7478f1a94cd138
2015-11-04 15:23:59 +09:00
Christopher Ferris
6a2f28514c Add the common directory back to kernel headers.
There will only be a very small set of non-uapi headers. This is
mostly being done for the scsi headers since the kernel has not
made uapi versions of all of them.

Change-Id: I44904b07ff96de918dc5fcab4e5f117a34cb2a87
2015-09-17 21:20:03 -07:00
Elliott Hughes
43146118aa Remove AndroidConfig.h.
This change leaves soong references.

Change-Id: Iee32b6b97ad9711f69e999c9d01f01d71562b63f
2015-08-28 10:31:28 -07:00
Dan Albert
7ba582aec3 Dedup system shared libraries.
These shouldn't differ by target. Right now only mips64 does, and
that's a bug.

Change-Id: Ic941ede85ba1bc07d3316a55639ba71a6afc9630
2015-08-06 14:18:55 -07:00
Dan Albert
46ed1e8590 Disable transitive symbol resolving for mips64.
The transitive symbol resolving causes build breakage when a binary
has indirect dependency on the NDK library.

This matches the change made for the the aarch64 toolchain:
https://android-review.googlesource.com/#/c/120654

Change-Id: Id5b2a63301cb1cdcdd84b4bcd9fbec8cf6ec0b3c
2015-08-06 14:18:55 -07:00
Nikola Veljkovic
91091280f1 Revert "[MIPS] Do not use compact branches until GDB supports them"
This reverts commit 063ef33089.
2015-06-17 17:22:26 +02:00
Elliott Hughes
c09eaa7a44 Remove copy & paste cruft from the mips64 combo.
libthread_db hasn't been in bionic for years.

Change-Id: Ibc036d894c6b6bf9ee4653f95ff7a000a223cb2e
2015-06-16 15:22:52 -07:00
Nikola Veljkovic
063ef33089 [MIPS] Do not use compact branches until GDB supports them
GDB does not yet have support for compact branches, and is unable to
set a breakpoint on them. Turn compact branch generation off, until
GDB is fixed.

Change-Id: Ie7d6fb891e9934f8fc645fe9cf8f706be15a5f77
2015-05-25 16:27:01 +02:00
Dan Albert
216ecac61e Fix prebuilts for target builds with USE_MINGW=1.
USE_MINGW=1 mm didn't work in directories that contained target modules
because the build system would use the Windows locations and extensions
when trying to find the host GCC prebuilts. Windows is the target OS,
not the OS we're building from.

Change-Id: Ic994fed15388d0c7d393f71ba28fe7afdc659f5c
2015-05-04 22:44:39 +00:00
Dmitriy Ivanov
8387d99ec3 Revert "Revert "Pack relocations for mips64""
This reverts commit 6399dcce59.

Bug: http://b/20658994
2015-04-29 17:08:54 -07:00
Dimitry Ivanov
6399dcce59 Revert "Pack relocations for mips64"
This reverts commit 8bd30fe3cb.

Bug: http://b/20658994
Change-Id: I6c31094559a12b824344802bf3993f91aee79a26
2015-04-29 18:59:05 +00: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
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
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
Duane Sand
1a07487493 [MIPSR6] Adjust prebuilts/ndk libraries for mips32r6
Change-Id: Ice2d0f65eced4fb7dd209fb15610ba555dd45f2c
2015-01-16 18:13:17 +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
Dan Albert
e088c0d281 Refactor transform-o-to-* definitions.
Previously, there was one generic definition for each of the
transform-o-to-* functions in definitions.mk, and one target specific
one in each combo/TARGET_*.mk. The generic one was entirely unused,
and the target specific ones were all nearly identical.

Changing anything in these functions was tedious at best, and often
error prone. The differences between any 32-bit arch and its 64-bit
equivalent were restricted to the name of the linker, and the ARM and
MIPS definitions were identical. The few differences between ARM and
x86 looked to be compatibility for an old (ca. 2008) toolchain issue
with --gc-sections, and a bug (LDFLAGS coming first rather than
later).

To simplify things, I've moved the definitions for these out of
combo/TARGET_*.mk and back into definitions.mk. The differences
between ARM and x86 have been scrapped. Anything that really does
still need to be target specific can be handled as I have the linker:
add a TARGET_FOO variable to the given target and then add it to the
generic definition.

Change-Id: I54dc1bffc32ac39f27f0b87247dd6a6dbaf0b162
2014-11-13 16:21:46 -08:00
Dan Albert
ae66eba6f3 resolved conflicts for merge of 852fc3e6 to lmp-dev-plus-aosp
Change-Id: If3de742dcd2157c4690ae0eb34494dc11492054f
2014-10-14 17:15:17 -07:00
Dan Albert
e1b17e7ef5 Link compiler-rt in the correct order.
The compiler run-time library should always be the _last_ thing linked
when building static executables. This was being done correctly for
libgcc, but not when using compiler-rt.

Change-Id: I0689dc35f55caad2fe74c0cbb4cbe3008ded349a
2014-10-14 10:45:33 -07:00
Dan Albert
7655a97984 resolved conflicts for merge of 326f9450 to lmp-dev-plus-aosp
Change-Id: I66360da623a6e7ac04610c3252f24ed69f7e4b1e
2014-09-24 09:42:39 -07:00
Dan Albert
4bbc6c790b Add option for generating coverage info.
To enable building with coverage, the environment variable
NATIVE_COVERAGE must be set to true.

Set `LOCAL_NATIVE_COVERAGE := true` to generate coverage information for
a given component.

This is currently not supported for clang (b/17574078, b/17583330).

If static library A is included in a binary B (dynamic or static
executable, or shared library), and A is built with coverage
information, B is required to link with libgcov.a. Since the make does
not offer a good way to track this dependency, link libgcov.a even if
LOCAL_NATIVE_COVERAGE is not set (but still guarded by NATIVE_COVERAGE).
This ensures that all of the libgcov dependencies will always be
resolved, and causes no change in the resulting binary if coverage is
not used.

Bug: 10134489
Change-Id: Id5a19f2c215e4be80e6eae27ecc19b582f2f6813
2014-09-23 15:19:02 -07:00
Dan Albert
220b01ba27 am 92421720: am 98f7742a: Merge "Move selection of C++ STL into the build system."
* commit '9242172094691c7203ba7cf0a5e5db611ca9032b':
  Move selection of C++ STL into the build system.
2014-09-19 00:16:16 +00:00
Dan Albert
b05f2ca150 Move selection of C++ STL into the build system.
Preparing for migration from stlport to libc++. STL selection is done
with LOCAL_CXX_STL (valid values are default, none, libc++,
libc++_static, stlport, stlport_static, bionic).

The selection of the STL is as follows:

    if LOCAL_CXX_STL == 'default'
      ifdef LOCAL_SDK_VERSION
        Use whatever STL the other NDK options have selected.
      else
        Use bionic's libstdc++ for target, GNU libstdc++ for host. This
        is compatible with the existing build options.
      endif
    else
      if LOCAL_CXX_STL == 'stlport'
        Use stlport.
      else if LOCAL_CXX_STL == 'libc++'
        Use libc++.
      else if LOCAL_CXX_STL == ''
        Don't use any STL.
      endif
    endif

Bug: 15193147
Change-Id: If712ba0ae7908d8147a69e29da5c453a183d6540
2014-09-18 16:38:20 -07:00
Ying Wang
180b22590d am 729c9ff5: am 7754e0ce: Merge "[MIPS64] Modify the default MIPS64 build to MIPS64R6."
* commit '729c9ff5ec2085461027a5174d053e77b8c9a100':
  [MIPS64] Modify the default MIPS64 build to MIPS64R6.
2014-09-03 19:59:17 +00:00
Raghu Gandham
10326b3d7f [MIPS64] Modify the default MIPS64 build to MIPS64R6.
Change-Id: I797e4c2e5b69c6991545c26886b5b25e6f8c2a67
2014-09-02 16:30:00 -07:00
Dan Albert
9d6aa51a0f am e99d8947: am cbc742a1: Merge "Inhibit implicit -Bsymolic in -shared."
* commit 'e99d8947c09731d71db7e95a280cf81f51f4049a':
  Inhibit implicit -Bsymolic in -shared.
2014-08-08 00:23:56 +00:00
Dan Albert
d423e5fbdb am 897cd3d4: am afae9fd8: Merge "Fix uses of -fPIC and -fPIE."
* commit '897cd3d494272b8a6a12f0fb6d02bfe7426a309c':
  Fix uses of -fPIC and -fPIE.
2014-08-08 00:23:55 +00:00
Dan Albert
4803ce2696 Fix uses of -fPIC and -fPIE.
We've been using -fPIC and -fPIE together in the global cflags all this
time. These options are incompatible. The only reason we haven't been
hit by this before is because of the forced -Bsymbolic in GCC. To fix
this, pass -fpic when compiling objects for shared libraries and -fpie
when compiling objects for executables. For static libraries, also use
-fpic. We have to do this because static libraries might be included in
either a shared library or an executable. Code compiled with -fpie
cannot be included in a shared library, but code compiled with -fpic
may be included in an executable.

We've also been using -fpic and -fPIC together. These are different
options, and only the latter will take effect.
http://stackoverflow.com/a/967010

The final thing this fixes is that we had -f(PIC|PIE) flags being passed
to link commands. These are compile time flags, and don't do anything at
link time.

Bug: 16823325
Change-Id: Ic76f47e63dc2c81b7e1a8058bae1b3dc8565d606
2014-08-07 10:20:58 -07:00
Dan Albert
b6bb71b85d Inhibit implicit -Bsymolic in -shared.
Bug: 16853291

Change-Id: Id70488b077256a70137c4417f21be2c2d1d4341c
2014-08-07 15:43:16 -07:00
Dehao Chen
48065cb10e am e43c96c3: Merge "Update the FDO support:" into lmp-dev
* commit 'e43c96c332890a4641b9310aad9b4dddd80fabc0':
  Update the FDO support:
2014-07-31 16:56:10 +00:00
Dehao Chen
5f5c48f0f1 Update the FDO support:
* Explicitly check BUILD_FDO_INSTRUMENT and BUILD_FDO_OPTIMIZE with true
* Remove unnecessary target_libgcov
* Update the profile collection path on device so that most app can have write access

Change-Id: I5c1915a12ea37b2cb3c76a27e7104e47ad636928
2014-07-30 16:54:55 -07:00
Dehao Chen
25671e15cc Refactor FDO support code to ensure arm64 can also be built with FDO.
Change-Id: I752c9f411b0a046a15c72b4837efc1fb0503b470
2014-07-23 16:23:46 -07:00
Elliott Hughes
0b3c42cbc8 Merge "[MIPS] Unite mipsel and mips64el 4.9 gcc toolchains" 2014-07-23 17:53:27 +00:00
Duane Sand
6670e24aed [MIPS] Unite mipsel and mips64el 4.9 gcc toolchains
Use 4.9 mips64el toolchain for both 64- and 32-bit builds.
Tell ld when 32-bit links are required.
Override 4.9's changed defaults for mips floating point
register use, to get same assembler rules as 4.8 and earlier.

Also: drop unused  soft-fp build targets, cleanout redundant
compiler options, and remove extraneous Android.mk file.

Change-Id: I86f1075266349edb2b08a7709b9f5472d8cfda32
2014-07-23 14:16:00 -07:00
Duane Sand
41ca444637 [MIPS64] Enable mips64 clang
Change-Id: I737f40ff1d4c71c21bea5159d1b0acee89fe32a2
2014-07-23 14:10:39 -07:00
Ying Wang
1bb9adb880 Merge "[MIPS64] Enable mips64 clang" 2014-07-23 18:51:55 +00:00
Dehao Chen
7092c79a14 Refactor FDO support code to ensure arm64 can also be built with FDO.
Change-Id: I752c9f411b0a046a15c72b4837efc1fb0503b470
2014-07-23 16:34:07 -07:00
Ying Wang
4b1c95d8d2 More consistent use of 64-bit build variable.
Set up TARGET_IS_64_BIT and HOST_IS_64_BIT early so we don't need 2
mechanisms to judge if it's 64-bit build;
Remove the unnecessary 32-bit host variables.

Change-Id: I08d6d4d9ea70f91135fe2ee05463fb9a0d1cee42
2014-07-08 18:04:17 -07:00
Dan Albert
50031de36e Remove -Bsymbolic from builds.
This is causing issues when tools like asan try to wrap calls like
malloc. See the referenced bug for more details.

Bug: 15432753
Change-Id: I15e8eab5b773afd02dc14c78500cf8246a617718
2014-06-13 10:24:12 -07:00
Stephen Hines
a8b65126ca Merge "Add -shared to clang LDFLAGS." 2014-05-30 22:59:48 +00:00
Tim Murray
0f9276d4ba Add -shared to clang LDFLAGS.
TOT clang doesn't do the right thing with regards to -pie without this.

Change-Id: Ic14cfb25d96359eb18899c09ebaf1d311e937d01
2014-05-29 17:54:07 -07:00
Andrew Hsieh
4c952d72b7 Add -latomic to all target builds
Projects using stdatomic.h needs libatomic.a in case compiler can't
expand all __atomic* intrinsics. eg, __atomic_is_lock_free in
armeabi/mips.

Adding libatomic.a globally makes more sense than adding
"LOCAL_LDLIB += -latomic " in each project including <stdatomic.h>.
Projects don't need atomic operations won't get redundant DT_NEEDED
entry because libatomic.a is not a shared library.

Change-Id: I81dbf524544c848e667e18ab5eeabff75b5063ef
2014-05-29 11:40:46 -07:00
Ying Wang
d90de32951 Exclude libstdc++ and libgcc if libc++ is requested.
Bug: 15174002
Change-Id: I24fe428c3520f76cd61f0660b59ba18a1f2d2dad
2014-05-23 16:42:37 -07:00
Andrew Hsieh
48f239c94f Disable canonical prefixes of system headers
GCC know a few pre-defined paths (relative to its location) to
search for headers, libraries, program, etc.  By default GCC prefixes
its own path(argv[0]) and calls realpath() which result in absolute
path with all symlink, . and .. removed.

It's usually good to have canonicalised paths, but absolute paths
in *.d file can cause unnecessary relinking when stale entries
in ccache cache hit

Add -no-canonical-prefixes (gcc>=4.6) and
-fno-canonical-system-headers (gcc>4.6) to disable realpath() on
prefixed paths

Change-Id: I58d739e61fb013015fb05a9c98b2132b307f915a
2014-05-09 22:12:49 +08:00
Ying Wang
de36cd72e8 Apply LOCAL_LDLIBS to target build rules too.
Use LOCAL_LDLIBS to link against prebuilt libraries (such as NDK
libraries).
Previously LOCAL_LDLIBS only applies to host modules and the behaviour
confuses users.

Change-Id: I515546d7b59ef54e8ef09050eb58ec63534c9291
2014-05-07 11:33:19 -07:00
Elliott Hughes
1acd8b0552 Leave 'linux' defined on mips/mips64, like arm.
Change-Id: Idf1e781c34d45d1e20b7e5542d79201ae93668fe
2014-04-23 23:24:36 -07:00