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
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
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
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
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>
See the Changes.md addition for more details.
Test: treehugger (build_test on downstream branches)
Change-Id: I6ad6b454a6fccf93772fda26cfc7dd6bbfc07c40
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
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
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
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
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
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
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
Bug: http://b/119086751https://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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
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
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
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
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
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
* 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
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
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
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)
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)
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
* 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
Apparently empty PRIVATE_RS_TARGET_API is not the same as current,
pass 0 explicitly.
Test: forrest ub-renderscript-test
Change-Id: I8b2001b12161f07c404f78f63a80d82dffa1075f
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
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
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
* 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
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)
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
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)
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
* 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
This build variable is unnecessary now that GCC is completely
unsupported for Android platform builds.
Bug: http://b/64032869
Test: Builds
Change-Id: I9d44ebd7129cb2bdfbb26d37922db19c6fb9efc9
* 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