* PATH_TO_CLANG_TIDY_SHELL is ${config.ClangTidyShellPath},
wich is "build/soong/scripts/clang-tidy.sh"
Bug: 110538415
Test: build with WITH_TIDY=1
Change-Id: I27d7be095c998583fa9ad4d705aa1332bd018140
* C++ source files could be compiled with "-fwhole-program-vtables"
in cppflags. We need to filter out those flto dependent flags
in flags.CppFlags and use flags.toolingCppFlags instead of
flags.cppFlags.
Test: build with WITH_TIDY=1
Change-Id: Ic2b0f99b95a5f0422f879226e6f6060cab71456a
* Some flags are accepted by clang but not clang-tidy.
They could cause the diagnostic-unused-command-line-argument warning.
Flag -flto messed up the -I flags.
* Add clang-diagnostic-unused-command-line-argument to
default clang-tidy checks.
* Move CLANG_TIDY_UNKNOWN_CFLAGS to build/make/core/clang/tidy.mk.
Bug: 111850071
Bug: 111885396
Test: build with WITH_TIDY=1
Change-Id: Iabeeb27715acf83ef6aafe3e77206b9a01a0d889
* Pass LLVM_{OBJCOPY,STRIP} to makefile rules.
* strip.sh is used only in soong-only mode.
It will use llvm-strip and and llvm-objcopy
when --use-llvm-strip is given.
Keep flags of strip.sh in alphabetic order.
* Tested build/soong/scripts/build-ndk-prebuilts.sh
by adding "UseClangLld": true, to soong.variables file.
Bug: 80093681
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I612267304eea434c7a33cc086b27b577d5f64094
-check-all-apis currently, produces noise for some libraries
(eg:libstagefright_soft_vpxenc), so remove this till a good solution
arrives.
Bug: 79928919
Test: create abi reference for libstagefright_soft_vpxenc; m -j
libstagefright_soft_vpxenc.vendor; no warnings about struct LAYER_CONTEXT
layout changing.
Change-Id: I8f30700c1b619c72504ca9aef69075f6e334ba5f
This change is to let people to just copy & paste the update command
Test: break the ABI of libbinder intentionally and make.
The message includes absolute path to the create_reference_dump.py tool.
Change-Id: If7703d64be1f51ea4b054aa1e815276e1d6dbc14
When we're doing ABI diffing, we run something like:
(run-abi-diff) || (echo && exit 1)
When `dist` is added, we attempt to copy out the result:
(run-abi-diff) || (echo) && (copy && exit 1)
But this always fails, since it will always run exit 1. We really want
the parenthesis around the entire second section. This change switches
it to:
(run-abi-diff) || (echo && (copy) && exit 1)
This matches the behavior before Iae25374fe937a0cbe8a8ddf9e23c3bc1f62bbb2a
Test: treehugger on P
Change-Id: Ic39da4d4630ee950b811ec7854d55d65c52f8661
Test: create reference dump for libjpeg; add exported function to libjpeg;
m -j libjpeg.vendor, build fails with helpful message.
Test: create reference dump for libjpeg; add exported function to libjpeg;
m -j libjpeg.vendor dist DIST_DIR=dist, build fails with helpful message.
Change-Id: Iae25374fe937a0cbe8a8ddf9e23c3bc1f62bbb2a
* Suppress more noisy new warnings at global level.
* Add -no-pie to partial link .o files, with -r.
* Revert workaround of b/72706604, no need of
-Wl,-plugin-opt,-emulated-tls
* Filter out clang 7.0 unknown flag "-Wno-extended-offsetof"
Bug: 72706604
Bug: 72412006
Test: make checkbuild
Change-Id: I7ff45465c4bd771991f42b40f68dc35586045656
Instead of open-coding the logic of whether there is one, or where to
find it.
Test: diff out/soong/build.ninja without dist
Test: diff out/soong/build.ninja with dist specified
Change-Id: Ia3f1ef335e2d6e2175343338d04867d778a50300
So that the Path and similar functions can be used directly, without
manually adding something like configErrorWrapper (it just uses it all
the time now).
Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
Instead of whichever xz happens to be on the PATH.
Bug: 36130900
Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: Ic9b66062ca7947f0eca9d839c0864da492d4ef71
This is needed so that we can embed the paths of lsdump files in a file,
in order to make lookup faster, while creating reference dumps.
Test: mm -j64 in external/libjpeg-turbo for aosp_arm64_ab;
out/soong/make_vars-aosp_arm64_ab.mk contains
SOONG_LSDUMP_PATHS := <list of lsdump paths>
Change-Id: I04608429e1add307cc1ee79d2f0c348fb041613c
Historically, we've always passed '-I .' as the first argument to
protoc, essentially treating all proto file package names as their full
path in the android source tree. This would make sense in a monorepo
world, but it makes less sense when we're pulling in external projects
with established package names.
So keep the same default (for now), but allow individual builds to opt
into using local paths as the default names with
'canonical_path_from_root: false'. A cleanup effort and/or large scale
change in the future could change the default to false.
As part of this, run protoc once per input proto file, since the flags
may need to change per-file. We'll also need this in order to specify
--dependency_out in the future.
Bug: 70704330
Test: aosp/master build-aosp_arm.ninja is identical
Test: aosp/master soong/build.ninja has expected changes
Test: m
Test: Build protobuf test
Change-Id: I9d6de9fd630326bbcced1c62a4a7e9546429b0ce
LLVM-AR does not allow passing --plugin options more than once. The
--plugin ARFLAGS that lto want to add, may already exist if sanitizer is
also turned on.
Fixed this by adding a new bool Flags.ArGoldPlugin. Set this variable to
true whenever LLVM gold plugin is needed for ArFlags. In function
TransformObjToStaticLib(), add this option to arFlags using global value
${config.LLVMGoldPlugin} if the bool value is true.
Bug: http://b/73160350
Test: build the image with make and succeeded.
Change-Id: I62785829b0a4b663225926e4aed98defc1b6da2c
(cherry picked from commit 4917049f6e)
Bug: http://b/72343691
Change https://android-review.googlesource.com/c/572758, in addition to
dependencies from the compiler flags, also marked all exported
dependencies as implicit. This can cause lots of unnecessary
recompiles. This change moves exported dependencies back as order-only
dependencies.
Test: 1. mma in art after changing profile_compilation_info.h triggers
only a limited number of recompiles.
2. verify that changes to PGO profile files trigger recompiles.
Change-Id: Icb0f4cd2b6da0add3b6e5206661e6aa7a577602f
This commit adds `extends: "name"` property and provides basic support
to VNDK extensions. This is the simplest example:
```
cc_library {
name: "libvndk",
vendor_available: true,
vndk {
enabled: true,
},
}
cc_library {
name: "libvndk_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
}
```
A vndk extension library must extend an existing vndk library which has
`vendor_available: true`. These two libraries must have the same
`support_system_process` property.
VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.
If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.
Bug: 38340960
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_arm-userdebug && make -j8 # build a target w/o VNDK
Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.
Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.
Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.
Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
While diffing abi, for libraries which do not export headers, use
-advice-only.
Test: Create reference dump for libdl; mm -j64; header-abi-diff gets
invoked with '-advice-only'.
Test: Create reference dump for libjpeg; mm -j64; header-abi-diff gets
invoked without '-advice-only'.
Bug: 71768219
Change-Id: I678346081f15088388f223f1276d0b0c42d2a8c2
Version scripts were earlier used as a symbol map, primarily for llndk
libraries. Since they do have stub libraries which contain symbols, we
shall use them instead, to internally form symbol maps in
header-abi-linker.
Test: mm -j64 in bionic/libdl, header-abi-linker gets invoked with
-so <so-file> rather than -v <version-script>
Change-Id: Ifb67dc34457a997f37cc9f71ca16ad068e9b44c1
This properly sets -format=gnu for all non-Darwin targets, because
llvm-ar is cross-platform (but defaults to the host environment).
Bug: http://b/71618641
Test: m checkbuild
Change-Id: Ic5bce7e237ea0cadfa1f96ea151d41115d8c56b8
Bug: http://b/70820751
Bug: http://b/70857959
Clang does not output file dependencies from the -fprofile-use= flag
during -MD/-MM. Add this and other path dependencies as implicit Ninja
dependencies. Generated header dependencies are retained as OrderOnly
dependencies.
Test: Perturb profdata files for hwui/skia in internal branch and verify
that the sources get rebuilt.
Change-Id: I3247d995ee27a4882172eb15ff36acf56536b6f7
Bug: 64267858
Test: create reference abi dump for libjpeg locally. Change return type
of libjpeg_std_err and build with :
BOARD_VNDK_VERSION=current mm -j64 showcommands dist
Build fails and abidiff report gets copied into out/dist/abidiffs.
Change-Id: I7c8ecfac95361e731009e5913bd3a7bb323a9597
Convert abi warnings to errors by removing the -advice-only flag from
the invocation of header-abi-diff. This will only apply to branches with
reference abi dumps checked into prebuilts/abi-dumps/(v)ndk (since
abi-diffing will only be triggered on them.)
Also allow for:
1) Extensions.
2) Changes to types in exported headers, unreferenced by public symbols still
trigger warnings.
3) Any removal of symbols appearing in a shared library's .dynsym table, but not
in exported headers is still a warning.
Bug: 64267858
Test: make -j64 from ToT.
Change-Id: Iadeac8d060cb693d4310afb841dc48d91f38597d
Now that android.ModuleContext does not include blueprint.ModuleContext
we can rename android.ModuleContext.ModuleBuild to
android.ModuleContext.Build without colliding with
blueprint.ModuleContext.Build. Leave ModuleBuild as a wrapper around
Build for now to avoid having to update all the users outside
build/soong simultaneously.
Test: m checkbuild
Change-Id: I18eb8cc04faf002049a11d9aac97e9732ff5d638
This reverts commit 2370af0e23.
Reason for revert: New Build Breakage: aosp-master/aosp_arm64_ab-userdebug @ 4376965
Change-Id: Ibe4b819c4292457c454bf42e6d94fba3071ec04b
We've only got one user of this currently, but since it needs the
location of the toolchain, and different flags based on 32 vs 64-bit,
it's easier just to add support than to get this into a genrule.
Test: Convert external/mdnsresponder to Soong, build
Change-Id: I6c19a82bc14f6ab556f6cc5f37164862ba5f9083
header-abi-diff has switched to recursive diffing of types and can
diff more accurately if types included in re-exported shared library
headers are included as well.
Bug: 62060883
Test: make -j64, android.hardware.light@2.0.so.lsdump contains structs
from libcutils as well (libcutils' headers are re-exported by
android.hardware.light@2.0)
Change-Id: I814819e4f7258b4b380350fe8ad0ccf8dbd5ce5c
Whenever a symbol file is not available, header-abi-linker can look at
the symbols with STV_DEFAULT or STV_PROTECTED visibility for further abi
filtering.
Bug: 62463617
Bug: 62307940
Test: make -j64
Change-Id: I5dc618be104a49d47375d37cf78c4490b1529987
Add a list of flags which are not understood by clang LibTooling tools
and filter them out of the Cflags the tools are invoked with.
Test: In frameworks/av, make libmedia vendor_available (this invokes
header-abi-dumper on this module), mm -j64.
Bug: 62447349
Change-Id: I46f017212b89f4331145c999103d0ed44da0abaf
We now add export_static_lib_headers, export_generated_headers to the
filters while dumping the abi of a library using header-abi-dumper
(through -I<dir> additions to the invocation of header-abi-dumper and
header-abi-linker)
Also add support for zipped reference source based abi dumps.
Test: mm -j64 in hardware/interfaces/nfc/default/1.0 produces
android.hardware.nfc@1.0.so.lsdump with abi filtered out using generated
headers.
Test: Copied the linked abi dumps produced by mm -j64 in bionic/libc to
prebuilts/abi-dumps/ndk and gzipped them. Ran mm -j64 again in
bionic/libc and verified header-abi-diff getting invoked.
Bug: 32750600
Change-Id: I26210af908c87a6143e39fa25f50307acb68a387
Descriptions currently look like:
[ 0% 4/29328] cc out-soong/.intermediates/external/clang/lib/Sema/libclangSema/android_arm_armv7-a-neon_denver_static_core/obj/external/clang/lib/Sema/SemaCodeComplete.o
This is not very helpful - most of the characters are used to show the
output path, which contains useful information like target architecture,
but also contains most of the path to the source files twice, and less
useful information like the exact variant name used by soong.
Make the descriptions look like:
[ 0% 3/29329] //external/clang/lib/Sema:libclangSema clang++ SemaTemplateInstantiate.cpp
This is //path/to/module:modulename tool relative/path/to/source/file
Test: builds, looks pretty
Change-Id: I3087aa7d4eb1860ef6239d77407b8b35445616d7
Also fix ndk libraries are always re-building. Fix this by having the
build system know the report's file path. This will need to be changed
once we go off "advisory mode" to keep the report if builds fail on abi
breakages.
Bug: 37451651
Bug: 37450828
Test: mm -j64 in bionic/libc produces abi-dumps without warning:
argument unused during compilation: '-Wa,--noexecstack'
Test: cd system/core/init; mma -j; NINJA_ARGS="-d explain" mma -j; The
second mma does not show a dirty libc.so.
Change-Id: I824723fd9e76586831ee2278db0b61329b1475c0
header-abi-dumper: dumps abi exported by source files for Vndk.
header-abi-linker: links abi dumps produced by header-abi-dumper.
header-abi-diff: compares linked dumps.
Test: mm -j64 showcommands > make_log in bionic/libc.
This produced linked dumps in out/soong/.intermediates.
Copied these dumps to
prebuilts/abi-dumps/ndk/current/arm64/source-based/.
Changed the abi and re-ran mm -j64 showcommands > make_log
confirmed that the build reported compatibility breakge without
actually failing (advisory mode).
Change-Id: Iccad6908fe68a80f47230751671d156893b96ead
Include order should be module includes, dependency exported includes,
and then global includes. Module includes and global includes are
computed during compileFlags, but dependency exported includes are
not handled until later. Move the global includes into a new
flags variable so that the dependency includes can be appended
to the module includes.
Test: m -j native
Change-Id: Ifc3894f0a898a070d6da8eed4f4b9e8cc0cd2523
Sometimes it is confused that these variables are mixed with ninja
parameters when invoking pctx.AndroidStaticRule()/SourcePathVariable().
Test: m -j
Change-Id: Ibcf17eeed6ac79aafaa5edeec27427721b36e75a
Adds the ability to set custom flags for ar in Soong, similar to how
they can currently be set for make.
Bug: 36290748
Test: sanitize.go is able to correct set custom ar flags for CFI. CFI
enabled Soong components build and boot without issue.
Change-Id: I3212793aa84ba51df910c184d8bb376b3650376e
This is configured the same as make -- a global NATIVE_COVERAGE=true
flag to allow native coverage, then COVERAGE_PATHS=path1,path2,... to
turn it on for certain paths.
There are .gcnodir files exported to Make and saved in $OUT/coverage/...
files which are `ar` archives containing all of the compiler-produced
.gcno files for a particular executable / shared library.
Unlike the Make implementation, this only passes links the helper
library (automatically through --coverage) when one of the object files
or static libraries being used actually has coverage enabled.
Host support is currently disabled, since we set -nodefaultlibs, which
prevents libclang_rt.profile-*.a from being picked up automatically.
Bug: 32749731
Test: NATIVE_COVERAGE=true COVERAGE_PATHS=system/core/libcutils m -j libbacktrace libutils tombstoned
$OUT/coverage/system/lib*/libcutils.gcnodir looks correct (self)
$OUT/coverage/system/lib*/libbacktrace.gcnodir looks correct (static)
$OUT/coverage/system/lib*/libutils.gcnodir doesn't exist (shared)
$OUT/coverage/system/bin/tombstoned.gcnodir looks correct (executable)
Test: NATIVE_COVERAGE=true COVERAGE_PATHS=external/libcxxabi m -j libc++
Confirm that $OUT/coverage/system/lib*/libc++.gcnodir looks correct (whole_static_libs)
Change-Id: I48aaa0ba8d76e50e9c2d1151421c0c6dc8ed79a9