Commit graph

118 commits

Author SHA1 Message Date
Colin Cross
737cb6566f Use exported gtest include directories
Manually inserting gtest include directories causes build failures in
manifests that don't have external/gtest.  external/gtest already
exports its include directories so remove the manual include directory.

Change-Id: I6baac4bd3bea7dba3aa134d18b66f02a6dc9a54a
2016-04-25 15:13:23 -07:00
Colin Cross
16b2349190 Add support for sanitizer property
Add a new feature to cc modules that adds the cflags and libraries
necessary to implement AddressSanitizer, ThreadSanitizer, and
UndefinedBehaviorSanitizer.

Change-Id: Ibe5ffadc7ece56080a2521f2c7c00da9ef712584
2016-04-21 16:42:08 -07:00
Colin Cross
a8e07cc653 Promote stl to a fixed feature
cc needs to know what stl was selected, promote stl from a generic
feature implementation to a fixed type pointer.

Change-Id: I950ef947f7cd254fe3074f4ff240bb2b90b9116c
2016-04-21 16:39:28 -07:00
Colin Cross
919281aa91 Refactor out exported cflags
Exported cflags are needed by a variety of cc module types.  Refactor
them into an object that can be composed into any cc module type.

Change-Id: I7427ba71085917ca3ec522abadfa2bf33ab43440
2016-04-21 16:35:03 -07:00
Dan Willemsen
b40aab6955 Fix generated sources and headers
Add two cc properties: `generated_sources` and `generated_headers`,
instead of just adding genrule modules to `deps`. Label these with the
dep tagging mechanism, add the generated_headers paths to the include
paths, and add dependencies to generated headers for each compile.

Add dependencies so that regular sources can include generated yacc
headers, not just other generated lex/yacc files. Static/shared specific
sources still don't have dependencies to or from regular sources though.

Switch from an implicit dependency on generated files to an orderonly
dependency, since the depfile will take care of the necessary implicit
dependencies for incremental builds.

Change-Id: I436675acb1f57329d98b81c56dcb4384201a68ea
2016-04-20 15:54:19 -07:00
Colin Cross
21b481b757 Update sanitize property format
Change-Id: Ibca493a70a19cd3dfb58b5404b1c9ed42e068748
2016-04-15 16:27:17 -07:00
Colin Cross
c99deeb961 Use blueprint DependencyTags
Blueprint now requres DependencyTags to be passed to AddDependency
calls.  Use the tags to avoid setting member variables on modules, which
will be lost after the mutators have been called.

Change-Id: I8c1d9ed1db85a300e14394b911a516d361ba9f75
2016-04-12 15:24:02 -07:00
Colin Cross
8141347295 Rename deps property to objs in cc_objects
The deps property is handled by blueprint, which doesn't give the
flexibilty of handling it within soong.  Switch to using objs instead.

Change-Id: Ib8273546578b31b186a3cf1566e80a5eb11943b7
2016-04-11 14:52:04 -07:00
Elliott Hughes
852442957b libm's headers have moved to live with their libc cousins.
(To reduce the need for this kind of thing in the various build systems.)

Change-Id: I75d11497bbf42695f804bcc9ea9ba3b3a12ac764
2016-04-04 12:58:03 -07:00
Dan Willemsen
d30e610ef2 Move runpaths out of global ldflags
The make macros add these to the linker lines even if the default
compiler flags are being skipped.

This also allows us to add another runpath for test binaries, which are
currently being installed in:

  <out>/host/linux-x86/nativetest[64]/<test>/<binary>

So they need to use ../../lib[64] as a rpath.

Change-Id: Ia7e954cdf63bc627a8f71d01c953530355c248ab
2016-03-31 00:00:02 -07:00
Dan Willemsen
e71749280e Fix ToolchainLdflags calls
Instead of having the baseCompiler adjust the Ldflags, teach
objectLinker about ToolchainLdflags. And don't assume that
ToolchainLdflags will work for Clang too, add a ToolchainClangLdflags
call.

Change-Id: I5f546e46f32edf3fcf75a44bee2c5ee103bc5de3
2016-03-30 21:16:34 -07:00
Dan Willemsen
0c38c5ea17 Only add -fdebug-prefix-map on Linux hosts
Change-Id: I4fb865fbe40020f2d69d598491e755f793b62b7c
2016-03-29 18:03:54 -07:00
Colin Cross
7b106e4e9f Don't install static libraries
Disable installing static libraries for now by resetting the installer
when creating a static library variant.

Change-Id: I9360b5c57d95fc0712539accb9450b5fa402fade
2016-03-25 17:31:43 -07:00
Colin Cross
a23446680f Use correct install paths in generated Android.mk
Extract Soong's install path and put it in the generated Android.mk file
so that tests get installed in the correct place.

Change-Id: Id4726855c5677855406de20773a5da533bdd4cea
2016-03-24 13:14:12 -07:00
Colin Cross
ca860ac720 Refactor cc
Refactor all of cc in order to use composition instead of inheritance.
All cc module types exported by cc are now *cc.Module objects, with
compilation, linking, and installing steps delegated to different
objects in order to form the full module type.  Additional features that
modify dependencies and flags can be inserted in a features object list,
and custom module types can be created by adding a Customizer object
that can modify properties.

Change-Id: Ie1283d14920f7856f6947b0530606b2f4d58fab0
2016-03-21 17:31:04 -07:00
Colin Cross
7253e0b8a4 Update clang version to 2690385
Matches changes in I1226f24b50319e321ea538362b2f26fcd227ca39

Change-Id: Iecb2c7388d91fe9975dbe035b5ce6fec8d32a435
2016-03-21 15:13:10 -07:00
Dan Willemsen
dc5d28ad17 Allow overriding of Clang prebuilts
These are the environment variables used by make to override the
llvm/clang prebuilts. As far as I know, these should only be used when
building or testing a new clang drop.

I would have this handled by make and put in soong.variables, but I
expect this to be one of the first options removed from make and
exported from Soong to Kati.

Change-Id: I7a3a70ee44fc4b1e56a5e200e2a7ced77d4c5692
2016-03-16 13:18:07 -07:00
Dan Willemsen
6553f5ef57 Propagate missing dependencies when using whole_static_libs
Currently, whole_static_libs with missing dependencies are silently
ignored. Instead, when getting the object files from the other module,
add its missing dependencies to the current module.

Change-Id: I12472dede2dfafdded56268bfd37f60063b637c4
2016-03-11 21:52:34 +00:00
Dan Willemsen
eb371e51d9 Switch to clang-2658975
Port of https://android-review.googlesource.com/206366

Change-Id: Ife2e0ab84de839ea73744cb65f995a11e3145304
2016-03-11 12:44:29 -08:00
Dan Willemsen
282a4b0dda Fix C++ on Darwin
Port of https://android-review.googlesource.com/207241

Change-Id: Idad81a528a2104579de0225b0724bb81293eea44
2016-03-09 10:30:22 -08:00
Dan Willemsen
b955336d33 Swap -lm and -lpthread for host libc++ users
Match the order we use in make.

Change-Id: I7959f72841bd058b13d6c8fc6efb3c78b5de9d35
2016-03-03 19:24:03 -08:00
Dan Willemsen
99db8c30c1 Do not use -Wl,--gc-sections for linux host libraries
This matches make

Change-Id: I2ee2e47065439afa02b946ede3a7718f1a8dc71b
2016-03-03 18:09:19 -08:00
Dan Willemsen
be03f346b3 Port GLOBAL[_CLANG]_CFLAGS_NO_OVERRIDE from make
Change-Id: I4f0f8ec7620e4477f60bf9cf1ae0c005470c89d4
2016-03-03 17:21:04 -08:00
Dan Willemsen
52b1cd2544 Add a global define for non-external code.
Soong port of https://android-review.googlesource.com/204887

Change-Id: I15faf62cec1932dd859a082f66942b2606d0ff45
2016-03-02 03:08:37 +00:00
Dan Willemsen
98f93c77e8 Add system/media/audio/include to commonGlobalIncludes
This list now matches the make build system.

Change-Id: Ife723733f269bdcc00a0c2e9096e3e2cb7e6f88e
2016-03-01 17:22:51 -08:00
Dan Willemsen
a6084a3662 Add -Werror=date-time to target builds
Soong port of https://android-review.googlesource.com/195464

Change-Id: I68acfb53be962ffd5c488337517dadb950a13b6f
2016-03-01 17:22:44 -08:00
Dan Willemsen
767078e761 Update to use the latest clang-2629532
Soong port of https://android-review.googlesource.com/204812

Change-Id: Ib6c94bc57f7145c1cc9b14338126132fc4648509
2016-03-01 17:22:19 -08:00
Dan Willemsen
fc9c28ca02 Toolchain modules use GCC
Don't use clang cflags if the device uses clang by default.

Change-Id: Ice8474ae1f5e6f37fc8b47b1679d7fbdb9249e5a
2016-01-13 14:01:42 -08:00
Dan Willemsen
6dd0660905 Apply ToolchainLdflags to clang builds
Otherwise we're missing -m32 and -m64 in x86/x86_64 builds.

Change-Id: If63cc6ce12795921584437e4cee4530c0dfb634f
2016-01-13 13:32:26 -08:00
Dan Willemsen
32968a2a48 Add Clang Asflags for mips
Like make, it needs -fPIC to be added to compile successfully.

Change-Id: I1d6f1388c42a84f331bbce1ecd669669441d986e
2016-01-13 13:32:26 -08:00
Dan Willemsen
415cb0ff14 Remove libgcov for now to fix X86 devices
We should be using libprofile_rt for clang builds, but we only need to
add either one if code coverage is enabled. This will be added again
when we get more complete support.

Bug: 26525326
Change-Id: Ic3da07c896be266bb35747a79c184e3d5bb8df70
2016-01-13 13:32:26 -08:00
Dan Willemsen
ac5e1cb30f Change clang extra flags behavior
Move the clang extra flags into the *ClangGlobal*flags variables,
instead of adding them to every clang-based module. This means that
they're only applied when !no_default_compiler_flags, like make.

Change-Id: I43b1378d1d932d9aecfd8724a492d0d7716f7631
2016-01-13 13:32:26 -08:00
Dan Willemsen
e0378dd4df Allow libnativehelper to be missing
Some branches may not include libnativehelper, or anything that depends
on jni.h

Change-Id: Id8bb9c101aecfacc5d62048818ea0c1c88b7d77c
2016-01-07 18:57:34 -08:00
Dan Willemsen
10d52fd9eb Allow building non-gtest tests with cc_test
That way we get the other special cc_test features (test_per_src,
multilib-both default, nativetest install path).

Restrict test_per_src to CCTest instead of allowing all CCBinaries to
use it.

Change-Id: I767540841fe5d1f9755883ee7c3d1f24004f9631
2016-01-05 15:15:11 -08:00
Dan Willemsen
782a2d116a Refactor install paths
Explicitly allow installation into the data partition instead of using
"../data" for tests. At the same time, pipe through the information
required for vendor modules.

Change-Id: I6baf9d828c285e1080e43074beef8aebdbb38875
2015-12-21 15:03:15 -08:00
Dan Willemsen
7b310eefb7 Make global C include paths optional
Only add them to the global C include paths if they exist. And make sure
to set up proper dependencies so that we notice when they are added or
removed.

Change-Id: Ia9df14f6ae6869927ad3d3a15fb5a8081f616a81
2015-12-18 15:55:52 -08:00
Colin Cross
6ff5138355 Delay dependency errors to ninja time for unbundled builds
Unbundled builds may use a subset of the tree, which can bring in unused
modules but not their dependencies.  Delay handling of dependency errors
for unbundled builds to ninja time, which will prevent errors if only
modules with satisified dependencies are built.

Change-Id: Ib93bae93fcfa0b55df500a30d8e35231ffb0987c
2015-12-18 13:13:15 -08:00
Colin Cross
7b66f15763 Add brillo cflags
Add __BRILLO__ to global cflags when building for a brillo product.

Bug: 26165350
Change-Id: I0100a8821b763075d1873d0d48fd5bd217afb580
2015-12-15 16:23:07 -08:00
Dan Willemsen
34cc69e4bf Use Path instead of string for file paths
This centralizes verification and common operations, like converting the
path to a source file to the path for a built object.

It also embeds the configuration knowledge into the path, so that we can
remove "${SrcDir}/path" from the ninja file. When SrcDir is '.', that
leads to paths like './path' instead of just 'path' like make is doing,
causing differences in compiled binaries.

Change-Id: Ib4e8910a6e867ce1b7b420d927c04f1142a7589e
2015-12-09 14:29:12 -08:00
Dan Willemsen
93c2831af1 Add Darwin-specific linker file flags
Darwin's ld does not support --version-script, but it does support
-unexported_symbols_list, -force_symbols_not_weak_list, and
-force_symbols_weak_list that all take files as arguments.

Instead of expecting these to be added to the ldflags manually, add
properties for them so that the dependencies are handled appropriately.

Also sanity checks the darwin vs non-darwin usages early, so that the
error message is faster and more obvious.

Change-Id: I42526cc4367b6ea9adfdbb58753e12824e8c321c
2015-12-04 15:12:42 -08:00
Dan Willemsen
218f65628e Hybrid soong/mk build using prebuilts
Change-Id: I96daa69af27bd19c8bfbe327a1318f51c738fc03
2015-12-01 15:08:01 -08:00
Colin Cross
979422c6c2 Add -pie to device executable builds
Change-Id: I8faf5a245f61fc412ba617ac762831d9fcdb8e73
2015-12-01 14:20:24 -08:00
Dan Willemsen
0effe06597 Change soong parameter name disabled -> enabled
This looks cleaner when we need to enable windows builds for modules.

Change-Id: I61553e2124e08002b0bd9e35c1406c905718f2f7
2015-11-30 16:51:14 -08:00
Dan Willemsen
490fd49557 Support cross-compiling Windows binaries on Linux
This defines another mutator between HostOrDevice and Arch that will
expand host modules into a module for each host type
(Darwin/Linux/Windows) that is currently being built.

Change-Id: I4c8ac6b616c229f6bd45ad8a35902652fb6a4fff
2015-11-30 15:28:31 -08:00
Colin Cross
c4bde76832 Add toolchain cflags that are always used
Some cflags are part of the toolchain selection and should not be
removed by no_default_compiler_flags = true, for example -m32 for x86
compiles.  Removing all the cflags results in hacks such as in crt.mk
where the bare minimum cflags are reinserted.

Add new toolchain interface functions ToolchainCflags, ToolchainLdflags
and ToolchainClangCflags that will always be used.

Change-Id: I0ba02d7611e2afb9ad913319740e00c1bb2d654c
2015-11-24 21:33:15 +00:00
Dan Willemsen
b30a8118f5 Switch to clang 3.8
Change-Id: I8997bc4d765a18c789f2926da26610178a57be74
2015-11-24 21:11:15 +00:00
Dan Willemsen
6203ac009c Actually add version-script to ldflags
Change-Id: I6c3fff2fd3b7273f4c6c1d1df92ffeb8574b5158
2015-11-24 12:58:57 -08:00
Colin Cross
c5c24ade63 Add arch features
Allow architecture toolchains to register "features" supported by the
current variant, and then apply properties from the selected features.
Equivalent to the ARCH_*_HAS_* variables in the combo makefiles.

Change-Id: Ib6823be1c1a52da677d081db9f24336a072eaf39
2015-11-23 14:55:26 -08:00
Colin Cross
eeabb89426 make arch and variant parsing more robust
Post-process the arch and cpu variants to treat the arch name or
"generic" as an empty variant.  Filter out extra empty abis.  Ignore
empty arches.  Print a useful error message when appending properties
fails to find the target field, when an unknown architecture is used, or
when a toolchain has not been implemented for the selected
architecture.

Change-Id: I671d4cd04975f4f29aefc4267b3a624868ce6a75
2015-11-23 14:18:26 -08:00
Colin Cross
a48f71fcbd Re-export exported includes from whole_static_libs
whole_static_libs is used to reexport all the symbols from a static
library when encapsulating it into another static library or shared
library, so reexport the headers as well.

Removes the need for libcxx to explicitly export the headers from
libcxxabi.

Change-Id: I283e043f2d2e819e2fdfa43b3f0f7a4537ba79ff
2015-11-16 18:06:32 -08:00