Commit graph

808 commits

Author SHA1 Message Date
Inseob Kim
f0cec69de9 Implement BOARD_VNDK_VERSION
This allows BOARD_VNDK_VERSION to be set to old versions. With VNDK
snapshot and vendor snapshot installed, newer system and older vendor
image can be built in the same time.

Bug: 65377115
Test: 1) VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk vendor-snapshot
Test: 2) install snapshot under source tree
Test: 3) set BOARD_VNDK_VERSION and boot cuttlefish
Change-Id: Ic5fefc8bcb866584b27f021a429cb6670a2e3048
2020-01-23 12:52:25 +00:00
Justin Yun
2bfe0a1a25 Restore "Linktype check for native:product"
Similar to native:vendor, native:product can use VNDK libs but not
vndk_private.
It is activated when PRODUCT_PRODUCT_VNDK_VERSION is set.

This restores the reverted commit
4e7e76fe5a (aosp/1197274).
The problem of the original CL was assuming no modules have both
LOCAL_PRODUCT_MODULE and LOCAL_USE_VNDK in the old implementations.
But many vendor modules in the targets without setting
PRODUCT_PRODUCT_VNDK_VERSION in old branches had both flags that
caused link failures.
To make it no-op without PRODUCT_PRODUCT_VNDK_VERSION, I defined
LOCAL_USE_VNDK_PRODUCT that is set to true if
PRODUCT_PRODUCT_VNDK_VERSION is defined and LOCAL_PRODUCT_MODULE is
true.

Bug: 146620523
Test: build with PRODUCT_PRODUCT_VNDK_VERSION := current
Change-Id: I344c7dc1c47f08706c101e486ff07c3f10aff8ac
2020-01-22 00:16:25 +00:00
Justin Yun
dd5401713c Revert "Linktype check for native:product"
This reverts commit 4e7e76fe5a.

Reason for revert: build breaks (bid: 6147225) and postsubmit test fails.
There are some modules that have both "product_specific: true" and "vendor_available: true", which tags the module as "native:product" unintentionally.
We need to clean up these cases first and revisit this CL.

Bug: 146620523
Bug: 147987741
Change-Id: Ib07543235d72a135b6b732aaa909c147d2df832b
2020-01-20 07:39:41 +00:00
Justin Yun
4e7e76fe5a Linktype check for native:product
Similar to native:vendor, native:product can use VNDK libs but not
vndk_private.
It is activated when PRODUCT_PRODUCT_VNDK_VERSION is set.

Bug: 146620523
Test: build with PRODUCT_PRODUCT_VNDK_VERSION := current
Change-Id: Icfd94dfc30e77581991799d9e2f408f57da22cea
2020-01-19 23:46:47 +00:00
Dan Willemsen
38dc09d39a Use our prebuilt M4 for flex and bison
And ensure we've got all the proper dependencies.

Bug: 117561006
Test: treehugger
Change-Id: Ia9690b2c0d73a48744c8e33fe83196d02b1e904d
2020-01-08 22:31:12 -08:00
Nick Desaulniers
9882f6f7be build: make: use -Wl,-z,separate-code w/ -Wl,--execute-only
Also, prefer
-Wl,--execute-only
rather than
-Wl,-execute-only

Bug: 139945549
Bug: 146144180
Test: m
Change-Id: I4a07978c7a84a0a7e841b9e059305b0f443d0e95
Suggested-by: Ryan Prichard <rprichard@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-12-16 09:55:05 -08:00
Treehugger Robot
9e0b4ed82a Merge "Improve checks for include dirs outside the source tree" 2019-12-06 21:49:25 +00:00
Ivan Lozano
deaf3fc74a Merge "Exclude dirs from binder interface whitelisting" 2019-12-06 02:25:10 +00:00
Dan Willemsen
0cb422f0e7 Improve checks for include dirs outside the source tree
See the Changes.md addition for more details.

Test: treehugger (build_test on downstream branches)
Change-Id: I6ad6b454a6fccf93772fda26cfc7dd6bbfc07c40
2019-12-05 13:11:04 -08:00
Ivan Lozano
b18979aa20 Exclude dirs from binder interface whitelisting
Exclude vendor/ and hardware/ from the manually written binder interface
whitelist.

Bug: 136279235
Test: interfaces in excluded directories are not checked against whitelist.
Change-Id: I71152995466a25e92b6d0b153538ebfc1b252f5b
2019-12-05 12:09:38 -08:00
Yifan Hong
88adfc6349 Mark BOARD_HAL_STATIC_LIBRARIES as obsolete.
No device in our tree use this obsolete thing now.
OEM devices with libhealthd should define health HAL
2.1 instead.

Test: builds
Fixes: 127677771
Change-Id: I1861452a3f7fc97ee20615c8f9f25422f9f507e2
2019-12-04 14:50:59 -08:00
Dan Willemsen
c9a657c907 Clean include directory paths
To remove '../' and other strangeness from compiler arguments, which run
into problems with remote execution:

  Android.mk: LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/bar/..
  foo.c: #include "foo.h"
  include/foo.h

In this case, we'll send foo.c and include/foo.h, but include/bar may be
empty, and not exist on the remote server. So while the file is there,
you may not be able to access it.

There's also a byproduct of removing extra '/' and './' components,
which should be harmless.

Fixes: 144109314
Test: diff build-aosp_arm.ninja before/after; scan diffs
Test: treehugger
Change-Id: Id2eceba76fbf9b1524487e82cb5c8903c815e45f
2019-11-25 20:39:22 -08:00
Colin Cross
9d789145fa Merge "Set pools manually for rules that can run in RBE or goma" 2019-11-15 18:19:33 +00:00
Colin Cross
0d1f54e2e1 Forbid -Weverything
Use of -Weverything blocks build system changes and toolchain updates
on new warnings.  Forbid it in the build system.  Developers can
experiment with -Weverything on their module by adding it to their
Android.mk file and building with
m ANDROID_TEMPORARILY_ALLOW_WEVERYTHING=true

Fixes: 143713277
Test: manual
Change-Id: Ifca9ad45301b0d51f18b5ae85cfb9e5b89fbef3f
2019-11-12 15:56:55 -08:00
Colin Cross
23dcf76a36 Set pools manually for rules that can run in RBE or goma
Use .KATI_NINJA_POOL := none to mark rules that can run in RBE or
goma when they are enabled, which along with passing
--default_pool=local_pool will allow moving remoteable jobs into
the remote pool without relying on hacks in kati.

Fixes: 143938974
Test: inspect pools in build-${TARGET-PRODUCT}.ninja for m USE_RBE=true
Test: inspect pools in build-${TARGET-PRODUCT}.ninja for m USE_GOMA=true
Change-Id: I08615ae1f2eaef9ff0ba253b8aa3d83ab57ebb27
2019-11-12 13:59:49 -08:00
Elliott Hughes
be90dc8396 Merge "Revert "-D__ANDROID_NDK__ for SDK builds."" 2019-10-16 16:01:14 +00:00
Elliott Hughes
af11c50e67 Revert "-D__ANDROID_NDK__ for SDK builds."
This reverts commit 401a84071b.

Reason for revert: fixed in bionic instead (https://android-review.googlesource.com/c/platform/bionic/+/1135146).

Change-Id: I85e2ef241684c34fc968fd0e7230b8a88ea3209a
2019-10-11 01:24:39 +00:00
Ramy Medhat
e5839f912b Add labels to rewrapper cc compile action. Prevent ccwrapper from being
used in links.

Test: Built aosp-arm64_eng with and without USE_RBE=1

Change-Id: I8d04069219a9467c3de9a028eb68e3115173f1e2
2019-08-12 14:13:31 -04:00
Steven Moreland
401a84071b -D__ANDROID_NDK__ for SDK builds.
The NDK is built like this. Having it for app builds within the Android
build system allows us to distinguish platform code from app code.

This is specifically to distinguish AIDL interfaces using libbinder_ndk.
'myBinder-ndk_platform' libs will use additional functionality that
'myBinder-ndk' libs won't use (in the future, these may be separate
variants with the same name, see b/121157555).

Bug: 136027762
Test: using this to distinuish code in NDK vs platform code
Change-Id: I27471b9184e8d67fc51c8eace317f92b3f0f3539
2019-08-07 14:45:03 -07:00
Dan Willemsen
18ffd5891e Remove import_includes/export_includes
Now that ONE_SHOT_MAKEFILE no longer exists, we don't have to rely on
the filesystem to store this informtion.

This removes ~16.7k files from our build graph
(aosp-master/aosp_arm64-eng), though only about 600 of them were being
used in a normal build.

Test: treehugger
Change-Id: I3ac12f5ea7f11d25064109a0599bc5be1976fba5
2019-08-01 14:56:45 -07:00
Dan Willemsen
8b8b9b6bf8 Merge changes from topic "rm_ONE_SHOT_MAKEFILE"
* changes:
  Remove [jni_]link_type files
  Remove support for ONE_SHOT_MAKEFILE
2019-08-01 21:11:02 +00:00
Dan Willemsen
5c3fc2a792 Remove support for ONE_SHOT_MAKEFILE
Test: treehugger
Change-Id: Ie73418c186ec4c0e1c91078c133de8f8113295bf
2019-07-31 18:08:47 -07:00
Pirama Arumuga Nainar
bf2af95f73 Explicitly add lld's relr relocation flags for Android Pie and above
Bug: http://b/119086751

https://android-review.googlesource.com/c/837025 disabled lld relocation
packing globally and enabled it for soong modules targeting pie and
above.  Turn it on for Android.mk modules as well.

Test: grep for -Wl,pack-dyn-relocs=android in
      out/build-aosp_<device>.ninja

Change-Id: I81b8625073aa6b364219b8cf3122b69c95ec7589
2019-07-30 22:36:29 -07:00
Peter Collingbourne
e3606ae651 Specify the API level via the triple instead of __ANDROID_API__.
Clang derives the value of __ANDROID_API__ from the triple these days. In a
future version of clang I plan to start making the behaviour of the HWASAN pass
dependent on the API level in the triple, so it's going to need to be accurate.

Test: walleye-userdebug boots
Change-Id: I23f570bd8ee4fb3167729a75a5e859efe1883a46
2019-07-25 17:43:04 -07:00
Jeffrey Vander Stoep
972695d81d Merge "Renderscript: change extension .rs to .rscript" 2019-07-18 02:02:00 +00:00
Jeff Vander Stoep
c44aa3be41 Renderscript: change extension .rs to .rscript
Reserve .rs extension for Rust.

Bug: 137365032
Test: make checkbuild
Test: cd frameworks/compile/slang/tests
    ./slang_tests.py
Test: atest CtsRenderscriptTestCases
Test: CtsRsCppTestCases

Change-Id: Ibfccb4f52b74f9ac95c373f48d775254ba77288d
Merged-In: Ibfccb4f52b74f9ac95c373f48d775254ba77288d
2019-07-17 18:57:49 +00:00
Pirama Arumuga Nainar
b8f898ef88 Add libprofile-extras to all link steps when NATIVE_COVERAGE is enabled.
libprofile-extras has a wrapper to getenv() that appends the effective
userid (euid) of the current process to GCOV_PREFIX.  This avoids
conflicts and permissions issues when multiple processes try to
create/access the same directories and files under /data/misc/trace.

This library needs to be added and the -Wl,--wrap,getenv flag needs to
be passed to all link steps.  Since Android.mk does not propagate flags
and libraries across dependencies, this change just adds the library and
flag to all non-static-library Android.mk modules.  As a consequence,
*ALL* binaries created via Android.mk will have the signal handler and
property watcher thread in libprofile-extras but they are no-ops in
non-coverage-enabled binaries.

The dependency is added early enough in core/binary.mk so that the
LOCAL_SOONG_LINK_TYPE resolutions occur correctly.

Test: Verify that coverage files are written to
/data/misc/trace/<euid>/proc/... instead of /data/misc/trace/proc/...

Change-Id: I4d5f849c15e9a278253f2148185ddf3ab2878e2f
2019-07-08 15:13:31 -07:00
Dan Willemsen
b441630067 Depend on NDK libraries
Bug: 130111713
Test: treehugger
Test: build system image with RBE
Change-Id: Ibbe4e11a7681c52d2197ce35ae47d4939ca246b6
2019-06-12 21:35:46 +00:00
Dan Willemsen
c5b7c4fbef Add dependencies on the toolchain (clang, etc)
Historically, we've relied on the path to the clang compiler changing in
order to trigger rebuilds instead of direct dependencies on the compiler
itself. That's somewhat more reliable, since the actual $(CLANG) file is
often a script that doesn't actually change during every update.

In Soong, we've added the dependency anyway, so do it here as well. This
makes it easier for my RBE experiments to identify when we intend to use
clang and to send the entire compiler.

Test: treehugger
Test: build a system image with RBE, find that every command that needed
the compiler gets it.
Change-Id: I3838b5d77884394a8c0f7a1ba133142102602084
2019-06-12 21:34:52 +00:00
George Burgess IV
40ecaea185 Merge "Remove our clang-tidy wrapper"
am: 6afe016825

Change-Id: I628822559916c1b36b326fa4ed9d614fae696c34
2019-04-05 17:17:10 -07:00
George Burgess IV
09e5d9b2ba Remove our clang-tidy wrapper
Looks like the reason for it existing has been fixed. It should probably
just be removed.

Bug: None
Test: WITH_TIDY=1 m
Change-Id: Ic001393da7211cd6ef2bbd5af6ef13c7fe8e00e7
2019-04-04 16:21:53 -07:00
Vic Yang
38f68f7a2a Merge changes from topic "vndk-no-vendor-variant"
am: 30dda1da5e

Change-Id: I646d55e6195a24530bf22d1e7588b2dd99b27eba
2019-03-20 21:39:57 -07:00
Vic Yang
51512c558c Add support for no-vendor-variant VNDK
When TARGET_VNDK_USE_CORE_VARIANT is set to true, the vendor variant of
VNDK libraries are by default not installed.  Instead, the core variant
will be used by vendor binaries at runtime.

To ensure the core variant of VNDK libraries are installed, we also add
a flag LOCAL_VNDK_DEPEND_ON_CORE_VARIANT to indicate that the vendor
variant module depends on the core variant module.  This flag should be
set by Soong for all VNDK libraries without the vendor variant
installed.  When the flag is set, the vendor variant binary is also
compared against the core variant binary to ensure they are
functionally identical.

As we are merging the two variants for some libraries, we need a new
link type to denote a module is usable as both native:vndk and
native:platform.  We add native:platform_vndk for this.

Bug: 119423884
Test: With the corresponding Soong change, build with
      TARGET_VNDK_USE_CORE_VARIANT set to true.
Test: Add a dummy VNDK library and a dummy vendor binary that depends
      on it.  Build with no-vendor-variant VNDK and check the core
      variant is installed.
Test: Add conditional compilation based on __ANDROID_VNDK__ in the
      dummy VNDK library and check build fails.

Change-Id: I40000f2728e8193212113c1ee950e9d697f2d40d
2019-03-20 10:23:04 -07:00
Dan Willemsen
5d340e1552 Merge "Deprecate *.c[pp].arm"
am: fb8c9673e7

Change-Id: I45b1d106affd02ea2e9c77fd462d1d6e7269377f
2019-02-25 14:57:01 -08:00
Dan Willemsen
46267cb4d8 Deprecate *.c[pp].arm
There never were too many users of this, and I've just converted the
last ones to Soong.

Test: diff build-aosp_arm.ninja
Test: treehugger
Change-Id: Ida6d486a62d0b521c1cd67f5f18c0ad0dbe957e3
2019-02-21 18:02:13 -08:00
Xin Li
0e2ccf21c9 DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master
Bug: 120848293
Change-Id: Ic9e8ff5af22140dc6ef8ff87a09f9292f9d30dc5
2019-02-21 09:32:40 -08:00
Yu Shan
655f17cf88 Add 32BIT and 16BIT nanopb library.
Add 32BIT and 16BIT compile time flag for nanopb library to support
16BIT or 32BIT size, default is 8BIT. User need to use the corresponding
library when define the PB_FIELD_* flag during compilation.

Change-Id: I0d25bcdf62d6b47733e1ad4bddbd4dfce2192b5d
Test: None
Bug: 122292884
2019-02-19 12:01:43 -08:00
Pirama Arumuga Nainar
5aab10f40d Merge "Enable coverage only when LOCAL_SDK_VERSION > 23" 2019-02-14 00:05:57 +00:00
Dan Willemsen
f264690860 Remove support for building Windows modules in Make
These now must be defined in Android.bp files.

Bug: 122618577
Test: compare build-aosp_arm.ninja before/after
Test: codesearch for LOCAL_MODULE_HOST_OS.*windows
Change-Id: I14451c7753299692940e026f85687b4c3331bb07
2019-02-05 00:19:41 -08:00
Ivan Lozano
0679bddedd Merge "Enable execute-only memory layouts by default." am: 77cd60adcb
am: b8b096a569

Change-Id: I9be726e692c74445552b2cb266c2679e133c7b98
2019-01-15 15:53:43 -08:00
Ivan Lozano
c244c21573 Enable execute-only memory layouts by default.
This enables execute-only memory (XOM) layouts to be used by default in
the build system. As of now, there's only support for ARM64 devices, so
this only affects those. Since userland XOM requires kernel support,
devices without the necessary support will continue to allow pages
marked execute-only to be read and they should be unaffected by this.

Bug: 77958880
Test: Device with and without kernel support boot.
Test: Binary throws segfault when reading from XOM on supported device.
Test: Debugger works and stack traces are still generated correctly.
Test: Teamfooding, stable during regular usage.

Change-Id: I8db4235c8e60eea6d701bdf3c43b79a06d6b01cd
2019-01-15 13:05:59 -08:00
Dan Willemsen
e0a9fc9d8a Merge changes I68c8a566,Ib8a588e5 am: 73e13b5030
am: e6ef8196a9

Change-Id: Ief40b3772b8cc00ee1beff746fcfc164be972d19
2019-01-10 20:42:24 -08:00
Dan Willemsen
11ee341199 All all_objects to LOCAL_INTERMEDIATE_TARGETS
This fixes the WITH_TIDY flakes that we've been seeing, as we've been
relying on a particular order of target-specific variable inheritance.

Change-Id: I68c8a56620c29a41e45f26e5ea81a5313490c1cf
Fixes: 122637600
Test: WITH_TIDY=true m libhellojni_jni
2019-01-10 13:21:07 -08:00
Dan Willemsen
e24da82ffd Reorder binary.mk to move LOCAL_INTERMEDIATE_TARGETS later
I'll be adding more intermediate targets in this file, so move all of
the uses closer to the end.

Bug: 122637600
Test: build-aosp_arm64.ninja is the same before and after
Change-Id: Ib8a588e570cb2a61bab75118db6e480d6afceaa8
2019-01-10 13:10:17 -08:00
Dan Willemsen
afbfff0d2d Merge "Stop trying to read depfile from vtsc" am: 82f2cb078f
am: d372e54742

Change-Id: Icf04b6a21e42e80ea95bdefc9b6484edf55d425e
2019-01-10 10:08:07 -08:00
Dan Willemsen
5125746561 Stop trying to read depfile from vtsc
vtsc just ignores the -d argument and apparently can't write a depfile.
So for now, just stop assuming it produces one.

Bug: 121058584
Bug: 120496070
Test: NINJA_ARGS="-w missingdepfile=err" m libvts_interfacespecification
Change-Id: Ie1483fbeead9f710d8a6636df07ce44bbc4a6e2d
2019-01-09 16:40:58 -08:00
Pirama Arumuga Nainar
9305e203f0 Enable coverage only when LOCAL_SDK_VERSION > 23
Bug: http://b/116873221

The coverage runtime (libclang_rt.profile) needs stderr, which is
exported by bionic only after API level 23.

Test: Build with coverage on globally
Change-Id: I1bdfbbf248d1743d529e9f40f0b52da92bb20ef7
2018-12-20 13:49:52 -08:00
Xin Li
3449df5704 DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master
Bug: 120502534
Change-Id: Ib1b590fc605b17e3a3901e65f62d5f7ad2257f6a
2018-12-11 14:03:11 -08:00
Ivan Lozano
6750532978 Merge "Disable AArch64 XOM when not using lld." 2018-11-29 15:58:39 +00:00
Dan Albert
638ca85aec Merge "Don't use libandroid_support post-21." 2018-11-28 16:19:01 +00:00
Ivan Lozano
f9f03e0119 Disable AArch64 XOM when not using lld.
AArch64 execute-only memory is only supported when using lld as the
linker. There's still a few modules which don't use lld, so in those
cases we need to disable this option.

Bug: 77958880
Test: Module with LOCAL_USE_CLANG_LLD false builds without XOM
Test: Module without LOCAL_USE_CLANG_LLD defined builds with XOM

Change-Id: I5dfe3cd1e1cac2b3ead13912af9f7fe896d507e9
2018-11-27 14:53:33 -08:00
Dan Albert
e6d958aed7 Don't use libandroid_support post-21.
Test: m checkbuild
Bug: http://b/119587551
Change-Id: If3a3556ad27e632778efda43da8384a40eedee5a
2018-11-27 13:59:28 -08:00
Ivan Lozano
fda9a6f38e Add support for AArch64 XOM binaries.
Adds build system support for generating AArch64 binaries with
execute-only memory layouts via a new LOCAL_XOM property. Also adds
support for an ENABLE_XOM build flag for global builds.

Bug: 77958880
Test: make -j ENABLE_XOM=true
Change-Id: I6af9e3615d0a9fdff802eae50e6ad94311ec8046
2018-11-21 09:05:08 -08:00
Yi Kong
f41d24acb3 Merge changes I52805f5d,Ifb16ed87
* changes:
  Allow projects to exclude from libcrt_builtins
  Move libgcc to libcrt.builtins
2018-11-13 21:56:47 +00:00
Jaewoong Jung
e8cb1954bb Add -CROSS suffix to cross host OS notice targets.
This fixes a bug where cross host OS notice dependecies were incorrectly
added and caused missing file errors.

Bug: 36073965
Test: Manual build + inspection
Change-Id: I3983ad6158acf939842f836fe3f44cecf9187087
2018-11-08 16:53:02 -08:00
Yi Kong
95fd9d171d Move libgcc to libcrt.builtins
libgcc is kept behind libcrt.builtins to provide unwinder symbols and
any other missing symbols.

Bug: 29275768
Bug: 119007754
Test: m checkbuild
Change-Id: Ifb16ed87afc3391f8830d771971315515f929235
Merged-In: Ifb16ed87afc3391f8830d771971315515f929235
(cherry picked from commit b9d8932279)
2018-11-08 13:40:34 -08:00
Dan Willemsen
7a5c5d730f Update for flags passed from Soong
Obsolete more GCC-specific flags, TARGET_(arm|thumb)_CFLAGS now contains
pre-filtered clang flags, and GLOBAL_CLANG_CFLAGS_NO_OVERRIDE now
contains all flags instead of just the clang additional flags.

Test: m
Change-Id: I068f155041e681068d38e1a5b6b04d354b85ccee
2018-10-07 19:43:23 -07:00
Chih-Hung Hsieh
1d9f04ff53 Strip spaces in my_tidy_flags.
Test: make with WITH_TIDY=1 DEFAULT_TIDY_HEADER_DIRS="d1/d2|external/*"
Bug: 32668284
Change-Id: I7443210444d65d7e31b91b312bc518e40167305d
2018-09-21 10:30:31 -07:00
Colin Cross
a70669e4a5 Merge "Don't set -pie for windows modules" 2018-09-20 00:00:42 +00:00
Colin Cross
feb4a7e4ae Don't set -pie for windows modules
Adding -pie to LOCAL_LDFLAGS for host linking leaves it around
when doing the host cross Windows linking, resulting in a warning:
clang-7: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]

Add it later in binary.mk after the flags have been copied to the
single-use my_ldflags.

Bug: 115776263
Test: m checkbuild
Change-Id: I70d71fa1ec6445631dc7e89ef61927a3304375e2
2018-09-19 15:18:17 -07:00
Dan Willemsen
8cf6b65445 Remove *_OUT_INTERMEDIATE_LIBRARIES
Always use the exact libraries like Soong does instead.

Test: m
Change-Id: Ifd48020073dd045247f76f84627c497e94562286
2018-09-15 10:52:13 -07:00
Treehugger Robot
007f27aa4a Merge "fix: linktype for recovery modules in ASAN build is native:platform" 2018-09-12 23:54:48 +00:00
Jiyong Park
a52b6e9ba8 fix: linktype for recovery modules in ASAN build is native:platform
When ASAN is on, recovery modules are instaled to
$(OUT_DIR)/target/product/.../data/asan/recovery/root. However, since
this is not under $(TARGET_RECOVERY_OUT), their linktype is incorrectly
determined as native:platform, instead of native:recovery.

To fix this, use get_non_asan_path to have consistent paths when
determining the linktype.

Bug: 115361480
Test: m -j; SANITIZE_TARGET=address m -j

Change-Id: I75edb1fe193d8a1a8099d4f5cf498910ca868d38
2018-09-12 10:05:58 +09:00
Colin Cross
8fb525db71 Add soong_cc_prebuilt.mk
Add soong_cc_prebuilt.mk for Soong modules to use so they can avoid
going through all of prebuilt_internal.mk, dynamic_binary.mk and
binary.mk.  Also moves stripping support into Soong.

Relands I8b37dda2b449b6b5d48d5b983f43de452f494a1e with fixes for
builds with GENERATE_BREAKPAD_SYMBOLS=true

Bug: 113936524
Test: m checkbuild
Change-Id: Id41cd76ccb1b5bb6ac43b41ae3e8f1ce46d7ad7e
2018-09-10 14:46:52 -07:00
Colin Cross
635733b816 Revert "Add soong_cc_prebuilt.mk"
This reverts commit 1bb943b97c.

Reason for revert: broke mac builds
Bug: 113936524

Change-Id: I5b3d8eb1314eb322a5f9c578623ac89e2ad25706
2018-09-10 21:35:55 +00:00
Colin Cross
1bb943b97c Add soong_cc_prebuilt.mk
Add soong_cc_prebuilt.mk for Soong modules to use so they can avoid
going through all of prebuilt_internal.mk, dynamic_binary.mk and
binary.mk.  Also moves stripping support into Soong.

Bug: 113936524
Test: m checkbuild
Change-Id: I8b37dda2b449b6b5d48d5b983f43de452f494a1e
2018-09-10 11:04:05 -07:00
Dan Willemsen
f063839de9 Remove GCC support from Make
Test: out/build-aosp_arm64.ninja is the same before/after
Test: build_test on downstream branches
Change-Id: If7f8c12f2f288b1e589689361f9457acae634882
2018-09-06 15:40:00 -07:00
Chih-hung Hsieh
385ba5c434 Merge "Filter out unknown arguments with clang-tidy.sh." 2018-08-28 18:18:32 +00:00
Chih-Hung Hsieh
be5dd2023e Filter out unknown arguments with clang-tidy.sh.
* Call clang-tidy.sh defined in PATH_TO_CLANG_TIDY_SHELL.
* Add dependency to clang-tidy and clang-tidy.sh.

Bug: 110538415
Test: build with WITH_TIDY=1
Change-Id: I90175ea1489272d8d4fc0f9ba4e5bbfdc7399d82
2018-08-28 09:45:39 -07:00
Jiyong Park
5dc3475d5d Native modules installed to recovery are marked as native:recovery
This fixes a bug that platform module (native:platform) can link to a
recovery module due to the fact that the recovery module is also labeled
as native:platform. Fixing the bug by setting the link type correctly to
native:recovery.

Bug: 113277544
Test: m -j

Change-Id: I88fe0a9d958f2269cf9f9ebc205b2da8c6a761a5
2018-08-28 13:51:52 +09:00
Treehugger Robot
36ea50d760 Merge "Add "hwaddress" sanitizer." 2018-08-20 23:22:35 +00:00
Evgenii Stepanov
8841a7f681 Add "hwaddress" sanitizer.
Build/make support for "hwaddress".

* HWASan supports static binaries, unlike ASan.
* It will be used to build libc. Since static libraries get a .hwasan
  suffix in soong, the logic that moves libc-and-friends to the end
  of the link command line has to be updated.

Bug: 112438058
Test: manual, part of a bigger patch set

Change-Id: I3b52336841012622771a88ba161916bc33071dfe
2018-08-20 14:59:36 -07:00
Yu Shan
10be65dbc1 Use prebuilt nanopb_generator.py.
Use prebuilt nanopb_generator.py to avoid using the incompatible
version of libprotobuf-python on host.

Test: Local build tests.
Bug: 111798740
Change-Id: Iabca07eb13dbab183fbf85cb0dfe04ce33aa660c
(cherry picked from commit fa47daa47d)
2018-08-16 16:07:05 -07:00
Colin Cross
a113745d1f Track more static dependencies for notice files
Track transitive static dependencies of native binaries, and
and direct and transitive static dependencies of java and app
modules.

Bug: 112331930
Test: m checkbuild
Change-Id: I0e19971033d6254bfbb6555f0e68fd5e529569c6
Merged-In: I0e19971033d6254bfbb6555f0e68fd5e529569c6
(cherry picked from commit 579668b122)
2018-08-16 22:44:27 +00:00
Colin Cross
579668b122 Track more static dependencies for notice files
Track transitive static dependencies of native binaries, and
and direct and transitive static dependencies of java and app
modules.

Bug: 112331930
Test: m checkbuild
Change-Id: I0e19971033d6254bfbb6555f0e68fd5e529569c6
2018-08-14 15:39:32 -07:00
Dan Willemsen
e303480584 Remove LOCAL_CLANG := false support
Only clang is supported now.

Test: build/soong/build_test.bash in all downstream branches
Change-Id: Ie8ad009625ddd7d5c38a6276b631bc889974fda3
2018-07-24 04:44:09 +00:00
Dan Willemsen
62db0f0945 Deprecate implicit make rules
Test: mm
Test: view docs in gitiles
Change-Id: I1ced4b4218c733b5b5b771d626b20eb6fb22f0df
2018-06-20 16:52:10 -07:00
Yi Kong
0047dbed14 Fix CLANG_EXTERNAL_CFLAGS logic
Should be neq instead of eq.

Test: build-full.ninja is now correct
Change-Id: I26c0aa84d9b54a8b19f19124978ac1d49bae7448
2018-06-12 15:49:12 -07:00
Yi Kong
42e18966e2 Add external projects only CFlags option
Apply the flags to Android.mk projects as well.

Test: m checkbuild
Change-Id: Ia5f7f7d9d518820fc825dcf19e8fdd2c434e9013
2018-06-06 16:42:22 -07:00
Chih-Hung Hsieh
289e8d6011 Call lld with --pack-dyn-relocs=none if my_pack_module_relocations is false
* Factor out the logic that sets up my_pack_module_relocations
  from dynamic_binary.mk to pack_dyn_relocs_setup.mk.
* Use stand-alone relocation_packer only if my_pack_module_relocations
  is true and my_use_clang_lld is false.

Bug: 80093890
Bug: 73768157
Test: build and boot with USE_CLANG_LLD=true
Change-Id: I7c4b5fcdce0754c57cff4acf86185cac65a26c40
2018-05-31 16:18:22 -07:00
Colin Cross
e2f541bb9f Pass 0 to llvm-rs-cc for current
Apparently empty PRIVATE_RS_TARGET_API is not the same as current,
pass 0 explicitly.

Test: forrest ub-renderscript-test
Change-Id: I8b2001b12161f07c404f78f63a80d82dffa1075f
2018-05-16 09:57:10 -07:00
Colin Cross
532ae3bcfb Support LOCAL_RENDERSCRIPT_TARGET_API := current
Renderscript was using LOCAL_RENDERSCRIPT_TARGET_API := 0 to mean
current.  Use current instead, and check for it when comparing
if LOCAL_RENDERSCRIPT_TARGET_API >= 21.

Fixes an issue where LOCAL_RENDERSCRIPT_TARGET_API := 0 was being
treated as < 21, causing the renderscript resources to be passed
to aapt2:
out/target/common/obj/APPS/RSTestBackward_intermediates/flat-res/zip_res.flata.contents/raw/bc32: error: resource file cannot be a directory.

Bug: 79481102
Test: m java FORCE_AAPT2=true
Change-Id: I7726d0463ce1693bc9653b4d869ced181c491036
2018-05-15 15:28:22 -07:00
George Burgess IV
432899a25b Disable dtor inlining for clang-tidy
LLVM r328258 turned on a feature called temporary dtor inlining by
default for all of C++ in clang-tidy. This feature appears to be
somewhat over-aggressive when objects are being passed by value. For
example, given:

void foo(std::unique_ptr<int> i);

void bar() {
  auto x = std::make_unique<int>();
  int *i = x.get();
  foo(std::move(x));
  *i = 99;
}

...clang-tidy will complain about `*i = 99;` being a definite
use-after-free. This is incorrect, however: `foo` could stash the
`unique_ptr` it's given in a global, or a class member, or ...

Until upstream fixes this bug, it's probably best to keep this disabled.

Bug: None
Test: Ran the analyzer across Android locally. Nothing broke; number of
complaints dropped significantly.

Change-Id: I742eedf598a72a533285d913d191bfbbf0ce1688
2018-05-14 15:48:38 -07:00
Chih-Hung Hsieh
4955b857c4 When my_use_clang_lld, link with lld for host.
When USE_CLANG_LLD is true, my_use_clang_lld is true,
and *GLOBAL_LLDFLAGS will be used instead of *GLOBAL_LDFLAGS.

Bug: 73768157
Test: make checkbuild
Change-Id: I2598b72e9edde32f8e57df860571fd107c005540
2018-04-17 15:30:24 -07:00
Chih-Hung Hsieh
32427d6903 Add USE_CLANG_LLD and LOCAL_USE_CLANG_LLD
* Current default is not using lld.
* When USE_CLANG_LLD or LOCAL_USE_CLANG_LLD is true or 1,
  * Use *GLOBAL_LLDFLAGS instead of *GLOBAL_LDFLAGS.
    GLOBAL_LLDFLAGS should call lld and with correct lld flags.
  * set my_pack_module_relocations to false.

Bug: 73768157
Test: make checkbuild
Change-Id: I3e63cf8ae0865d01d2bc1f36e9304f4a5d092cb8
2018-04-12 11:00:06 -07:00
Jiyong Park
379ae9274e Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.

However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).

This change allows platform modules to link to vendor public libraries.
When the name of a vendor public libraries (whose stub is defined via
vendor_public_library in Android.bp) is listed in
LOCAL_SHARED_LIBRARIES, it is actually linked to the stub library which
is available to platform modules.

Bug: 74275385
Test: m -j
Merged-In: I063b43431196190b59332b1bcad59f267073f89f
Change-Id: I063b43431196190b59332b1bcad59f267073f89f
(cherry picked from commit c3f1356a3a)
2018-03-30 12:59:34 +09:00
Jiyong Park
c3f1356a3a Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.

However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).

This change allows platform modules to link to vendor public libraries.
When the name of a vendor public libraries (whose stub is defined via
vendor_public_library in Android.bp) is listed in
LOCAL_SHARED_LIBRARIES, it is actually linked to the stub library which
is available to platform modules.

Bug: 74275385
Test: m -j
Change-Id: I063b43431196190b59332b1bcad59f267073f89f
2018-03-30 10:12:30 +09:00
Justin Yun
05c62fc0f4 Set __ANDROID_API__ for vendor binaries to vndk version.
When building vendor modules with BOARD_VNDK_VERSION=current, the
API of the vendor modules will be current PLATFORM_VNDK_VERSION.
__ANDROID_API_FUTURE__ will be used as before if the version is a
CODENAME.

If BOARD_VNDK_VERSION is not "current", that means the VNDK version
of the vendor modules is BOARD_VNDK_VERSION.

Bug: 74833244
Test: Build and check boot.
Change-Id: Iccc603f1b5ffa066e74ba1357f3fbbcc13c58f76
Merged-In: Iccc603f1b5ffa066e74ba1357f3fbbcc13c58f76
(cherry picked from commit 65c680e285)
2018-03-28 23:03:22 +00:00
Justin Yun
65c680e285 Set __ANDROID_API__ for vendor binaries to vndk version.
When building vendor modules with BOARD_VNDK_VERSION=current, the
API of the vendor modules will be current PLATFORM_VNDK_VERSION.
__ANDROID_API_FUTURE__ will be used as before if the version is a
CODENAME.

If BOARD_VNDK_VERSION is not "current", that means the VNDK version
of the vendor modules is BOARD_VNDK_VERSION.

Bug: 74833244
Test: Build and check boot.
Change-Id: Iccc603f1b5ffa066e74ba1357f3fbbcc13c58f76
2018-03-27 08:22:11 +09:00
Elliott Hughes
1d7d1eb65e Merge "Use the platform -std= for LOCAL_SDK_VERSION targets too." 2018-02-20 15:27:54 +00:00
Elliott Hughes
adf7ef8eb9 Use the platform -std= for LOCAL_SDK_VERSION targets too.
Bug: http://b/72571399
Test: builds
Change-Id: Ifd06798a7c9af9fd316201d88b724a53bcf0bcd9
2018-02-16 17:12:21 -08:00
Chih-Hung Hsieh
7ed0db8d1d Remove core/clang/versions.mk and scan-build wrapper
* Use the definitions of ClangDefaultBase and ClangDefaultVersion
  in build/soong/cc/config/global.go.
* scan-build is too old;
  replaced by better clang-tidy's -clang-analyzer-* checks.
* WITH_STATIC_ANALYZER is still effective
  to invoke ccc-analyzer or c++-analyzer.

Test: make checkbuild
Change-Id: Ifd159dd28e529d5d3c9807f5e391911365da8cdb
2018-02-15 13:38:50 -08:00
Stephen Hines
178cf8e4d4 Remove unnecessary USE_CLANG_PLATFORM_BUILD.
This build variable is unnecessary now that GCC is completely
unsupported for Android platform builds.

Bug: http://b/64032869
Test: Builds
Change-Id: I9d44ebd7129cb2bdfbb26d37922db19c6fb9efc9
2018-01-11 14:29:23 -08:00
Dan Albert
19fbd1ce39 Remove support for stlport.
Test: make checkbuild
Bug: None
Change-Id: Iaaaecbe2608fe7a880236f3bbad0fcfcf62b5096
2018-01-05 11:49:43 -08:00
Dan Albert
94f95cf504 Remove support for gnustl.
Test: make checkbuild
Bug: None
Change-Id: Iaddd40b32f84395a76efaaa74be38770085617d5
2018-01-05 11:49:43 -08:00
Dan Albert
4297c39e75 Also restrict NDK linking by static/shared STL.
Test: make checkbuild
Bug: None
Change-Id: I0eb29ec483c069d1c12f444fd2e94cc6eb320f93
2018-01-05 11:49:43 -08:00
Dan Albert
975e303ad2 Restrict NDK link type to matching STLs.
Test: make native
Bug: None
Change-Id: Ie9d9107fe0eeb425843ae2db197e1c60d14a59ca
2018-01-04 12:51:34 -08:00
Chih-Hung Hsieh
4d31b9da8c Call clang-tidy with -fno-caret-diagnostics by default.
* clang -fno-caret-diagnostics
  suppresses warning source lines, carets, and
  the stats line of "n warnings generated"
* clang-tidy -extra-arg-before=-fno-caret-diagnotics
  only suppresses the "n warnings generated" line.
* Pass this flag and -quiet to clang-tidy when
  WITH_TIDY is not 1 or true.
* Remove redundant quotation marks around -extra-arg-before.

Bug: 69051430
Test: normal build and build with WITH_TIDY=1

Change-Id: I9021ee315edc977c15dda6ab246a00182f31fad1
2018-01-04 01:31:37 -08:00
Treehugger Robot
6663c8476a Merge "Depend on the more specific ndk timestamp." 2017-12-16 03:14:43 +00:00
Treehugger Robot
305d2abb27 Merge "Call clang-tidy with -quiet unless WITH_TIDY is set." 2017-12-16 01:53:44 +00:00