Commit graph

1021 commits

Author SHA1 Message Date
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
6e18ca49f8 Fix java resource glob file list location
The source path was being appended to the module out directory
to create the file list file, which was resulting in .. in the
source path moving the file list file up the directory tree.
Use SrcDirRelPath to convert the globbed resource directories
to be relatiave to $srcDir before appending them.

Also do the same fix to generated aidl, logtags, yacc, and lex
files.

Change-Id: I2e636bd30abf03bc1d80a897951a9812cc3e09ef
2015-08-24 16:19:43 -07:00
Dan Willemsen
f5a959c99f Fix arm cflags
-mthumb-interwork was missing from the beginning.

The Clang cflags copy was only a shallow copy, so our clang-specific
fixups were affecting the GCC cflags as well.

The cortex-a15 replacement was removed from build/core with this change:
https://android-review.googlesource.com/#/c/143851

Change-Id: Ib6300e064f6ec4f6a7174d5e2aeacad1c359f7ea
2015-07-13 13:52:30 -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
Dan Willemsen
edc385f5eb Fix libgcc/libatomic link order
This is the equivalent commit to https://android-review.googlesource.com/144749

Change-Id: I79374f33766fa307fd031ffd0cbd9e9d37848324
2015-07-08 18:10:14 -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
d81496084b Fix repeated ccCmd dependencies on object files
ccCmd was being added as a dependency each time through the object
file loop, tripling the size of the build.ninja file.  Create a
new slice for dependencies on each object file.

Change-Id: Id768d8ea6e5300c15f0f1a5fac5fcbdfdf5e6b0a
2015-05-13 00:50:25 +00: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
6bedfaaeea cc: remove incorrect arch cflags
arm and host builds both got some extra global cflags from arm64,
remove them.

Change-Id: Ie4dcbb114714f4ae8b45304755978d66e13e889c
2015-04-30 16:35:03 -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
c1e814dbf1 cc: remove --fix-cortex-a8 from non-Cortex A8 devcies
Pass --fix-cortex-a8 only on Cortex A8 and generic ARM builds, and
pass --no-fix-cortex-a8 on everything else.

Change-Id: I4b12afee4de443b5d55df66be3c6a05251715e31
2015-04-28 14:11:56 -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
c0b06f191f Add aidl file support to java builds
Add support for aidl files listed in srcs for java builds, and
an aidl_preprocess module type for framework and sdk aidls.

Change-Id: I3aa537f4483822e5b534c74d0b35f13a938f8947
2015-04-08 16:37:31 -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
Colin Cross
1332b0035c Move config into common and provide helper
Using ctx.Config().(Config) everywhere is a mouthful, and it is
inefficient to do the type assertion.  Put the Config interface into
the context, and provide an AConfig() to return the Config already
converted to the right type.

Change-Id: I301a1fd7d2a005580aabca7866a37c5d42ad8c69
2015-04-08 15:19:24 -07:00
Colin Cross
8df14ac3f0 Add rpath to host executables
Host executables need rpath set so they can find their shared
libraries.

Change-Id: I297682d3266bb436af0f594e8164ee4b9e7ab234
2015-04-08 15:17:45 -07:00
Colin Cross
581c189988 Add yacc and lex support
Add support for yacc (.y or .yy) and lex (.l or .ll) files.  Also
tweak locations of .o files for normal and generated sources to
makes sure they don't collide.

Change-Id: I03172cddbdc022525bf392a81d72050406b8cdb3
2015-04-08 15:17:45 -07:00
Colin Cross
7d21c4430d Use @files for ld and ar
ld and ar command lines often end up larger than ARG_MAX, use Ninja's
rsp file support to automatically write the object files to a temporary
file and pass it in using @file support.

This isn't going to work on Darwin host builds, where the host
toolchains don't support @.

Change-Id: Ida2f4e114ab02df6967e863577fa324e197827d5
2015-04-02 14:48:55 -07:00
Colin Cross
577f6e4baf Fix ndk and stl compiling
Move ndk linking against libc and libm out of system shared libraries
so that static libraries that link against the ndk can depend on
libc and libm, which is required to get the ndk sysroot include path.
Also make ndk stl versions only apply to the device variant of
multi-target builds.

Change-Id: I6926541da17b9baf3aa7f811a839c3b65c5d804d
2015-03-27 18:24:14 -07:00
Colin Cross
28d76590f1 Use ContainsProperty to support default values
Instead of setting a string property to magic default value and then
checking for it later, call ctx.ContainsProperty to determine if it
was set.  Use the same method on the clang bool property, which
couldn't be set to a magic value.

blueprint's ModuleContext.ContainsProperty only works on a single
property, not on all arch variant properties -
ModuleContext.ContainsProperty("clang") will return false if
clang was not set but arch.arm.clang was set - so track which
properties were extended inside extendProperties, and override
ModuleContext.ContainsProperty in AndroidModuleContext to also
check the extended properties.

Change-Id: I03cbe71dc69344972e23d6c794da9be05e720c45
2015-03-27 17:54:50 -07:00
Colin Cross
1f8f234c33 Support cc_test_host
Support cc_test_host for gtest tests compiled for the host.

Change-Id: I632d2c211075ba9391d934609f1bf368459397e1
2015-03-27 15:58:24 -07:00
Colin Cross
4ae185c7ec Support for suffix property on binaries
The suffix property will modify the name of the resulting binary
by adding its value to the module name.

Change-Id: I188e97d4c88f26c060ba2ffbd37f832d701fe0cb
2015-03-27 15:58:24 -07:00
Colin Cross
bfae8859f2 Support prefix_symbols for linker
The linker needs to add __dl_ to the beginning of all of its symbols
to avoid conflicts.  Add support for a prefix_symbols property, and
insert an objcopy --prefix_symbols build step to produce the final
binary.

Change-Id: I70de7c830cd64305e5900c6de53efecea2e17c75
2015-03-27 15:58:24 -07:00
Colin Cross
ed4cf0b655 Refactor ccDynamic for static binaries
ccLibrary uses ccDynamic for linking shared libraries, but bypasses
it by calling directly into ccBase for static libraries.  Instead of
duplicating the same mess for ccBinary, rename ccDynamic to ccLinked
and add the logic for dealing with static or shared linkage.  This
also allows moving the stl logic out of ccBase and into ccLinked.

Change-Id: Idfa6d86de16911c8851f694d6ed92681c8939281
2015-03-27 15:57:49 -07:00
Dan Albert
be96168ee3 Add support for building NDK modules.
Change-Id: I2c5ede530e40a635e26ae45950580ef450e7dcc6
2015-03-26 21:58:12 -07:00
Colin Cross
21b9a2497a Refactor cc dependencies to avoid duplication
CC module dependencies need to be handled in both AndroidDynamicDependencies
and GenerateAndroidBuildActions.  Replace handling them in both with
splitting out individual functions to list each type of dependency,
and then call them from both AndroidDynamicDependencies and collectDeps
in GenerateAndroidBuildActions.

Change-Id: If8104f6ec4846a389a41ab599b1167bcf47b45b7
2015-03-25 13:49:24 -07:00
Colin Cross
f6566ed2ba Add new AndroidModuleContext helper functions
Add Host(), Device(), and Debug() to AndroidModuleContext to allow
build rule generators to easily determine build options.

Change-Id: Ib93a462cb45189399063f641b3a8df175db0592e
2015-03-25 11:33:08 -07:00
Colin Cross
97ba073833 Export cc types for art to inherit from
Art needs a custom module type in order to perform complicated
build logic like depending on environment variables and varying
cflags based on cpu variant.  Export enough of the types and
functions from cc for art_cc_library to inherit from cc_library.

While I'm touching every line, also rename the New* methods
to *Factory.

Change-Id: I7123aa47019c4ced7a1ab57c394225bc7844b5ea
2015-03-25 11:33:06 -07:00
Colin Cross
70b4059e3f Update import paths for changes to blueprint
Blueprint has been modified to include a canonical import path,
update soong to match.

Change-Id: If29d31afbf3bf2e6364961a66456fa5f8f738455
2015-03-23 12:57:34 -07:00
Colin Cross
62ec5f4eb3 Updates for building art
Add art and libnativehelper to the root Blueprints file, and
add a warning used by art to the clang unknown flags list.

Change-Id: If282413103fa20fa66422e4330fbabff61b66144
2015-03-21 00:40:20 +00:00
Colin Cross
6b29069d42 Allow cc_test to build a test per source file
Some cc_test modules want a test per source file, for example when
there is global state that needs to be reset between each test
suite, but no way to reset it.  Allow them to specify test_per_src: true,
which will cause a separate test to be built for each source file.

Change-Id: I3dbf1202fb070437cb0109f195dc11a6440061ee
2015-03-19 14:05:33 -07:00
Colin Cross
ed9f868f49 Fix exported include dirs
Exported include dirs were only being copied to the build flags
in ccDynamic.  Move the copy to after collectDeps is run so it
picks up the extra includes from all the overriden functions.

Also check exported include dirs of shared library dependencies
of static libraries.

Change-Id: Idb94277f88bbb10869e72011113df57f586274de
2015-03-19 10:51:41 -07:00
Colin Cross
efd8e48c4d Add sdk_version property
Add sdk_version property that will be used later for NDK builds.
For now, use it to determine if libnativehelper/include/nativehelper
should be added to the global include dirs.

Change-Id: I4e0f9b3f27c380b1ac28f163b1d2b43a46d7191c
2015-03-19 10:51:41 -07:00
Colin Cross
5049f02e60 Add gensrcs module type
gensrcs allows sources to be generated by a specified command.

Change-Id: I725086fcdcd72bfe6c07fb8903e7b520678a247f
2015-03-19 10:51:41 -07:00
Colin Cross
af19a29bb7 Add debug and release cflags
Add debug: { cflags: [...] } and release: { cflags: [...] }.
For now it always takes the release cflags, later a per-module
debug selector will allow using the debug cflags.

Change-Id: I40bc68267287db901e47e74983d0d61fda2b9367
2015-03-19 10:51:40 -07:00
Tim Kilbourn
5ccc730672 Fix path to gtest headers.
Change-Id: Ieb64c4439125e95aecc4200ac6f9ea3375b347e7
2015-03-19 10:15:22 -07:00
Dan Albert
c403f7ce6d Add support for cc_test.
This behaves slightly differently than it does in the make based build.

1. The make based build manually passes -DGTEST_OS_ANDROID (or
   whatever). gtest-port.h already has logic that does this, so it's a
   no-op.
2. Host libraries are named identically, rather than libgtest_host.

Change-Id: Ic40a1025c698611d202cb7c8ec45abd8fe130065
2015-03-18 23:39:02 -07:00
Tim Kilbourn
1a9bf268ad Add an instruction_set property to Arch
Used to allow switching between thumb and arm ISAs

Change-Id: I94aa83cee7179e83c97eedc32fd216965b626d33
2015-03-18 17:19:35 -07:00
Colin Cross
c472d57f57 Refactor cc compiling to shared ccBase and ccDynamic initialization
Refactor common code out of NewCC* to initialize the ccBase,
ccDynamic, and ccLibrary structures.  Also adds an enum for the
default multilib values.

Change-Id: Iaeffe86bf2568b6054be4ddcee725818af45e14f
2015-03-17 15:11:14 -07:00
Colin Cross
3075ad07e4 Add dependencies on late static libraries
Late static libraries were added to the build command line, but not
the implicit dependencies.

Change-Id: I20ed8be6ae1ec7c1b78f16a6d1da7d1535ff5cba
2015-03-17 10:47:08 -07:00
Colin Cross
a360e8b0fa Update clang flags for latest AOSP master
Change-Id: I492b5a4b87689f4eb95466fc92241a0f88415012
2015-03-16 16:22:52 -07:00
Colin Cross
6072ad4e9b Fix soname
-Wl,soname= was missing the .so extension

Change-Id: Ide5f2b22f5c37a20463a2314047560e501b95987
2015-03-16 16:22:52 -07:00
Colin Cross
bdd7b1c818 Add more missing clang flags
Add clangExtraCflags, clangExtraConlyflags, and clangExtraTargetCflags

Change-Id: I99a12ba3af43c2fcf97a1d96a0a32efd8d4bfde5
2015-03-16 16:22:52 -07:00
Colin Cross
77b00fa6f1 Add late static libraries for libgcc
libgcc has to be last on the command line, after -lc for libc.

Change-Id: I5c867cef59ca84e23ff5cea406da3ec3f261aa76
2015-03-16 16:22:52 -07:00
Colin Cross
13af54da2d Fix arm compile flags to match makefile build
Fix a few flags that don't match the makefile build flags in
build/core/combo/TARGET_linux-arm.mk

Change-Id: Ib951da32d7828aff17a32f10ba18ed678b3571de
2015-03-16 16:22:52 -07:00
Tim Kilbourn
f294814398 Add common cpp flags
Change-Id: Iba486b121e9a1b0c1761cf6402c61a0228105a5b
2015-03-16 15:50:11 -07:00
Colin Cross
3f40fa460d Add soong_build primary builder
Initial build logic for building android with soong.  It can build
a variety of C and C++ files for arm/arm64 and host.

Change-Id: I10eb37c2c2a50be6af1bb5fd568c0962b9476bf0
2015-03-13 20:28:16 -07:00