Commit graph

1538 commits

Author SHA1 Message Date
Colin Cross
522e373a22 Allow CustomizeProperties to override linker
Allow CustomizeProperties to override the dynamic linker by setting a
DynamicLinker property.  Needed by art, which overrides the linker for
device-on-host testing.

Change-Id: Ia4cb5a85b9a995d8138da33eb13543addf3b38cc
2016-09-07 13:14:06 -07:00
Treehugger Robot
ca06cc331d Merge "[mips] Disable compact branch generation" 2016-09-06 22:30:59 +00:00
Nikola Veljkovic
3d6a38d601 [mips] Disable compact branch generation
Bug: http://b/31317834

Clang generates invalid beqc compact branch instruction. Disable
compact branch generation until clang is updated to include r278824,
which fixes the issue.

Error:
/tmp/backtrace_test-6a4a4f.s:6603: Error: invalid operands
`beqc $zero,$1,$BB31_ 6' clang++.real: error: assembler command
failed with exit code 1 (use -v to see in vocation)

Test for mips and mips64: cd system/core/libbacktrace && mma
Change-Id: I0b0f189e126621dbadb317ba711993e45004348d
2016-09-06 21:38:24 +00:00
Colin Cross
20780c80a0 Remove HostPrefer32BitExecutables
HOST_PREFER_32_BIT was used during the switch to 64-bit host tools to
keep the SDK building as 32-bit, but is never set any more.

Change-Id: I7c2db269d3f7fa1f4e0c022cbced789755a62d81
2016-09-02 14:06:30 -07:00
Treehugger Robot
72301d978a Merge "Add InstallerProperties to cc_defaults" 2016-09-01 21:45:56 +00:00
Josh Gao
1c0ee4ab6e Merge "Allow darwin targets to use -framework CoreFoundation." 2016-09-01 21:19:07 +00:00
Dan Willemsen
7424d61c95 Add InstallerProperties to cc_defaults
Test: Add relative_install_path to a cc_defaults
Change-Id: Id10f78afb3b82117b944b9b53fe7020fb672925b
2016-09-01 13:45:39 -07:00
Josh Gao
92da2b5e99 Allow darwin targets to use -framework CoreFoundation.
Bug: http://b/31245118
Change-Id: I5aa6162715b643af4a3073e6e403a6e1729f7c15
2016-09-01 11:53:42 -07:00
Dan Willemsen
28bda51400 Support shared cc_test_library
So that shared libraries can be installed under /data/nativetest[64] (or
the host equivalent)

Change-Id: I41b2860365985f36828bd4bf9b6dc651b210822c
2016-08-31 16:32:55 -07:00
Colin Cross
9d45bb78c5 Enable goma in soong
When the UseGoma flag is set, put all rules except the C compilation
rule in an externally defined local_pool, which will have been created
by kati.  The gomacc wrapper will already be in the CC_WRAPPER
environment variable.

Bug: 31142427
Change-Id: I699d4edff2e302eee398dad8692ceb14721a628c
2016-08-31 09:48:08 -07:00
Colin Cross
ecc53306b8 Merge "Add CC_WRAPPER support" 2016-08-30 19:34:01 +00:00
Treehugger Robot
8be0e0ffde Merge "Expose module suffixes to Make" 2016-08-30 02:10:52 +00:00
Dan Willemsen
1d577e25a7 Expose module suffixes to Make
These had only been exposed for shared libraries.

Also fixes testDecorator to not have two baseInstallers both being
written out to the Android.mk.

Bug: 31158868
Test: manual diff of out/soong/Android-aosp_flounder.mk
Test: Verify installed windows binaries end in .exe
Change-Id: I2bded5fb090117d48ade575b4438e0dedd2e3763
2016-08-29 16:02:05 -07:00
Treehugger Robot
27807b5415 Merge "Fix installation path for asan libraries" 2016-08-29 22:29:16 +00:00
Colin Cross
9461040154 Fix installation path for asan libraries
Check c.sanitize.inData() when deciding on install paths.
Don't set inData() for sanitized binaries.

Bug: 30773053
Change-Id: I24be75ccc1b25ae53f7f0a98d1632b30735d0931
2016-08-29 13:50:24 -07:00
Alistair Strachan
777475cb48 Add CC_WRAPPER support
Change-Id: If252c41ec1e3d708f599990c72be69dc8117ae14
2016-08-29 20:39:32 +00:00
Pirama Arumuga Nainar
15690c02d6 Switch to prebuilt clang-3217047
Bug: http://b/30421084
Change-Id: I8b65669ef9f60f85202295de117d3806d3a5b1f6
Test: Tested build, boot and common usage for several devices in AOSP
and internal branch.
2016-08-26 21:54:54 +00:00
Treehugger Robot
f5a50a8b17 Merge "Fix mac art build" 2016-08-26 01:22:07 +00:00
Colin Cross
7d82ab76dd Fix mac art build
-Wl,-read_only_relocs,suppress is required for libart to build to
avoid the error:
ld: illegal text-relocation to '__ZN3art7Runtime9instance_E' in out/soong/.intermediates/art/runtime/libart/darwin_x86_static/obj/art/runtime/runtime.o from '_art_quick_throw_null_pointer_exception' in out/soong/.intermediates/art/runtime/libart/darwin_x86_static/obj/art/runtime/arch/x86/quick_entrypoints_x86.o for architecture i386

Change-Id: Id9a0fda1dbf12a254f92419a21e5f290895ea62c
2016-08-25 16:54:53 -07:00
Colin Cross
1e7d3706d6 Add support for preferred arch symlinks
Add a symlink_preferred_arch property to binaries to allow compiling the
binary for multiple architectures and then creating a symlink to the
preferred archicture, for example dalvikvm32 and dalvikvm64, with
dalvikvm symlinked to dalvikvm64.

Test: mmma -j art/dalvikvm
Change-Id: Ied15f2be9d52c01006fe8ac207c175b78558eab1
2016-08-25 22:42:02 +00:00
Colin Cross
e1d764e369 Export DefaultsFactory
Add an exported DefaultsFactory so that external module types can extend
cc_defaults.  DefaultsFactory takes a variadic list of additional
property structures.  defaultsFactory remains as the module factory for
cc_defaults.

Change-Id: I03b450ab3a31625e7baca165d393a0007fb3e421
2016-08-22 17:08:06 -07:00
Colin Cross
389d2bb145 Merge "Support required property" 2016-08-17 17:06:22 +00:00
Evgenii Stepanov
af36db1178 Add ubsan_standalone library name to the toolchain.
and export the library name to make. Refactor the code a bit to avoid repeating the library name
multiple times.

Bug: 22033465
Test: Ran external/clang/build.py for aosp-llvm

Change-Id: I25eb3858eb92e1dd493b09524d559802551b2547
2016-08-15 17:05:04 -07:00
Chris Wolfe
998306e525 Support required property
This adds LOCAL_REQUIRED_MODULES to the generated Android.mk for any
dependencies in the "required" list of a module.

Change-Id: Ibcfe89dce7d247eb441af94e37388a59e71a75a9
2016-08-15 17:10:47 -04:00
Colin Cross
9883461664 Merge "Fix coverage sanitizer builds" 2016-08-15 18:12:23 +00:00
Colin Cross
33586f3b10 Fix cc_benchmark installs
cc_benchmark was not propagating the call to baseInstaller.install,
which resulted in no install location being set and the benchmarks
installed in out/.

Change-Id: I4399cd479d9cd7ec1b7332dd0d20a9ab3820b04e
2016-08-11 22:26:17 -07:00
Colin Cross
91169fe8ea Fix coverage sanitizer builds
Disable coverage for static binaries where address sanitizer is
disabled, and disable coverage in the mutator when disabling address
sanitizer.

Bug: 29188876
Change-Id: Ia1a21878c3f34cd295a6dec49608c412eb09e7b1
2016-08-11 16:54:01 -07:00
Treehugger Robot
aa99f84e57 Merge "Make BottomUpMutators parallel" 2016-08-11 21:35:24 +00:00
Colin Cross
e8a67a7c58 Make BottomUpMutators parallel
Append .Parallel() to all of the RegisterBottomUpMutator calls to tell
Blueprint it can run them in parallel.

Test: identical build.ninja, passes race detector
Change-Id: I969a0689522d4cba7c8ff51e2aa00fe2fd338a89
2016-08-11 13:20:16 -07:00
Dan Albert
d015c4ac1b Add support for NDK r13.
Test: make checkbuild
Bug: None
Change-Id: I6e7c92d6731be4ae47c7dc5e9444af08d338334b
2016-08-10 23:14:13 -07:00
Dan Albert
cdd4c24ff7 More fixes for decorator refactor.
Didn't catch these the first time because I hadn't done a clean build.

Test: rm -rf out && make ndk
Change-Id: Ia66ad614d2163272889ee6937a6449c44db16ac0
2016-08-08 14:45:24 -07:00
Dan Albert
705c84b9ee Fix ndk_library following decorator refactor.
https://android-review.googlesource.com/#/c/253603/ accidentally
dropped the ndk_library properties and was using the base cc
properties instead.

Change-Id: Ia2dcd767f98871dbdbbd9d0ff6d2a73b9b4889ac
2016-08-08 12:44:23 -07:00
Dan Albert
7fa7b2efd3 Don't generate intermediate NDK libraries.
It's better to clip to the existing versions here rather than build
the lower levels as if they existed.

cc.Module's begin() will now normalize the sdk_version to a valid
value for the given architecture so that doesn't have to be checked
later.

Test: make checkbuild with all other libc ndk_library changes
Change-Id: I2fa834f7a1ac3b03a0723291778d86207fcfda72
2016-08-05 16:48:36 -07:00
Colin Cross
b916a38233 Refactor cc modules to use decorators instead of inheritance
For example , instead of trying to have libraryLinker inherit from
baseLinker and libraryCompiler inherit from baseCompiler, create a
single decorator object that wraps both baseLinker and baseCompiler.

Test: Builds, no unexpected changes to build.ninja
Change-Id: I2468adaea8466c203a240259ba5694b8b1df7a52
2016-08-05 10:25:09 -07:00
Colin Cross
01344df46e Remove unused flags.Nocrt
Nocrt is handled through deps.CrtBegin/End, flags.Nocrt is unused

Change-Id: I8ab5313bb2eb3a00e336504d6dd3813350fbe14d
Test: soong builds
2016-08-05 10:22:29 -07:00
Dan Albert
7e9d295807 Auto-fill ndkMigratedLibs.
Change-Id: Ifb91f62eccb17dedb71c1a9a0f5c1471edbcbd44
2016-08-04 16:10:54 -07:00
Treehugger Robot
5c395b39b4 Merge "Check NDK API level link compatibility." 2016-08-04 23:07:16 +00:00
Dan Albert
9e10cd4746 Check NDK API level link compatibility.
Mixing NDK API levels is only supported when linking against something
equal or older.

Change-Id: I2c3022a3d75465b736f2e65160da3113cfd6e635
2016-08-03 14:31:25 -07:00
Dan Albert
2bc91ba549 Use the version script for ndk_library.
We were generating this, but not actually using it yet.

Test: `make ndk` with libc/libm migration patches, readelf generated
      libs.
Change-Id: I9aadf58307bc645b33cab5207409552c5046937a
2016-08-02 13:45:40 -07:00
Treehugger Robot
f77e8d7ffc Merge changes I0f73b41a,I0cd2f80c
* changes:
  Add a real parser for the version scripts.
  Add tag for "versioned=API".
2016-08-02 01:26:41 +00:00
Treehugger Robot
cab3d65445 Merge "Rename compiler, linker and installer methods to be unique" 2016-08-02 00:28:36 +00:00
Treehugger Robot
35ef8bdf32 Merge "Fix mac soong build" 2016-08-02 00:02:06 +00:00
Dan Albert
8bdccb9429 Add a real parser for the version scripts.
Bionic's version scripts are unfortunately complicated enough that the
naive processing I was doing before is not going to be sufficient.
Add a real parser/generator with a bunch of tests to fix this.

Test: cc/test_gen_stub_libs.py && make ndk
Change-Id: I0f73b41ade1e6cf4e31bf70ba43a743429ce770b
2016-08-01 16:12:40 -07:00
Dan Albert
c42458e2ff Add tag for "versioned=API".
This adds the `versioned=API` tag. This should be a very uncommonly
needed tag, and is really only needed to fix versioning mistakes that
are already out in the wild.

For example, some of libc's __aeabi_* functions were originally placed
in the private version, but that was incorrect. They are now in
LIBC_N, but when building against any version prior to N we need the
symbol to be unversioned (otherwise it won't resolve on M where it is
private).

Test: make ndk
Change-Id: I0cd2f80cf4b32356356914cf7ff4119e67f15032
2016-08-01 16:12:32 -07:00
Treehugger Robot
3a5af487f2 Merge changes I21f54c67,I41f6e493,I6f2ae636
* changes:
  Allow more symbol file tags at top level.
  Add a new tag to NDK symbol files: future.
  Don't warn for TODOish comments.
2016-08-01 23:06:55 +00:00
Dan Albert
08532b6779 Allow more symbol file tags at top level.
A version block might need to be omitted for reasons beyond just
"future". Support all the same tags we do at symbol scope.

Test: `make ndk` with libc/libm migration patches.
Change-Id: I21f54c67079dae10fee1e5e08bcd01f8810e7a67
2016-08-01 16:04:37 -07:00
Colin Cross
a24166b5c7 Fix mac soong build
Change-Id: I50b3ca1af571d00a0cc5efc80c5d1c6f0b1f789b
2016-08-01 15:42:38 -07:00
Dan Albert
a85042a040 Add a new tag to NDK symbol files: future.
Symbols that have been added to a library but should not be exposed
in any of the current NDK API levels should be tagged with "future".
These will be suppressed from the NDK libraries.

Once all this is in better shape we'll have `sdk: "current"`. Symbols
tagged with "future" will be available for that.

Note that this tag can be applied directly to a version. Aside from
being more ergonomic than tagging an entire section, this also solved
the problem of gen_stub_libs.py emitting an empty global section
(which is not valid syntax) in the case where every symbol is
"future". Tag the version instead and it will be omitted.

Test: `make ndk` with libc/libm migration patches.
Change-Id: I41f6e4939c406f695ab5725f360ec6554ad8ab31
2016-08-01 14:36:22 -07:00
Dan Albert
db26530b73 Don't warn for TODOish comments.
These just make it harder to detect when the file is clean of
interesting errors.

Change-Id: I6f2ae6368cdbd2800ce3f0461a3d456f79e6e994
2016-08-01 14:36:22 -07:00
Colin Cross
42742b8bb0 Rename compiler, linker and installer methods to be unique
compiler, linker, and installer interfaces may be implemented by a
single decorator object, rename their methods to be unique to avoid the
same method being called multiple times.

Test: out/soong/build.ninja unchanged
Change-Id: I1608c41cd68f614ba99c11bb9fcc7936f618d9aa
2016-08-01 13:47:15 -07:00
Colin Cross
b98c8b0595 Move toolchain and global variables into separate package
Move all of the configuration into a cc/config package

Change-Id: If56fc7242062ed1ce3cb297f78a1e0ef7537373c
2016-08-01 13:37:01 -07:00
Colin Cross
4d9c2d17c3 Separate cc.go
Split cc.go into files per module type, plus files for the compiler,
linker, and installer stages.

Change-Id: Id44c03f42fcd180950ccd008d4de0c144ea3597b
2016-07-29 15:17:58 -07:00
Dan Albert
914449fca8 Generate NDK sysroots from the platform build.
The list of migrated libraries is currently empty. Libraries will be
migrated as follow up patches.

Test: Migrated libc to this system and everything still builds.
      build.ninja shows libraries being built and used and headers are
      collected for the sysroot.
Bug: http://b/27533932
Change-Id: Iaba00543c1390f432befe0eed768ed3fbb8a9b96
2016-07-28 00:42:05 -07:00
Treehugger Robot
fb8f9a800e Merge "Finish cc.Customizer" 2016-07-28 05:50:34 +00:00
Colin Cross
76fada06c6 Finish cc.Customizer
The Customizer interface now provides a Flags method that takes a
CustomizerFlagsContext and can call AppendCflags to insert extra cflags
on a module.

Change-Id: I821242e7574e8ff653580325d1bef2998a50e29c
2016-07-27 17:15:49 -07:00
Colin Cross
c951ef1164 Merge "Fix static+shared with generated sources" 2016-07-28 00:12:37 +00:00
Dan Albert
84f431fc34 Resolve GccTriple/ClangTriple early.
When these are Ninja variable they can't be used in android.Path since
they'll be rejected as invalid paths. We don't actually need them to be
a Ninja variable, so make them plain old strings instead.

Test: Still builds.
Change-Id: I04743cebd4b2f9be5685545f2ee941df180fce14
2016-07-27 11:12:07 -07:00
Dan Albert
ce2b839257 Don't add -L for libs that don't need it.
We're already referring to the library by the full path. The -L is
unnecessary.

Follow up to https://android-review.googlesource.com/#/c/249544/

Test: Still builds.
Change-Id: Id27dff29f75797c4c0dcc66704ac08cc0b58cfe3
2016-07-27 11:12:07 -07:00
Christopher Ferris
e1ddc12b5d Merge "Remove the common bionic libc kernel directory." 2016-07-27 17:56:55 +00:00
Colin Cross
5dab840e24 Fix static+shared with generated sources
Clear out the generated sources when reusing object files from the
static library for the shared library to avoid linking them twice.

Change-Id: Idc145f817acc93df4c3b266ac7647299399bc8eb
2016-07-27 10:30:21 -07:00
Dan Willemsen
627d83db71 Limit unique_host_soname to just host modules
Change-Id: I41d050806a27473abb3788de43b7bf67f5d049a8
2016-07-22 13:41:24 -07:00
Dan Willemsen
bdf3657991 Merge "Support unique_host_soname to add -host for shared libs" 2016-07-22 19:20:35 +00:00
Christopher Ferris
68fed44d38 Remove the common bionic libc kernel directory.
The kernel include directory bionic/libc/kernel/common has been deleted,
so remove it from the include path.

Bug: 30072483
Change-Id: I71297f7ac1a9a28267b2aab270644abab2a085ae
2016-07-22 11:01:41 -07:00
Dan Willemsen
648c8aed4c Support unique_host_soname to add -host for shared libs
In order to distinguish our host libraries from system installed
libraries, support a flag to automatically append -host to host shared
libraries names. Previously, we were implementing this with different modules,
but with Soong, we'd really like to share the module definitions.

This properly exports the module to make, so that
LOCAL_SHARED_LIBRARIES := libcrypto still works, but the final installed
name is libcrypto-host.so.

Change-Id: I63389469fe1b38078b8bbf4c0fd92e54ef90ae1a
2016-07-21 16:42:14 -07:00
Colin Cross
c3e11e5f45 Clang supports armv5te now
Remove the -march=armv5te -> -march=armv5t translation for clang.

Change-Id: Icc9b7c5e9c6194d31387ca63b9f7179a2843d527
2016-07-21 12:35:28 -07:00
Treehugger Robot
72bd7dba4a Merge "Refactor bionic includes into a single place" 2016-07-21 19:27:40 +00:00
Treehugger Robot
c2062f9c44 Merge "Use the full path to the shared lib." 2016-07-21 18:45:19 +00:00
Colin Cross
f59b69ccaa Refactor bionic includes into a single place
Bionic includes are the same on all architectures, modulo
architecture-specific includes.  Use a single function to populate the
list, passing in bionic's and the kernel's names for the architecture.

Also get rid of the ${LibcRoot} variable, it is not providing any value
and makes grepping harder.

Change-Id: I39e7907d312f52dd1378a3937ab1bcba12c4e97f
2016-07-21 11:17:01 -07:00
Colin Cross
1a0c76fd1e Merge "Rename exported make variables for system headers" 2016-07-21 17:51:13 +00:00
Dan Albert
9840e1bf1a Use the full path to the shared lib.
Using only -lc (for example) means that in the case where we have one
library path with libc.a but no libc.so (such as prebuilts/ndk) and
another with libc.so (such as the out directory), we'll always use the
static version.

We can link shared libraries by their full path to be sure that we
always get the right library.

Change-Id: Idf5707fc4aaf9e651d7d8936611200760eab3c7c
2016-07-21 10:01:55 -07:00
Dan Willemsen
2b1f0943f5 Add more allowed ldlibs for darwin and windows
Change-Id: If6217de9e369e29a2e716c5cbad4444e7312f197
2016-07-20 13:19:55 -07:00
Colin Cross
10c78c6b97 Rename exported make variables for system headers
Add SYSTEM_ to variables that contain headers that are used with
-isystem, and split -I and -isystem variables into separate make
variables.  Also export SRC_HEADERS and SRC_SYSTEM_HEADERS to compare
against make.

Change-Id: I02097c35d1d5342ebce8311d8878fff33b118adb
2016-07-20 13:15:51 -07:00
Christopher Ferris
f9a6ff2713 Merge "Add android/uapi kernel header." 2016-07-20 18:03:48 +00:00
Stephen Hines
8195ed10a4 Merge "Switch to prebuilt clang-3016494" 2016-07-19 22:02:32 +00:00
Pirama Arumuga Nainar
b6572b15c4 Disable warnings triggered in Clang r271374
Test: Tested build, boot and common usage for Arm, Arm64, x86, x86_64,
Mips images in AOSP and internal branch.

http://b/28149048
http://b/29823425

Disable -Wexpansion-to-defined and -Wnull-dereference.  The second bug
above tracks that these warnings get re-enabled.

Change-Id: Ic23f6b51d3f6913fce2b423a15847e8698bab830
2016-07-19 20:32:11 +00:00
Pirama Arumuga Nainar
a17442b2f2 Switch to prebuilt clang-3016494
Bug: http://b/29823425

Test: Tested build, boot and common usage for Arm, Arm64, x86, x86_64,
Mips images in AOSP and internal branch.

Change-Id: I27e03a611d60a2122f6970d6a33f7abdf433546a
2016-07-19 20:32:01 +00:00
Treehugger Robot
93bf7d8506 Merge changes I2731ef15,Ib4b03035
* changes:
  Add a timestamp touch rule.
  Remove the implicit "_" in subnames.
2016-07-19 18:41:43 +00:00
Dan Albert
6a0476930a Remove the implicit "_" in subnames.
The NDK stub libraries need to use subname, but should use "." instead
of "_".

Test: Still builds.
Change-Id: Ib4b0303531e03968c55671ea167ab987adebd783
2016-07-18 23:31:18 -07:00
Christopher Ferris
b68ea7a66c Add android/uapi kernel header.
Add the new android/uapi kernel header include directory.

Bug: 30072483
Change-Id: I3e1394b9abd744c7f76b0ac73bb07f614745a248
2016-07-18 18:36:31 -07:00
Treehugger Robot
036ce31bfa Merge "Disable asan for static binaries" 2016-07-19 00:19:06 +00:00
Colin Cross
3c344ef29e Disable asan for static binaries
build/core/executable.mk has an extra check to disable asan for static
binaries, do the same in soong.

Bug: 30191800
Change-Id: Ia78063264f3280eb889ba9e45c45dd66e4c64a96
2016-07-18 16:14:12 -07:00
Stephen Hines
1034786c37 Revert "Revert "Switch libcompiler_rt-extras to LateStaticLibs.""
This reverts commit 15e4554049.

Change-Id: Iff62dd9fd45746847440f50240c25d32747367df
2016-07-18 16:06:05 -07:00
Stephen Hines
15e4554049 Revert "Switch libcompiler_rt-extras to LateStaticLibs."
This reverts commit bb7473dd1a.

Change-Id: I6099fd8dadc0213a78cab3e2daef5c5ebd4c31ee
2016-07-18 22:08:39 +00:00
Stephen Hines
bb7473dd1a Switch libcompiler_rt-extras to LateStaticLibs.
Bug: http://b/28149048
Test: Rebuild world (and check on new clang dependencies).

The latest clang inserts even more dependencies for
libcompiler_rt-extras (in the form of __unorddf2/__unordtf2), so we need
to ensure that it gets linked after libm.a for binaries that statically
pull it in.

Change-Id: I22a1deb63a7ed05f77af6f91f0f7a21dcf156608
2016-07-18 13:33:25 -07:00
Colin Cross
3d92b27717 Add libc and libm to modules that use libc++_static
Matches makefile change Ib21364e6f43689cf59da31d6f561919731ef8272

Change-Id: I6b4f3fcc65e5cac190bf9da315bd9d81e4c7cd3d
2016-07-15 14:46:21 -07:00
Treehugger Robot
b4b613931f Merge "Add symlink installation support" 2016-07-15 21:34:33 +00:00
Treehugger Robot
2c4841800e Merge "Support global and local sanitizers" 2016-07-15 21:12:46 +00:00
Colin Cross
3854a60c55 Add symlink installation support
Allow modules to specify a list of names to create alias symlinks, and
pass the list to make so it can create them.  Also pass
LOCAL_FORCE_STATIC_EXECUTABLE for static binaries so that make can avoid
a linker_asan -> linker -> linker_asan dependency loop.

Change-Id: I314d088095ac5f43641ed2cf8247c14c27e23b93
2016-07-15 13:37:03 -07:00
Colin Cross
263abbd5e9 Support global and local sanitizers
Mixing undefined and address sanitizers requires updating cflags.
Matches makefile change Ifee350da4877008fb061bc7f6c700e7fade405bc

Bug: 30163657
Change-Id: Iea4364b912b496400581a475bc79bd9b9c4dd76d
2016-07-15 13:12:58 -07:00
Colin Cross
a89d2e1805 Move no_crt property to apply to libraries and binaries
Change-Id: I8a770ad422dac0fd67b43ca464e0942f504e1c30
2016-07-14 16:01:30 -07:00
Colin Cross
15a0d46283 Fix duplicate library dependencies
Change-Id: I029725373fde30f58067e704c010cd0f638301ae
2016-07-14 16:01:30 -07:00
Colin Cross
aa3bf3768a Fix rpath for host benchmarks
Host benchmarks are installed in
out/host/*/nativetest/<module>/<benchmark> now, so the rpath needs to
include ../../lib.  Make benchmarkLinker extend testBinaryLinker in
order to pick up the correct rpath.

Change-Id: I3c34aee8d3c21a08b75258c1d5caf6c9fb6feab3
2016-07-14 10:28:40 -07:00
Dan Willemsen
72ad175126 Allow libdl on Darwin
Fixes the build, since this is available.

Change-Id: Ia4f50af234ee0f4ae5c7beb54724f590f2835db5
2016-07-13 22:17:39 -07:00
Treehugger Robot
feba062cd5 Merge "Put shared library ldflags first" 2016-07-14 04:26:29 +00:00
Colin Cross
f87b261ceb Put shared library ldflags first
Some obscure modules (like libtest_with_dependency_loop_b_tmp in
bionic/tests/libs/Android.bp) need to override shared library flags like
-Wl,-soname.  Put the defaults first so that the module specific ones
can override them.

Change-Id: Icde9ca2cf76c4f3e3218b6b22033bc81a6755b57
2016-07-13 18:55:43 -07:00
Dan Willemsen
f2c27d7370 Export the default LOCAL_STRIP_MODULE value
In make, BUILD_PREBUILT and BUILD_SHARED_LIBRARY/BUILD_EXECUTABLE use
different defaults for LOCAL_STRIP_MODULE. Explicitly use the
BUILD_SHARED_LIBRARY/BUILD_EXECUTABLE default so that we'll strip
binaries the same way when converting from Make to Soong.

BUILD_SHARED_LIBRARY/BUILD_EXECUTABLE uses the default set in
dynamic_binary.mk: mini-debug-info.

BUILD_PREBUILT (SHARED_LIBRARIES) uses no_debuglink
BUILD_PREBUILT (EXECUTABLES) doesn't strip by default

None of the above support stripping host modules.

Change-Id: I73a6f7bd7d2ed2033936579c78ae4980386dd4a2
2016-07-13 17:33:49 -07:00
Dan Willemsen
e6c7f18364 Fix LOCAL_EXPORT_C_INCLUDE_DIRS processing
In order to strip the -I from the beginning of each flag, the androidmk
functionality expected every flag to be distinct. The existing
functionality was combining them with spaces if a module exported more
than one include directory at a time.

Change-Id: Ief5e22061c58f3d987557e938bae880509ffb121
2016-07-13 10:45:01 -07:00
Dan Willemsen
75ab80882e Make static_executable an arch_variant
So that target executables can be static executables, and the same
module can make a host executable that isn't static.

Change-Id: Ibe0de001a8d1e7d59e617c244978098355718527
2016-07-12 15:41:09 -07:00
Colin Cross
c7a38dc00c Add support for test libraries
Add cc_test_library, which is a combination of a cc_test and a static
library.  Requires adding a libraryInterface to identify libraries that
are embedded in other types.

Change-Id: I2f0dcccb2f7243409210547562d2b41c3fbce44e
2016-07-12 13:13:09 -07:00
Colin Cross
7924885eb3 Make Stl *bool
When collapsing properties for applying defaults, string is
appended, *string is replaced, which is the behavior we want here.

Change-Id: I22a8c23e1cb8ec1960cd5d92d80f6c1ddfab1913
2016-07-12 13:12:33 -07:00
Colin Cross
624b8ed0b3 Fix install path of benchmarks
Benchmarks should go in /data/nativetest/<module> like tests.

Change-Id: Ib72ee699334da6a6d27813822e1f86f2863227b3
2016-07-11 17:20:09 -07:00
Colin Cross
b5bc4b412a Add system shared library dependencies to Android.mk
We were missing dependencies from the prebuilts to the system shared
libraries, which could cause libc to not be installed if only soong
modules were built.

Change-Id: Ie5c237d7be23c6170e8b586b013f6456a8462230
2016-07-11 16:14:13 -07:00
Colin Cross
2683274349 Update cc_benchmark to use libgoogle-benchmark
Updates soong to match I1565cf680298a1765e88162d8b0e59dedba29bd7

Change-Id: I787675562e3f1dceb9a56f2bcb533a551cae550a
2016-07-11 22:39:35 +00:00
Dan Willemsen
3f32f03067 Support no configured device architectures
There are some builds where we only want to build host tools, and we may
not have a valid device configuration. Support 0 device architectures
and modules that don't have any configured way to build.

Change-Id: I732251e1cd3cdbfafbc6ef6a550e33e653876f7c
2016-07-11 14:36:48 -07:00
Dan Willemsen
76f0827ce3 Apply export_include_dirs to assembly files
Instead of putting these in CFlags, use GlobalFlags instead. This
matches the Make behavior.

The exportFlagProducer could be generic, but for now only has include
directories, so it should be safe for all file types.

Change-Id: I2862f08e7ad473ebacaa88ad2c4510248cad316f
2016-07-09 07:20:59 +00:00
Dan Willemsen
72d3993c9b Stop exporting NDK prebuilt modules to Make
Make isn't going to use any of these anytime soon. So hide them from
make for now, and be sure to save the AndroidMk shared library
dependencies before we convert them to NDK dependencies.

And $(ACP) is no longer used by $(copy-file-to-target)

Change-Id: I8f8f7d0177d31ba4206c0bc1f2ff952dce53b6b4
2016-07-08 23:41:36 -07:00
Dan Willemsen
97704edd5d Support linking against NDK prebuilt libraries
When sdk_version is specified, we need to use the prebuilt ndk versions
of these libraries instead of the platform versions.

Change-Id: I4ff33a234a985041ebe11ab148d64d0f8df66fc4
2016-07-08 20:44:54 +00:00
Colin Cross
6886183d8f Remove cc.ModuleContext.module()
cc.ModuleContext.module() returns a *cc.Module, and is left over from
when the cc package tried to use inheritance.  Remove it and the last
few users.

Change-Id: I9b42ca59689c1b0ada7980fbec923747ed3a53d3
2016-07-08 11:18:46 -07:00
Dan Willemsen
3c316bc03b Fix SDK link type check
This was always returning true, which defeats the point. Fix the check,
then add another exception for NDK libraries.

Change-Id: I139d95ef62d1063c083d6381293072ad3277ae74
2016-07-07 21:38:29 -07:00
Dan Willemsen
6871062821 Merge "Allow static/shared modules to be disabled per-arch" 2016-07-08 03:38:53 +00:00
Evgenii Stepanov
db6509c2f8 Merge "Target sanitize properties can disable the global sanitizer." 2016-07-07 20:08:11 +00:00
Colin Cross
7b5c22b1f0 Don't specify LOCAL_STRIP_MODULE for static libraries
After I92a838b07fe4116d5a4b8521fe1ce8d44e6e84e2 in build/,
LOCAL_STRIP_MODULE := keep_symbols will be honored for prebuilts, which
will trigger an error if it is set on a static library.  Only set
LOCAL_STRIP_MODULE for binaries and shared libraries.

Change-Id: I4e17a78afa7c5810dbf9003166c14a1ff3a59c9e
2016-07-07 11:21:53 -07:00
Evgenii Stepanov
fcfe56d194 Target sanitize properties can disable the global sanitizer.
With this change, sanitize: { address: false } disables
SANITIZE_TARGET=address for one target.

Also rename SafeStack to Safestack, because the former can not be
used as a target property.

Bug: 27729263
2016-07-07 10:54:42 -07:00
Evgenii Stepanov
05bafd3784 Revert "Target sanitize properties can disable the global sanitizer."
This reverts commit bb02886451.

Breaks SANITIZE_HOST=address

Change-Id: I9791a034e32a83d567b8739a7ec7b61890cb1b97
2016-07-07 17:38:41 +00:00
Dan Willemsen
fed4d19cbb Allow static/shared modules to be disabled per-arch
libz has a case where the static and shared versions of the device
library are supported, but the host shared library must not be defined,
since it would conflict with the system provided version. There's a
separate module 'libz-host' that provides the host shared library
implementation.

So extend the 'static'/'shared' properties to include 'enabled', which
uses arch_variant so that it can be mutated per-arch. It cannot override
a top level 'enabled: false'.

Change-Id: Ia0f1ff31ad77dc4cb148c531b70158e3245031d5
2016-07-06 21:54:12 -07:00
Evgenii Stepanov
bb02886451 Target sanitize properties can disable the global sanitizer.
With this change, sanitize: { address: false } disables
SANITIZE_TARGET=address for one target.

Also rename SafeStack to Safestack, because the former can not be
used as a target property.

Bug: 27729263
Change-Id: I20f55c0e62b2fdd191ba66c0f661a039109bd78f
2016-07-06 16:38:58 -07:00
Pirama Arumuga Nainar
58e2dcdeda Disable integrated-as for Mips
Bug: http://b/29771478

Hand-coded assembly in various projects will fail to compile after Clang
switches to integrated assembler for Mips.  Disable integrated-as for
Mips.

Test: Verified Mips builds on AOSP both with the old Clang prebuilts and
the new prebuilts (https://android-review.googlesource.com/#/c/243871/)

Change-Id: Idf441cb9c6c2afc8997d5ee56420885930087918
2016-06-30 04:50:50 +00:00
Dan Willemsen
141d566f2b Remove support for libstdc++ on Android/Linux/Darwin
It's now only supported on Windows, where we don't have libc++ support
yet.

Change-Id: I64891b7558d3d2942588687017a0c2f695c18d5c
2016-06-15 13:47:51 -07:00
Dan Willemsen
7517ed0b46 Export strip information to Make
Change-Id: I3c69451a505ac2b97f3112050acc4b64b1cd7394
2016-06-10 17:20:30 -07:00
Dan Willemsen
a96ff64527 Check NDK linking, expose SDK_VERSION to Make
Modules defining sdk_version should only be allowed to link against the
ndk prebuilt libraries and other modules defining sdk_version. Implement
this, and expose the necessary information to Make so that it can be
implemented there as well.

Change-Id: I051498b595f8711883bc120f0394b8bfe2f65bce
2016-06-07 21:52:12 -07:00
Dan Willemsen
92ca32e6b9 Merge changes Ia7e7fb61,Iede67e2c
* changes:
  androidmk: Fix LOCAL_FORCE_STATIC_EXECUTABLE
  Implement re-exporting of library headers
2016-06-08 04:43:18 +00:00
Dan Willemsen
490a8dc2d5 Implement re-exporting of library headers
This matches LOCAL_EXPORT_(SHARED|STATIC)_LIBRARY_HEADERS in Make.

Change-Id: Iede67e2c24a24cf51e68a50123299effbe4e4196
2016-06-06 18:35:57 -07:00
Dan Willemsen
29d9f87e7f Allow -lz on Darwin
Change-Id: Ied37d4dca499f55e28494d1ce8eac59122827d67
2016-06-06 16:26:48 -07:00
Dan Willemsen
58f9bb1160 androidmk: Support version_script
This only translates the common case using $(LOCAL_PATH). If it doesn't
match here, Soong will throw an error with a suggested fix.

Change-Id: If64c8fca008a1a414fc12389e6b1bb40af0df899
2016-06-03 13:56:55 -07:00
Colin Cross
a1ad8d1889 Simplify arch target handling
Soong's multi-architecture building has grown complex, with the
combination of HostOrDevice+HostType+Arch necessary to determine how to
build a variant of a module, and three separate mutators to split each
into its variations.

Combine HostOrDevice+HostType into Os, which will be Linux, Darwin,
Windows, or Android.  Store Os+Arch as a single Target.

Change-Id: I92f2e2dac53617d595a35cc285d2bd348baa0fbd
2016-06-02 19:09:32 -07:00
Colin Cross
b9db480385 Revert "Simplify arch target handling"
This reverts commit 6713fb26cbcadf525cd75e47d7d0cbc23d282b3e.

Change-Id: Ic473cea2563b0b37dc08b0bc5d3a0ac8c4b6afe6
2016-06-03 01:50:47 +00:00
Colin Cross
54c7112c43 Simplify arch target handling
Soong's multi-architecture building has grown complex, with the
combination of HostOrDevice+HostType+Arch necessary to determine how to
build a variant of a module, and three separate mutators to split each
into its variations.

Combine HostOrDevice+HostType into Os, which will be Linux, Darwin,
Windows, or Android.  Store Os+Arch as a single Target.

Change-Id: Iae677eff61a851b65a7192a47f2dc17c1abb4160
2016-06-02 17:37:02 -07:00
Dan Willemsen
17f052647f Support installing non-native arch binaries
For the x86_arm target, which uses two 32-bit architectures, x86
libraries should be installed into ".../lib", and arm libraries should
be installed into ".../lib/arm".

This shouldn't be necessary for binaries, but non-native binaries aren't
supported in Make right now, so we can revisit this once it's necessary.

Change-Id: I4d883c85d3ef4945ff6149d9c4fc81af5023e12b
2016-05-31 16:27:00 -07:00
Dan Willemsen
5efc706895 Export GLOBAL_[CLANG_]C[PP]FLAGS_NO_OVERRIDE to Make
Change-Id: I7f2f37f63720244eb1f3340804c00ae82d36e90b
2016-05-27 15:23:38 -07:00
Dan Willemsen
cd114c1cb7 Remove [local_]include_files
We don't actually need to do any changes to the path for the include
files, so we can just rely on the include_dir search to work.

It would still be useful to verify that the path isn't something bad,
like an absolute path, but we'll handle that by looking at the cflags in
another change.

Change-Id: I0bd609435969191c4ff91f2cd06eccfb75f5097c
2016-05-26 23:09:46 +00:00
Dan Willemsen
0bd588787b Export TARGET_TOOLCHAIN_ROOT
This is still used by brillo to find GCC for the kernel build.

Change-Id: I19238b1cc9c4220224048afebbdf6032015c3e89
2016-05-26 15:23:07 -07:00
Dan Willemsen
20acc5c520 Add flag property checking
Some checks for common errors with user-provided compiler and linker
flags:

* Using -I instead of include_dirs
* Using -l<lib> in ldflags instead of host_ldlibs (or shared_libs)
* Using -L in ldflags
* Splitting a multi-word flag into two flags
* Combining two flags into one list entry
* Using a path that could search outside the source or output trees
* Using a non-whitelisted library in host_ldlibs

Maybe some of the flag checks should happen during a static analysis
pass, but we don't have one right now, and this only adds ~1/2 second to
our 73 second Mega_device runs (recompile the changed code, run
soong_build, then report unknown target).

Change-Id: Icea7436260f1caa62c0cec29817a1cfea27b3e7c
2016-05-25 17:50:05 -07:00
Colin Cross
b36ab1a1a0 Fix sanitize host builds
Host builds don't have a separate place to install asan modules, so only
create a single variant for them.

Change-Id: I81f7090debd7935db778f8600d8cbc86dd53b1cb
2016-05-25 12:35:53 -07:00
Colin Cross
bc6fb16b26 Support sanitizer variants inside make builds
Create both sanitized and unsanitized variants inside make builds with
sanitizers enabled.  Only export the sanitized version to make, and
always install the sanitized version in /data to match the make build.

Change-Id: I5a17bcbddc7a9d871c929c84d3c116228ef3258f
2016-05-24 17:14:15 -07:00
Dan Willemsen
9598e1048a Stop sorting (C|CPP|LD)FLAGS when checking
Make isn't defining these anymore, so we don't need to sort them before
comparing.

Change-Id: Ia2f13f665309569ee8c564a8fb82639d174a83bb
2016-05-23 15:15:13 -07:00
Dan Willemsen
e8c5237775 Fix and check CLANG_CONFIG_UNKNOWN_CFLAGS
Change-Id: Id8d4ab5e7bf7c9ed161596c19ccdfe00aaa2f7c6
2016-05-20 00:19:14 -07:00
Dan Willemsen
558e517ae9 Check more Make variables
Some more common makevars methods were required in order to remove the
"-isystem" prefixes from the toolchain.IncludeFlags() value. In Make,
the -isystem is prepended at time of use, not in TARGET_C_INCLUDES
itself.

Change-Id: If07e69ddb7357d11c7dd48ab60f503d219f29de8
2016-05-20 00:19:14 -07:00
Colin Cross
d87145fe05 Add libclang_rt.asan-mips[64]-android.so
Add the clang asan runtime libraries to the mips and mips64 toolchain
definitions.  Fixes missing symbol build errors on asan_test.

Change-Id: I10c46599af2c7758f4726814920b8881644c6f97
2016-05-19 22:43:46 -07:00
Dan Willemsen
d26a713dca Fix makevars (C|LD)FLAGS ordering
This better matches the order from cc/cc.go, so that any implicit
ordering behaves the same in Make and Soong.

Change-Id: I802d725f037a22c4b2f0ae28258af95efa37ce79
2016-05-18 23:00:57 -07:00
Dan Willemsen
c264c16638 Move -msoft-float to ToolchainCflags
-msoft-float is equivalent to -mfloat-abi=soft, which means we need to
make sure the order is correct if we also specify -mfloat-abi=softfp.
Since the Neon support (with -mfloat-abi=softfp) is in the cpu-specific
ToolchainCflags, move the generic definition into ToolchainCflags as
well.

This wasn't actually causing problems when compiling, since the normal
toolchain.Cflags is before toolchain.ToolchainCflags, but the makevars
code accidentally reversed this. That will be fixed as well, but this
will protect against similar problems in the future.

Change-Id: If6f37c845210105f84769bab45fde5d7fdc2fe09
2016-05-18 22:52:25 -07:00
Dan Willemsen
03a7086319 Add windows prebuilt library path
This was in HOST_CROSS_GLOBAL_LD_DIRS, which is why it didn't get
translated over here, since Soong does not use global linking
directories. It's being moved to HOST_CROSS_GLOBAL_LDFLAGS so that it
can be shared.

Change-Id: Ie20670278a589ae3cf76e09de4079edfa800cf5b
2016-05-18 16:51:24 -07:00
Dan Willemsen
d352edf0e8 Support Windows IncludeFlags
The variable was defined, but it wasn't being exposed to the Toolchain
interface. It was also using -I instead of -isystem.

Change-Id: Iee9862a4b9c50c9497915175a23864b4b2c29c26
2016-05-18 16:51:24 -07:00
Dan Willemsen
a2abfd6b30 Add the common directory back to kernel headers.
This is a port of build/ change 6a2f28514.

Change-Id: I9128abf61a56e282f335f540fcf064dd52706b2b
2016-05-18 16:51:24 -07:00
Colin Cross
635c3b0157 Rename common to android
Rename the "common" package to "android", because common is too
generic.  Also removes all android.Android naming stutter.

Ran:
gomvpkg -from 'android/soong/common' -to 'android/soong/android'
gorename -from '"android/soong/android".AndroidModuleContext' -to 'ModuleContext'
gorename -from '"android/soong/android".AndroidBaseContext' -to 'BaseContext'
gorename -from '"android/soong/android".AndroidModuleBase' -to 'ModuleBase'
gorename -from '"android/soong/android".AndroidBottomUpMutatorContext' -to 'BottomUpMutatorContext'
gorename -from '"android/soong/android".AndroidTopDownMutatorContext' -to 'TopDownMutatorContext'
gorename -from '"android/soong/android".AndroidModule' -to 'Module'

Change-Id: I3b23590b8ce7c8a1ea1139411d84a53163288da7
2016-05-18 15:37:25 -07:00
Colin Cross
c7fd91a266 Fix ndk x86_64 and mips64 builds
x86_64 and mips64 NDK prebuilt libraries are stored in .../usr/lib64,
but arm64 and all the 32-bit ABIs use .../usr/lib.  Add a 64 suffix to
the path for all 64-bit ABIs except arm64.

Change-Id: I98e87ff6a7f1aa75adbeb37c5b1e7208b953322f
2016-05-18 22:24:19 +00:00
Dan Willemsen
36cff8bb6f Fix Static_executable, implement BUILD_HOST_static from Make
Static_executable was still using ModifyProperties, and was otherwise
missing things. Fix all of that up, and implement HostStaticBinaries,
which is the equivalent of BUILD_HOST_static in Make. That will default
host binaries to be static, which is useful for building SDK tools to
run with incompatible C libraries.

Change-Id: I2a62181b5d854b310edc8ae7a6bcbd30b89e7463
2016-05-17 16:39:17 -07:00
Dan Willemsen
216a459ccc Export CONLYFLAGS and CPPFLAGS to Make
Change-Id: I061d531983b5bb544efb2f0ab5912cd2b461f58b
2016-05-17 01:00:50 -07:00
Dan Willemsen
06f453359a Export -D__BRILLO__ to make if necessary
Fixes Brillo builds

Change-Id: Ia3563b0c9e000d95ed18d05460f5c8c32e04e191
2016-05-16 19:32:33 -07:00
Dan Willemsen
b436fdee65 Turn on strict checking for C[PP]FLAGS make vars
Change-Id: I8448feb55b54515856798c1b3e8070d0e07e0b6c
2016-05-16 18:04:45 -07:00
Dan Willemsen
3772da13fd Don't use -B...gcc.. on Darwin
We don't ship binutils on Darwin, so there is no point in telling clang
to look in that path. (The path being used doesn't even exist). This
matches the Make behavior.

Change-Id: I663047057ff8df8a349483532da8018af13d50d8
2016-05-16 18:04:01 -07:00
Dan Willemsen
e7932e890b Properly export toolchain static libs
Change-Id: I7fd5308469aee5a43d576d1a72f7738dc6f9fbaa
2016-05-16 15:56:53 -07:00
Dan Willemsen
73d21f25cb Add more make-exported variables
Change-Id: I6b7a30624923b8ca879d4ac7a3f1f11aec9b9b8a
2016-05-16 14:22:56 -07:00
Dan Willemsen
1e45ef6823 Merge "Create empty .a on Darwin when there is no obj file." 2016-05-13 22:35:33 +00:00
Dan Willemsen
4a94683a60 Don't use GTEST_OS_LINUX on Darwin
Change-Id: If77118591daa7b474e6989e03109ea32ddd357b2
2016-05-13 22:28:07 +00:00
Dan Willemsen
9f0b550a15 Create empty .a on Darwin when there is no obj file.
On Darwin ar would fail if there is no object file to add.
We work around by adding a dummy.o.

Port to Soong of build/ 4aaa1a1fd8e7eb23ac5557cd326d1a48efdb54cd

Change-Id: I68bbebea2726058c25863d7026a645a520d05167
2016-05-13 15:07:37 -07:00
Dan Willemsen
8146b2f1c9 Update gtest flags from Make
There's a different libgtest to use for NDK libraries built with
different STLs. And we no longer need to add the gtest include path, as
it's exported.

Change-Id: I2f804cf98e074cfd4ea6b70a445e304a8a8bce50
2016-05-13 20:47:24 +00:00
Dan Willemsen
7f08e21941 Merge "Publish Soong configuration to Make variables" 2016-05-13 01:36:28 +00:00
Evgenii Stepanov
2522660da7 Merge "Support SANITIZE_TARGET=safe-stack in soong." 2016-05-12 21:59:25 +00:00
Evgenii Stepanov
0a8a0d09d1 Support SANITIZE_TARGET=safe-stack in soong.
Change-Id: I570a7033ece82c5e76815dc1b81622b481930de4
2016-05-12 13:54:53 -07:00
Dan Willemsen
4b7d5deb84 Publish Soong configuration to Make variables
For configuration like TARGET_GLOBAL_CFLAGS, it would be good to have
Make and Soong use the same values. This change adds an interface for
packages like cc to verify the current value of make variables match the
Soong equivalents, and once they're satisfied with the results, remove
the make definition and use the value from Soong.

The cc implementation exports a few variables currently that I expect to
match between both implementations in all cases. It also checks
{CLANG,}{HOST,TARGET}_GLOBAL_{C,LD}FLAGS, which should be mostly similar
between make and soong now.

Bug: 23566674
Change-Id: Idc8582ef31ace11a8baefcf525c3683f08a573aa
2016-05-12 13:36:55 -07:00
Dan Willemsen
025b4807cb Include objs from whole static libs before local objs
This matches the make behavior.

Change-Id: I8265fb481424734062b0fca944cdbbe283b7236d
2016-05-12 13:20:52 -07:00
Treehugger Robot
ac6697420a Merge "Move local ldflags after the toolchain ldflags" 2016-05-11 01:27:50 +00:00
Dan Willemsen
00ced7675c Move local ldflags after the toolchain ldflags
This way a local module can override a global flag (like libm
overriding -Wl,--hash-style=)

Change-Id: If32774381fc46b5767f2c13bf45c3a84acb2697e
2016-05-10 17:31:21 -07:00
Dan Willemsen
8a35405d33 Add a 32-bit x86_64 arch variant
In make, the current 32-bit configuration for generic x86_64 targets
inherits some variables (SSE4 support) from the 64-bit configuration,
and overrides the make variables used for other configurations (SSSE3).

We don't have that problem in Soong, but this is the configuration
matching what Make is using.

Change-Id: Ia934ff40f9388f9c202a0fe0608e7b45b77a2714
2016-05-10 15:29:33 -07:00
Dan Willemsen
f4449451b5 Merge "Fix X86 flags" 2016-05-10 00:09:00 +00:00
Dan Willemsen
2524b414e2 Merge "Fix mips flags" 2016-05-10 00:08:54 +00:00
Dan Willemsen
569b0fa2ae Fix X86 flags
Add extra clang cflags, and correct the clang triple for X86 device
builds.

Change-Id: I95abbd0f0f943ebdede905733785ee3659610058
2016-05-09 15:32:07 -07:00
Dan Willemsen
c785ff35af Fix mips flags
Change-Id: Ica7851e19d9a709d03a752dbd4f88f07fc8ce1ee
2016-05-09 15:31:34 -07:00
Dan Willemsen
ed89a7aa0c Clean up and fix Krait cflags
For krait, we were using the cortex-a15 cflags for GCC, but a completely
separate set for Clang. To make it more readable, and prevent the LPAE
flag from being missed for Clang, explicitly define krait cflags for GCC
as well.

Change-Id: I6dc00a22e2b298ee3755190bf09f28e427c8c70d
2016-05-09 15:30:53 -07:00
Dan Willemsen
162d08f35e Add missing arm64 -Werror=implicit-function-declaration
This exists for all of the 64-bit architectures in the make build system

Change-Id: I023ef1afdaaa790aac4243a5c040f533b8814684
2016-05-07 00:27:26 +00:00
Dan Willemsen
4ce4703182 Add -mpopcnt for X86_64 targets if they support popcnt
Change-Id: I09668a220f207d3d7510f058610846e4427d815e
2016-05-06 17:23:20 -07:00
Dan Willemsen
2c044aed20 Remove duplicate -B entry for host linux clang ldflags
In cc/cc.go, we already add -B{GccRoot}/{GccTriple}/bin to all clang
cflags, asflags, and ldflags. So we don't need to add a linux specific
version here.

Change-Id: I42d71662c78a8170463dfec932a633e4d4ff52c8
2016-05-06 17:23:15 -07:00
Colin Cross
6ee75b61cd Support prepended arch-specific properties
Arch-specific static libraries should be prepended so that the common
static libraries can depend on them.

Bug: 26968262
Change-Id: I40a21d18ece8f6d20824437e7180628b29ffdd04
2016-05-05 16:49:43 -07:00
Dan Willemsen
3b1fffa33b Fix Android.mk LOCAL_EXPORT_C_INCLUDE_DIRS generation
We were keeping the original array, and adding duplicates with -I
removed. Instead, only add entries that start with -I, but continue
stripping that off. This removes the -isystem arguments from the NDK
libraries.

Change-Id: I8fd71bbd6b7a051aad7e80a92a05dbdc05a6b87a
2016-05-05 15:11:48 -07:00
Colin Cross
30d5f514dd Support sanitizer builds inside make
Make expects libraries built with address sanitizer to be installed into
/data, and can't handle multiple variants of modules.

Change-Id: Ice575ff6f0788a88f296e7b3ee521a2b9771f55f
2016-05-03 18:02:42 -07:00
Colin Cross
b8ecdfe039 Fix stripping on Darwin
The strip tool is different on Darwin, use a separate darwinStrip rule
instead of calling strip.sh for host builds on Darwin.

Change-Id: I6d421cba0dcea04367d5bc638a03f64c81e2ead0
2016-05-03 15:52:51 -07:00
Colin Cross
e14388b9de Remove trailing / from install path
Prevents make installing files with a double /:
Install: out/target/product/generic_arm64/system/lib//libc.so

Change-Id: Iee237f344e8140c4938aa9d1e6940e4fdbfa7cd8
2016-05-03 14:53:18 -07:00
Colin Cross
665dce9320 Support stripping shared libraries and binaries
Strip all shared libraries and binaries by default.  Use a shell script
to wrap the long sequences of commands needed by some strip variants.

Change-Id: I465bf7cc48330913e60e24762fd55fa2a7731c26
2016-05-03 14:03:38 -07:00
Colin Cross
1474741435 Move shell and python scripts to scripts/ directory
Change-Id: Icdff44a54d14ddfc2266d99cf0578a8105716918
2016-04-29 13:59:56 -07:00
Stephen Hines
369f01315a Switch to clang-2812033.
Change-Id: Ie44a0536a50aa6b443be0c015fca1ea9fa02590c
2016-04-26 21:47:42 -07:00
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
4a97cb4328 Support "none" for stl when using ndk
Change-Id: I13ecf0a6be591814546a9a1c8b8356988348feb0
2016-04-21 16:39:28 -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
01fdd3d8c1 Various host flag updates to match Make
Some of these are updates from the old build system, others are just
differences/bugs being corrected.

Change-Id: Ied7f47ade495dcb26ba3611e636869cba283860f
2016-03-30 12:35:07 -07:00
Dan Willemsen
99b5a09022 Merge "Only add -fdebug-prefix-map on Linux hosts" 2016-03-30 04:07:54 +00:00
Colin Cross
e925ffce03 Merge "Remove extension from LOCAL_MODULE_STEM" 2016-03-30 01:15:44 +00:00
Dan Willemsen
0c38c5ea17 Only add -fdebug-prefix-map on Linux hosts
Change-Id: I4fb865fbe40020f2d69d598491e755f793b62b7c
2016-03-29 18:03:54 -07:00
Dan Willemsen
110a89d2c5 Fix arm[64] cflags
Limit arm cpu variants to armv7-a-neon only, and handle a generic
armv7-a-neon cpu variant. Add arm64 cortex-a53 cpu variant. Sanity check
the arch variant against supported versions.

Change-Id: I8ecdea4cd36d9c82e1f29b158efc131f8b1cbc4d
2016-03-30 00:40:14 +00:00
Colin Cross
bf305dea81 Remove extension from LOCAL_MODULE_STEM
LOCAL_MODULE_STEM adds the expected extension to the installation path,
remove the extension from the filename.

Change-Id: I54dbcfa73d8d07fc3630caf2d582160003e28f79
2016-03-29 17:32:06 -07:00
Dan Willemsen
8e1e3fba87 Mark the cortex-{a7,a53,a53.57} chips as supporting LPAE
Port of Id3994c6d334c8bb673fc3849550f591136a8dd6a

Change-Id: Ic9d96ff81f9119e012f45e8e3b3a76961a922a21
2016-03-29 15:47:08 -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
6fb8b8d398 OSX: Use the oldest SDK, but always set our target to 10.8
Build binaries usable on older machines even if older SDKs are not
installed. Older SDKs can no longer be installed on newer Xcode
versions.

Port of https://android-review.googlesource.com/207242

Change-Id: If66f2eef7593bce9fb858fc7b71369f55dd362e4
2016-03-09 10:41:21 -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
f534a10643 Reorder extra clang host flags
In make these clang-specific flags are marked as EXTRA and added after
the common flags.

This was causing differences between compiled objects in make and soong
because -fstack-protector-strong was before -fstack-protector in soong
instead of after.

Change-Id: I59dd6dcfdaf5ec9184a09e79efe80b62cfe48dbb
2016-03-03 17:22:39 -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
4fef64b320 Merge changes Ife723733,I68acfb53,Id216c35d,Id0569831,Iadac88f8, ...
* changes:
  Add system/media/audio/include to commonGlobalIncludes
  Add -Werror=date-time to target builds
  DeviceUsesClang should default to true
  clang now supports -fdebug-prefix-map=.
  Turn on ninja errors for duplicate rules
  Update to use the latest clang-2629532
2016-03-02 03:06:41 +00:00
Dan Willemsen
f0c73e0f71 Generate .c for .y and .l
Soong port of https://android-review.googlesource.com/195737

Change-Id: I9ab6dc149c258f7642bc36c3fa32f90ff7ee51a4
2016-03-01 17:32:31 -08: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
2808e09417 clang now supports -fdebug-prefix-map=.
Soong port of https://android-review.googlesource.com/204111

Change-Id: Id0569831f09845871d8e6990c310516bea5a2510
2016-03-01 17:22:30 -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
b77bd796c2 sandybridge setup: no AES_NI, AVX, MOVBE
Sandy Bridge actually doesn't have all of these options. For example AVX is only
available on the higher-end SKUs (not on Celeron G550).

Soong port of https://android-review.googlesource.com/204730

Change-Id: Ib595a9a6b464626d0c88525c6aaa4d69176645cc
2016-02-29 15:26:26 -08:00
Dan Willemsen
97750520a4 Refactor Android.mk generation
Now, instead of combining multiple binaries into a single BUILD_PREBUILT
definition, use separate instances for every module variant. This fixes
HOST vs HOST_CROSS prebuilts, and should be saner overall. From make,
these should look the same, we're only just using one instance of
prebuilt_internal per BUILD_PREBUILT call instead of multiple.

With that simplification, we don't have to store as much state, and can
directly write into the buffer.

Also switch from io.WriteString to fmt.Fprintln, which will require
fewer explicit string concatentations, and we don't need to worry about
newlines.

Allow the module-provided functions to return errors.

Change-Id: If30453b21fa21387f635626618d8fabfc78e6859
2016-02-09 19:56:22 -08:00
Dan Willemsen
07cd051a17 Add windows x86_64
Bug: 26957718
Change-Id: I5cfa2f44c27eac0805d21865c45546ed3c2c2103
2016-02-08 16:07:22 -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
7a0f848998 Align flags with make
This pulls a number of cflag changes from make since our last sync.

Change-Id: I8c77fc215ed7677b8ac15a6d39143b519068dd55
2016-01-12 23:30:13 -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
cf7c71bc47 Use xcrun and xcode-select to auto-configure mac sdk
This roughly matches what make uses, but with less string parsing.
Also use a full path to "ar", so that we can depend on it.

Change-Id: I5e9d4c06b6cbbbfbf93e563dace128943db21b02
2015-12-22 15:53:01 -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
c7e4597461 Enforce linker version-scripts are valid
See build/ commit da9c00da5f7b

Change-Id: I65878931ab61124ae75e2c738cc733adfb107afc
2015-12-11 21:21:28 +00: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
34fc3b1e84 Expose real GccVersion
In order to validate that the NDK STL paths exists, we need to know
the full path, including the Gcc version during the go execution. So
instead of returning a ninja variable reference, just return the
contents of the variable.

This also fixes a few invalid uses of armGccVersion to the proper
variable.

Change-Id: I54398ba4aa4000235b7d537a2c4efe3ecbbeec8b
2015-12-07 14:02:37 -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
3b336c2056 Add mips64
Change-Id: I2b4adbc1a1568b66515243005beda2c56a4a0519
2015-11-24 21:34:54 +00:00
Colin Cross
023f1e8e8f Add mips
Change-Id: Icb05292877a60939542ce09d9774e4b9d1353502
2015-11-24 21:34:46 +00:00
Colin Cross
6371b387b7 Add x86_64
Change-Id: Ib0f31d147546ae187697867c6a0b937266bb9b39
2015-11-24 21:34:36 +00:00
Colin Cross
b0cba6a00f Add x86
Change-Id: I28e78cd49b184e0aa50c1c562b6bf719300e0832
2015-11-24 21:34:26 +00:00
Colin Cross
41280a4225 pass ldflags to partial ld rules
x86 crt partial ld steps need to pass -m32 through ldflags.  Use gcc to
run partial ld instead of going directly to ld.  Allows reusing
ToolchainLdflags, which have linker arguments prefixed with "-Wl,".

Change-Id: I1e01ca5831061a11c9f550ab198d8e5b8dccf8bd
2015-11-24 21:33:29 +00: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
e356ecba34 Merge "Re-export exported includes from whole_static_libs" 2015-11-19 23:23:20 +00:00
Dan Willemsen
c94a768a2a Use Rule-local implicit dependencies
Depends on https://github.com/google/blueprint/pull/78

This uses the new CommandDeps field to move implicit dependencies
embedded in the Command string next to the definition, instead of having
to specify them in every BuildParam struct. This should make it easier
to verify dependencies.

Change-Id: I2711b160920e22fa962a436e1f7041272166f50f
2015-11-17 19:05:07 -08:00
Dan Willemsen
322a0a6b59 Fix and optimize relPwd in cc
We cannot use the PWD trick for any compile on Darwin, since /proc
doesn't exist. So instead of checking for darwin host modules, just
check runtime.GOOS.

And since this isn't a per-module decision, don't pass it along as a
variable to every build command, but make it a global variable.

Change-Id: Iea8609f49a9d316c58aed527f62d1986c970eaac
2015-11-17 18:09:57 -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
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