Commit graph

468 commits

Author SHA1 Message Date
Colin Cross
1cdcf50b4b Merge changes I92cea061,I67705c5c
* changes:
  Add spaces around := when dumping assignments
  Fix govet issue
2016-06-01 04:53:26 +00:00
Dan Willemsen
c2aa4a9c52 Start using blueprint_go_binary
And install the tools into a more obvious location. soong_env is not
moved, since we need it to exist early, so that we can use it in
soong.bash in case there's a build failure.

Change-Id: I9bd1fa320d84d180b2cf3deb90782d380666f7a6
2016-05-31 18:31:56 -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
Colin Cross
5126504fae Add spaces around := when dumping assignments
Add spaces around := when dumping assignments that failed translation.

Change-Id: I92cea0616a9dacd74a63b48f4626340b22542fbf
2016-05-30 13:42:19 -07:00
Colin Cross
079602cba6 Fix govet issue
Change-Id: I67705c5c1240bea6a21b7d62fd26d296d49735d4
2016-05-30 13:42:19 -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
Colin Cross
08693d2bf2 Improve makefile parser
Improve the androidmk makefile parser based on ideas from go/ast and
friends:
   - Use type switching instead of the As* mess
   - Don't store endPos for every node, compute it based on the last
     known position in the node plus the length of the last token
   - Store positions as only the offset into the file, and then unpack
     them into Line/Column scanner.Position objects later

Change-Id: I87eb6661859951e6c2ea5a85db6229fa5561d615
2016-05-26 03:34:30 +00:00
Colin Cross
7fd911f713 Fix blank line translation once and for all
Track the position in the input makefile and output blueprint file
separately.  When parsing a new makefile line, increment the line in the
output position by the number of lines between the end of the last
makefile line and the beginning of this line.  Any extra blank lines
will be discarded by the blueprint printer.

Change-Id: I85c6e006667b5733b15e03b56b91caf29fbc0ea0
2016-05-26 03:34:17 +00:00
Treehugger Robot
ad14e6e227 Merge "Fix non-deterministic errors with LOCAL_*_x86_64" 2016-05-26 03:06:08 +00: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
ab6e6e0135 Fix non-deterministic errors with LOCAL_*_x86_64
LOCAL_*_x86_64 was sometimes recognized as a _64 suffix and other times
as the correct _x86_64 suffix, based on the random order of the
propertyPrefixes map.  Replace the map with a slice so that the ordering
is consistent, and ensure 64 as after x86_64.

Change-Id: I1a4b4959f8ef4273ad4a1cdd0672ad557bf1891e
2016-05-25 17:17:40 -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
Colin Cross
88c4750c51 Merge "Include bionic/Android.bp" 2016-05-17 00:42:17 +00:00
Colin Cross
3e5889a791 Include bionic/Android.bp
bionic/Android.bp exists now, and subdirectories are handled with
Android.soong.mk files.

Change-Id: I70259ff5c2fb9df2f8716590502f49de1c2c8ac7
2016-05-16 16:56:51 -07:00
Treehugger Robot
8911062843 Merge changes I7fd53084,I6b7a3062
* changes:
  Properly export toolchain static libs
  Add more make-exported variables
2016-05-16 23:42:51 +00: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
Evgenii Stepanov
6e39d270fa Merge "USE_SAFESTACK support in Soong." 2016-05-16 20:19:39 +00: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
Evgenii Stepanov
8391efac1b USE_SAFESTACK support in Soong.
Translated into product_variables.safestack.cflags.

Change-Id: Ieb55c050448ff04793431c249f482f2d4364e67a
2016-05-13 12:44:03 -07:00
Colin Cross
2630213418 Set LOCAL_PATH for each prebuilt module
Set LOCAL_PATH to the path to the blueprint file so that make can
generate MODULE-IN-* rules to make mma work.  Switch to using
LOCAL_PREBUILT_MODULE_FILE instead of LOCAL_SRC_FILES to specify the
location of the prebuilts relative to $(TOP).

This should also make notice files work.

Change-Id: I51c7aa1187e68c4c9095687461dd5e76cbd7292d
2016-05-13 12:30:12 -07:00
Dan Willemsen
e8b1bc0a68 Lock down environment variable access after all other singletons
To allow other singletons to use new environment variables, move env.go
to the end of the source list, so that its singleton is run last.

Change-Id: Ic92308f72fc0c92a0fedbc5546e337940e32eaab
2016-05-12 19:03:10 -07: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
Treehugger Robot
0414479ba4 Merge "Include objs from whole static libs before local objs" 2016-05-12 21:06:57 +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