Commit graph

231 commits

Author SHA1 Message Date
Dan Albert
4ae5d4b331 Add a SANITIZE_HOST flag.
We had discussed the idea of making all host tools default to using
ASAN. Even if we don't make it the default, this makes it easy for the
user to switch all host binaries over.

Change-Id: I64a5c741b1b4e9aefed3a6be8dcd4f386e06b29c
2014-12-05 22:20:37 -08:00
Dan Albert
b58fb4aac6 Let clang decide ASan linker flags for the host.
Pass -fsanitize=address instead of manually specifying asan libraries
and other linker flags.

Note that we enable LOCAL_ALLOW_UNDEFINED_SYMBOLS by default for host
builds because ASAN only links symbols in the final executable, so
there will _always_ be undefined symbols in intermediate libraries.

Bug: 18208352
Change-Id: Ief55ab296e94974560eeb10507ec8d90f0025d5c
2014-12-05 14:52:56 -08:00
Stephen Hines
1568029218 Add more support for GLOBAL_CONLYFLAGS.
This will be necessary to support -std=gnu99 mode for clang 3.6, which
defaults to C11 mode (unlike prior releases that use C99).

Change-Id: Iea84582f9f12ba76b988463cbc0a20bd61042538
2014-12-01 15:36:26 -08:00
Dan Albert
d2fa96d7c6 Fix a typo in my_cppflags assignment.
Make strikes once again...

Change-Id: I295b4157fc7566b1a2cb925b06918dc0a96a7bce
2014-11-28 14:00:12 -08:00
Dan Albert
9b0ccb7480 Merge "Fix the libgcc/libatomic link order." 2014-11-17 23:55:57 +00:00
Dan Albert
d3d894da74 Disable gnu style linker hash for NDK builds.
This feature is now available in AOSP, but not for any shipped
release. We don't have an API version for the release that this will
be available in yet, so for now the check is commented out.

Bug: 18395015
Change-Id: I247233d047ed5a7564d6602d47c9ad962313c8dc
2014-11-15 01:50:52 +00:00
Dan Albert
741b36e922 Fix the libgcc/libatomic link order.
The previous position of libgcc.a/libatomic.a on the link line causes
the linker to prefer satisfying dependencies from these libraries from
other libraries that might include them, rather than from libgcc.a (or
libatomic.a) itself. This imposes an ABI requirement that those
intermediate shared libraries _always_ export those symbols, which is
undesirable.

Change-Id: Ib593236b475d3e98356b2b1be6f96cee2b67378f
2014-11-13 21:29:28 -08:00
Dan Albert
954b5bdcf4 Make modules depend on their makefile.
This should obviate much of the need for cleanspecs, and also make it
unnecessary to continue adding LOCAL_ADDITIONAL_DEPENDENCIES for this
sort of thing all over the tree.

Change-Id: I97aa8fd280ae868a5f6364f8b7bf3c2fe235d6ce
2014-11-11 14:30:54 -08:00
Dan Albert
c3031c70f7 Use platform protobuf unless building with NDK.
The NDK protobuf library depends on the final target linking stlport
(since it is a static library). Since the platform stlport is going
away, we need to use a separate version of the protobuf library that
is compiled for the platform against libc++.

Note that this should be the case for _all_ libraries built with the
NDK. If a library needs to be used by both an NDK built final target
and a platform built final target, there should be both an NDK and
platform version of the library.

Bug: 15193147
Change-Id: I0ead61c2d1cd9d0248b304ab7d8682dedd6e8366
2014-11-11 11:05:27 -08:00
Jeff Davidson
ed9981d927 am 427d1e98: Merge "Pull in latest protolib when using LOCAL_PROTOC_OPTIMIZE_TYPE."
* commit '427d1e98eceb78f5cb8f1e50d00d342fc7f359c6':
  Pull in latest protolib when using LOCAL_PROTOC_OPTIMIZE_TYPE.
2014-10-29 17:40:05 +00:00
Jeff Davidson
427d1e98ec Merge "Pull in latest protolib when using LOCAL_PROTOC_OPTIMIZE_TYPE." 2014-10-29 17:35:17 +00:00
Dan Albert
ef8912d93f am d274e04a: Merge "Don\'t sort shared library link order."
* commit 'd274e04ac4317d7cfc2de02ca215e064c018c234':
  Don't sort shared library link order.
2014-10-28 04:46:53 +00:00
Dan Albert
04eead7e2b Don't sort shared library link order.
Only sort the list of shared libraries used for naming dependencies,
not the order they are actually linked in. The order in which shared
libraries appear to the linker affects which symbols get used if there
is a multiply defined symbol.

Also link system shared libraries _after_ user provided libraries,
since a user will want their functions to override the system's if
they exist.

Change-Id: I071059d940d40a648d69d90e0699073ef520138a
2014-10-23 14:04:02 -07:00
Jeff Davidson
b8ddd55b55 Pull in latest protolib when using LOCAL_PROTOC_OPTIMIZE_TYPE.
If a module is explicitly depending on a versioned protolib, we strip
the dependency and log a warning so the unneeded dependency can be
removed.

Change-Id: I949d32fb5126f1c05e2a6ed48f6636a4a9b15a48
2014-10-23 07:20:16 -07:00
Dan Albert
96983cba42 am cc0aa4da: am 28c265dd: Merge "We also need -rdynamic for host ASAN."
* commit 'cc0aa4dabd4bae2b17bc9de8f88e04e862d030b2':
  We also need -rdynamic for host ASAN.
2014-10-20 22:42:11 +00:00
Dan Albert
4ffe3f5b9f We also need -rdynamic for host ASAN.
Change-Id: Iee33ca85c25d9bf126be8318a3b837074ab10076
2014-10-20 13:54:27 -07:00
Dan Albert
66acb2a8ae resolved conflicts for merge of 96c22133 to lmp-dev-plus-aosp
Change-Id: I35a2f403e9e664536b45b5ac9185adf1e1a02442
2014-10-20 13:37:18 -07:00
Dan Albert
2daceaa83c Add support for ASAN in host modules.
Change-Id: Id9ed83499e0eb995f06e845c3153a50677d768b8
2014-10-20 11:37:18 -07:00
Dan Albert
6adf02580b am 24c1d149: am a01fa4f8: Merge "LOCAL_NATIVE_COVERAGE should imply -O0."
* commit '24c1d149678dcd03f679bfa0fc29386cee779935':
  LOCAL_NATIVE_COVERAGE should imply -O0.
2014-10-09 01:14:58 +00:00
Dan Albert
4c12c0303c LOCAL_NATIVE_COVERAGE should imply -O0.
Optimization can lead to incorrect coverage results.

Change-Id: I8ade9ab246e292d26ac18821baf9970e29dc1a1f
2014-10-08 17:05:19 -07:00
Ying Wang
4019305580 am e4e50f9b: am 8330c4c5: Merge "Apply LOCAL_CXX_STL to also prebuilts."
* commit 'e4e50f9bb4ae8af11aaddf9825a09ff33241b204':
  Apply LOCAL_CXX_STL to also prebuilts.
2014-10-07 23:20:51 +00:00
Ying Wang
75e8fcbb6c Apply LOCAL_CXX_STL to also prebuilts.
Because LOCAL_CXX_STL modifies a module's required shared libaries,
we need this for also prebuilt shared libraries and executables.

Change-Id: I418c26143999a613c40aadf990f131b123e0ac3d
2014-10-07 13:07:00 -07:00
Dan Albert
15cb27748f am 55c2adff: am b6361968: Merge "Remove unused my_compiler_dependencies."
* commit '55c2adfffac9b40992316938699cb36e0818fbbb':
  Remove unused my_compiler_dependencies.
2014-10-06 18:46:02 +00:00
Dan Albert
a8fd66822a Remove unused my_compiler_dependencies.
my_compiler_dependencies was never assigned to, but the way it was
included in the rules prevented the user from being able to use | in
LOCAL_ADDITIONAL_DEPENDENCIES. Since it is unneeded, just remove it.

Change-Id: I74bb59e81b97756296060eea5b7a42909be50130
2014-10-06 10:45:44 -07:00
Chih-Hung Hsieh
1184754c22 am b9b2d21c: am 4a8d5c1a: Merge "Add local Clang+target specific flags."
* commit 'b9b2d21c04d0ba65ad56a26f8306e9afa7d99694':
  Add local Clang+target specific flags.
2014-09-27 02:59:47 +00:00
Chih-Hung Hsieh
4a8d5c1aaf Merge "Add local Clang+target specific flags." 2014-09-27 02:40:28 +00:00
Chih-Hung Hsieh
619fdb8d77 Add local Clang+target specific flags.
BUG: 17677366
Change-Id: I75522fb56fdf4d27ea1f5f0ae15866b13ae6e206
2014-09-26 17:19:49 -07:00
Stephen Hines
7a5d35b22a am 145eddfd: am 670018fd: Merge "Remove unnecessary CLANG_CONFIG_EXTRA_*_C_INCLUDES variables."
* commit '145eddfd229b118fadd4f4f255dbecc1a79b5e2b':
  Remove unnecessary CLANG_CONFIG_EXTRA_*_C_INCLUDES variables.
2014-09-26 19:53:06 +00:00
Stephen Hines
f00896663e Remove unnecessary CLANG_CONFIG_EXTRA_*_C_INCLUDES variables.
These aren't needed now that we only use the compiler/headers that exist in
the prebuilts/clang directory.

Change-Id: I9978efb10815e92577d45629db324e0a5094f880
2014-09-25 22:35:16 -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
634e7df1c8 am acaada12: Use existing my_32_64_bit_suffix.
* commit 'acaada12731639e3feba1dd83d7e44765ec8556c':
  Use existing my_32_64_bit_suffix.
2014-09-10 23:32:46 +00:00
Ying Wang
acaada1273 Use existing my_32_64_bit_suffix.
Change-Id: I75d9733870c37a44ce55ae6cbcfb3f67e1387e9d
2014-09-10 16:11:41 -07:00
Tim Murray
c0bdd15b10 am fabd3c00: Merge "Pass -m32 or -m64 to llvm-rs-cc when reflecting C++." into lmp-dev
* commit 'fabd3c00b461c921cb745acd62e7b07b4e938241':
  Pass -m32 or -m64 to llvm-rs-cc when reflecting C++.
2014-09-10 22:58:37 +00:00
Tim Murray
f0020c6157 Pass -m32 or -m64 to llvm-rs-cc when reflecting C++.
bug 17417839

Change-Id: Iea4aede874f751ac732c3e3ae7a11e18613edcf5
2014-09-10 15:11:01 -07:00
Chih-Hung Hsieh
ace83ae389 am 2202dc0a: am 1051d5dc: Merge "Add LOCAL_CLANG_*FLAGS for clang only flags."
* commit '2202dc0af3ab86e2a73bf816012aaea65fb93d91':
  Add LOCAL_CLANG_*FLAGS for clang only flags.
2014-09-05 02:34:31 +00:00
Chih-Hung Hsieh
9aa69a6752 Add LOCAL_CLANG_*FLAGS for clang only flags.
To be used only for some modules.

Change-Id: I107ec37f11f738f860598f0c86c4ad7ec20c9011
2014-09-04 18:43:16 -07:00
Dehao Chen
19aa0acbf4 am 2d83365c: Merge "Add TARGET_FDO_LDFLAGS to make sure -lgcc is always linked after -lgcov." into lmp-dev
* commit '2d83365c9d852874bee790e2047178959933133e':
  Add TARGET_FDO_LDFLAGS to make sure -lgcc is always linked after -lgcov.
2014-08-21 17:52:54 +00:00
Dehao Chen
f4294cd816 Add TARGET_FDO_LDFLAGS to make sure -lgcc is always linked after -lgcov.
Change-Id: I33a94abe58391a8564ada14417b0158ddd7ed2d6
2014-08-20 16:48:17 -07:00
Dan Albert
37d058859b am 473dc3d4: am be0af1f7: Merge "Strip my_clang on assignment."
* commit '473dc3d416a29371085237c26f5df391d9698ec1':
  Strip my_clang on assignment.
2014-08-18 19:34:52 +00:00
Dan Albert
db905e7b11 Strip my_clang on assignment.
There were a few cases that my_clang was being used without being
stripped. This was causing uses like the following to fail because it
would be partially applied (use clang as the compiler, but don't strip
out incompatible cflags).

    LOCAL_CLANG := true # explanation

To avoid this problem in the future, just strip my_clang when it is
assigned.

Change-Id: I41c2f36a4d4c3aa305a25b4a151c066dad5ffe0f
2014-08-18 11:14:38 -07:00
Dehao Chen
ec1a73943b am 5b81106e: Merge "Explicitly check if LOCAL_FDO_SUPPORT is true (instead of empty). Change-Id: Icff260c7f866236254091b035782607a31e5a109" into lmp-dev
* commit '5b81106eb5c5c9a616874caae5ea91b45a45e9d6':
  Explicitly check if LOCAL_FDO_SUPPORT is true (instead of empty). Change-Id: Icff260c7f866236254091b035782607a31e5a109
2014-08-15 11:51:02 +00:00
Dehao Chen
f7a909db63 Explicitly check if LOCAL_FDO_SUPPORT is true (instead of empty).
Change-Id: Icff260c7f866236254091b035782607a31e5a109
2014-08-14 17:54:14 -07:00
Tim Murray
96a8c9bc9f am 68301526: am b771d956: Merge "Add flag to enable default clang builds--USE_CLANG_PLATFORM_BUILD."
* commit '6830152675bf4daa9c118c686bf522498c4df3a3':
  Add flag to enable default clang builds--USE_CLANG_PLATFORM_BUILD.
2014-08-13 19:41:00 +00:00
Tim Murray
06659bc9b7 Add flag to enable default clang builds--USE_CLANG_PLATFORM_BUILD.
bug 17007253

Change-Id: Ib11c017bf8aee384e6780e2a1252221fbff3327a
2014-08-13 12:18:30 -07:00
Dan Albert
47b755b486 Fix Windows SDK build.
Bug: 16823325
Change-Id: Ia2a318957aa525f0e72b556a693a20f513146b64
(cherry picked from commit 95994def18)
2014-08-08 08:16:04 -07:00
Dan Albert
04cf315970 Inhibit implicit -Bsymolic in -shared.
Bug: 16853291

Change-Id: Id70488b077256a70137c4417f21be2c2d1d4341c
(cherry picked from commit b6bb71b85d)
2014-08-08 08:15:19 -07:00
Dan Albert
908ab54fda 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
(cherry picked from commit 4803ce2696)
2014-08-08 08:15:14 -07:00