Commit graph

77 commits

Author SHA1 Message Date
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
Colin Cross
cfad119eaf Add support for defaults modules
Add a cc_defaults module, which will prepend any matching properties to
modules that reference it with a "defaults" property.

Change-Id: I5908dd98d204f71b29ad95a4ab85403aa1621ca2
2015-11-03 15:46:08 -08:00
Colin Cross
6362e27848 Remove EarlyMutators and DynamicDependencies
EarlyMutators are identical to BottomUpMutators, except they run before
DynamicDependencies.  DynamicDependencies can be replaced with a
BottomUpMutator.  Replace both EarlyMutators and DynamicDependencies
with BottomUpMutators, which allows setting the order between all
mutators through registration order.

Change-Id: Id1305d798d3d2da592061c89d7c10a71780b71a3
2015-11-03 15:46:08 -08:00
Colin Cross
06a931bdb6 Replace extendProperties with pathtools.AppendProperties
Blueprint has a generic AppendProperties/AppendMatchingProperties now,
use it, and replace all bool properties that might be modified by a
mutator with *bool, which provides the correct replace-if-set semantics
for append.

Also remove uses of ContainsProperty except when explicitly checking if
a property was set in a blueprints file.

Change-Id: If523af61d6b4630e79504d7fc2840f36e98571cc
2015-11-03 15:46:08 -08:00
Dan Willemsen
6d11dd87c0 cc: Filter out unknown clang cflags from InstructionSetFlags
-funswitch-loops is in the arm instruction set flags, but unsupported by
clang. Make removes clang unknown cflags from the instruction set flags.
This was producing a warning, causing -Werror to fail on libm.

Change-Id: Ibc69c9af04a738aa8adeb5549900e2b53ab754f0
2015-11-03 14:30:12 -08:00
Dan Willemsen
e65404514c Updates from make
Contains equivalent changes for:

  561b4c1 Set mcpu targets based on cpu variant.
  6a66a88 Stop encoding absolute paths in symbols
  63e3b02 Enable color output from gcc and clang
  eb3e3fa Use exported includes for libc++.
  3a0a891 Link libgtest_main before libgtest

Change-Id: I45a06c02e9af1d40f0c52f1e6a20d6cd382a27fb
2015-10-20 16:44:55 -07:00
Dan Willemsen
dd0e2c338f Add DeviceUsesClang to change clang default
This is equivalent to USE_CLANG_PLATFORM_BUILD in the current build
system.

Change-Id: Ifaca0f2639871dac834ef603cfade695191cff11
2015-10-20 14:29:35 -07:00
Dan Willemsen
1e898b9e04 cc: Use local_include_dirs before include_dirs
Prefer local headers over remote headers

Change-Id: Ic50104c5f2cfdd96cd749d35c52cd13706ac6367
2015-09-23 15:31:08 -07:00
Dan Willemsen
87b17d1ff4 Use SRCDIR as a working directory
The existing behavior of using the build directory as the working
directory is useful if you want to move/copy the output directory around
and SRCDIR still refers the the source. But, it's more useful to have
the source directory be the working directory. Tools like cpp(__FILE__)
and other debug prints embed relative paths from the working directory.
We also have tools that expect the working directory to be $TOP.

Change-Id: Ia0f1d3c6b7df72d61cf5628efa2baa98bd19775b
2015-09-17 23:42:25 -07:00
Colin Cross
6002e056fd Make Test_per_src a property on all binaries
Change-Id: I36b84807cac3d8fd7ef50c8ffb8e2a85ddc10509
2015-09-17 15:21:42 -07:00
Dan Willemsen
9e0cb35c29 Allow 'sanitize' to be arch-specific.
The usecase here is system/core/liblog, which wants to turn off
sanitizer only for the target module, since the target sanitizers depend
on liblog.

Change-Id: I99141574a1c4c4847aa8a72bdcc88901fd9b01cd
2015-09-16 15:41:55 -07:00
Dan Willemsen
d67be22400 Port LOCAL_NO_LIBGCC from make
Change-Id: Iba400de882547654b2a5184d420e38113d7545ee
2015-09-16 15:20:36 -07:00
Colin Cross
b43a159c13 Replace asan with sanitize
LOCAL_ADDRESS_SANITIZER has been replaced with LOCAL_SANITIZE.

Change-Id: I81fe7e0c9135cfd4a222fae4012ab5082cc58f29
2015-09-16 14:19:55 -07:00
Dan Willemsen
f8e98b0804 Add libbenchmark's new dependency on libbase.
See https://android-review.googlesource.com/150583

Change-Id: I6f9700b3e51a3b681d3d91b88103eed31764f61e
2015-09-15 22:21:47 +00:00
Dan Willemsen
fa3924e480 Disallow using stlport.
See https://android-review.googlesource.com/149486

Change-Id: I577a16c8c52e2c7d939c3b5026e18ad90e4b9f26
2015-09-15 22:21:16 +00:00
Dan Willemsen
3bf6b47229 Update flags to match make
Change-Id: I8ba24723d5b507fa178255c124b11356719700cb
2015-09-15 22:20:03 +00:00
Colin Cross
39d97f2a56 Add support for include_files
Support include_files and local_include_files to pass -include arguments
to gcc.

Change-Id: Ie3f03218fcbc9732741da91671b20e240f3de3a6
2015-09-14 16:09:36 -07:00
Colin Cross
463a90e587 use init functions to register module types, etc.
Instead of putting all the blueprint registrations in soong_build,
put them all in init() functions.  This puts the registration next
to the implementation.

Change-Id: Ide1a749518f5e9d1367a18ab3bb1d91da3310c76
2015-07-09 17:57:18 -07:00
Colin Cross
aee540a439 Add version_script property
Add version_script property to cc_library to pass a file to
the linker with --version-script.

Change-Id: Ieefb04e15c8dfa72c2eb63b4349f8860222662b2
2015-07-07 10:34:19 -07:00
Dan Willemsen
2ef08f4458 Add exclude_* and remove arch_subtract / "-file"
To align with the current make build system, add exclude_srcs and
exclude_java_resource_dirs. These replace the functionality of
arch_subtract and glob exclusions that use "-file" to exclude a file.

Change-Id: I91c23d5e3c9409f2d9f7921f950153a03a68ad61
2015-07-01 20:59:39 +00:00
Colin Cross
7d5136f033 Improve property comments for docs
Improve the comments associated with properties to work better with
Blueprint's auto-documenting feature.

Make all properties structs into named types so that thet types can be
found using reflection and cross-referenced to the source code to
auto-extract docs.

Remove the leading <property>: text from properties, the documentation
will include the lowercased name of the property.

Add filter tags to the nested arch properties.

Change-Id: I4ef5db86358886fe61456c24eb2dbe6f7b876115
2015-06-29 10:36:02 -07:00
Colin Cross
8f101b45fc Allow common.Glob to be called by singletons
Make common.Glob take an interface that is the intersection of
blueprint.ModuleContext and blueprint.SingletonContext used by
Glob and GlobRule, allowing it to be called on either.  Also
move ExpandSources and Glob into AndroidModuleContext.

Change-Id: I8d1a3160c5dd201033afdb37210e82d8065b137d
2015-06-17 15:36:48 -07:00
Colin Cross
f22982707d Check that local, top level, and exported include paths exist
Require directories listed in the include_dirs, local_include_dirs, and
exported_include_dirs properties to exist.

Change-Id: I5b079bd2c607839bb28dae43801cd7345bde2299
2015-05-12 11:36:53 -07:00
Colin Cross
d3ba039f74 Separate HostOrDevice out of Arch
Take HostOrDevice out of Arch, and put it into AndroidModuleBase
instead.  Also separate out the host vs. device mutator from
ArchMutator.  This will make it possible for genrules to depend
on a host tool, regardless of which host arches it is compiled
for.

Change-Id: I22bbfd28b65c3eebdfa101a712f90dd615148dc8
2015-05-09 00:10:19 +00:00
Colin Cross
2ba19d90c3 Add cc_benchmark module type
Change-Id: I83bed375fa77518baaab4260e714a9368761f0bc
2015-05-07 16:09:34 -07:00
Colin Cross
0af4b8468b Add support for building on Darwin hosts
Add toolchain and build rules for building on Darwin.

Change-Id: I78e21f4051b2941182121b28c9ddfa24396ada41
2015-05-07 14:09:48 -07:00
Colin Cross
74d1ec0c2c Build rule updates for aosp
Various build rule changes to match AOSP:
Add libunwind_llvm and libdl as dependencies for libc++ on device
Always add libcompiler_rt-extras as a dependency
Add libm, libc, and libdl as depnendencies for libc++ static binaries
Disable some clang warnings, and add some clang filtered cflags
Add -fstack-protector to host linux builds
Add jack_flags property to java modules (currently ignored)

Change-Id: Ic0da617bdeaf25f58cb8298dd9ea91b7d6509151
2015-05-04 17:02:18 -07:00
Colin Cross
d8e780df69 cc: make static or shared cflags apply to all source files
Make static or shared cflags properties apply to all source files,
not just the source files defined in the static or shared block.
Needed for libunwind, which passes -DUNW_ADDITIONAL_PREFIX to source
files for the static library, but not for the shared library.

Change-Id: I3cd88cc1099e505eeee077c697db00de22a8b03a
2015-04-29 14:59:23 -07:00
Colin Cross
d350ecd102 Add support for genrule
Add genrule, which uses a host executable (possibly built by the
build system) to generate a single source file.  This differs slightly
from gensrcs, which takes a list of sources and translates them through
a host executable to individual source files.

Change-Id: I94bda62c4c53fb3f3817def190e6a7561508d297
2015-04-29 14:58:16 -07:00
Dan Albert
c3144b1553 ndk: Use prebuilt NDK CRT objects.
Change-Id: Ie8d58fa7c4ef2a62338c20c3078603ac98be0f9c
2015-04-29 10:27:00 -07:00
Colin Cross
a8a93d3769 cc: fix native tests
Add libgtest to native test dependencies before adding stl
dependencies to resolve link errors between libgtest and
libc++_static.

Install device native tests to /dava/nativetest32 and
/data/nativetest64.

Change-Id: I6d9ddba8d5cdbacaa86cae0833fd7e656657e4d9
2015-04-28 15:34:08 -07:00
Colin Cross
2732e9a43f cc: improve combined static/shared libraries
Allow combined static/shared libraries to specify separate dependencies,
and recompile objects if static or shared cflags are set.

Change-Id: I9fd71d8debd5ade5637389ee38e793082d6d18bb
2015-04-28 15:34:01 -07:00
Colin Cross
18b6dc5d25 cc: fix host gcc libraries
Host gcc libraries should only apply to static binaries, not all
static libraries.  Add c.staticBinary(), and rework everything
else to use c.static(), removing c.shared().

Change-Id: I8addae9b6848010cef94d873f48e7e358e4f5059
2015-04-28 14:12:00 -07:00
Colin Cross
e11befc4e4 cc: finish unexporting DepNames and Flags
gorename missed DepNames and Flags on CCBase and CCLinked

Change-Id: I926227eef51fdbe10f22b743bf3e2265cdc6a9ad
2015-04-28 14:11:53 -07:00
Colin Cross
712fc026df Fix gcc libraries for host targets with platform libc++
Targeting the platform-provided libc++ on the host requires passing
-nodefautlibs to gcc, and then re-adding all the default libs except
libc++.

Change-Id: I5a42375bcc819b07f6ee02e9d76e7f5088fa00e0
2015-04-27 11:18:21 -07:00
Colin Cross
9ffb4f5295 cc: export CCTest
export CCTest so it can be overriden by artCCTest

Change-Id: I027c7fb392ff7fa55e5ecb635fbf31a7662d8e22
2015-04-27 11:18:21 -07:00
Colin Cross
0676e2d1d6 cc: unexport Flags and DepNames
Flags and DepNames are no longer needed outside of cc, they are
replaced by ModifyProperties.

Change-Id: I84ff0dc180cb3459d6181a83fc67c6158987c1ae
2015-04-27 11:18:21 -07:00
Colin Cross
fa1387916f cc: export structs and add ModifyProperties
Instead of the complicated Flags and DepNames system used now
for overriding CC modules, export all the main structs and the
properties structs so that module types that override them can
modify properties before build rule generation starts.

Change-Id: I6d71550def1ef07798b27d5fec40739ef3ac8165
2015-04-27 11:18:21 -07:00
Colin Cross
28344528cf Simplify flags in c compiling, fix NDK build warnings
Reduce the number of flags variables when compiling C by getting
rid of the separately-tracked IncludeDirs variables, and putting
them directly in GlobalFlags.  Also changes exportedIncludeDirs
to exportedFlags, which will allow exporting flags besides -I.

Also fixes a bug when building a module with the NDK and -Werror
by passing NDK exported include directories with -isystem instead
of -I, which will ignore warnings from those includes.

Also fixes a bug where the default includes were being inserted
into all cflags by the arm and arm64 toolchain modules.

Change-Id: Ice97f84e637b21d20c38c85b881afa315f9f92ae
2015-04-22 14:08:45 -07:00
Colin Cross
56b4d45341 Remove global include paths for modules built against NDK
Modules built against the NDK shouldn't get the global or arch-specific
include paths, all headers will be provided by depenendencies or the
NDK.

Change-Id: I13b9530a365e11e9cf6bd2b99b756b36944e0a9e
2015-04-21 17:38:44 -07:00
Colin Cross
41c187b3d4 Support relative_install_path for cc modules
Support specifying an install path relative to the default install
path for cc libraries and binaries.

Change-Id: I47a97de9beaedde27d99c498c3f26c9d36358d94
2015-04-21 17:37:37 -07:00
Colin Cross
fce532760f Support subtracting sources from globs
Support -file or -path/glob in file lists that contain globs to
subtract files from the resulting glob.  Also move source file
prefixing and handling into a common function.

Change-Id: Ib6d74ce22f53cae7348c4ba35b779976d90359a6
2015-04-08 15:19:30 -07:00