Previous solution by using objcopy uses a quirky behaviour of the GNU
objcopy and there is no equivalent option in llvm-objcopy.
Instead of removing symbols, extract and repack libgcc to only include
required objects.
Bug: 142585047
Test: presubmit
Change-Id: I58af74c18838f797e481da38c3265f0624fddf99
Remove the distinction between pctx.StaticRule and
pctx.AndroidStaticRule so that all of the local rules correctly
get assigned to the localPool. Also put Module and Singleton
rules into the localPool.
Test: compare out/soong/build.ninja
Change-Id: Id2bb38eff3c7209340fe55bc9006f00bd3661d81
Android builds by default put artifacts into out/ subdirectory of
the source tree, causing the extractor to record their names as
relative. The indexer considers such files as sources, which is wrong.
Fortunately, the extractor can be fed a set of filename rewriting
rules (see build/tools/vnames.json).
Also, undo previous unsuccessful attempt use to absolute path for the
output directory to distinguish between source code and artifacts.
Bug: 141385476
Test: run the build, inspect compilation units of the kzip file
Change-Id: I89ec3aed8fd14f43ea6e0b226d54f643346f6125
The P flag is supported as of llvm r354044, add back the flag to reduce
the size of intermediate archieve files. This does not affect the final
binaries.
Test: built
Bug: 71618641
Change-Id: I017780e4dcaa31c7fbe10b5e7482db1bba83e716
Usually, ".S" files are processes with the c preprocessor, and ".s"
files are not, so they don't have any dependency information, since it
is generated by the preprocessor.
But with the -xassembler-with-cpp flag, ".s" files are processed with
the preprocessor, so we should ask for dependency information from them.
Test: NINJA_ARGS="-t deps out/soong/.intermediates/external/sonivox/arm-wt-22k/libsonivox/android_arm_armv7-a-neon_core_static/obj/external/sonivox/arm-wt-22k/lib_src/ARM-E_filter_gnu.o" m
Test: treehugger
Change-Id: Iee7baeebc2b205b5a2f33e7c1705ea4a5b4fc95a
* changes:
Introduce inject_bssl_hash library property.
BoringSSL FIPS build - introduce extraLibFlags and use for STL libs.
Allow linker scripts when building objects.
Allow .o files as srcs.
Rationale: On non-bionic, stl.go currently adds system libraries to
ldFlags, this causes problems for partialLd rules. However adding the
same libraries to libFlags breaks some existing modules due to symbol
conflicts as the system libraries are linked before some module code.
Introduced a general mechanism for adding libraries to be linked
last rather than making this STL-specific.
Bug: 134581881
Bug: 137267623
Test: TH
Change-Id: I779f28c6586b3fea85cc6299b686e4fde95262d3
We've been getting these dependencies transitively through the
dependency on the object itself (which is a workaround for the lack of
dep file support in these tools). But for remote builds to work, we need
to know about these dependencies like any other object compilation.
For regular builds, this increases the size of the ninja file by a few
tens of megabytes (~1-2%).
WITH_TIDY builds were already larger (~40-50%), but are now about 90%
larger than a normal build.
Test: treehugger
Change-Id: Icdb4ca3d4d08d5706593d96d5c627149fa14fed8
This commit adds tags, such as NDK, VNDK-core, and PLATFORM, to
LSDUMP_PATHS. The script updating the reference ABI dumps uses the tags
to determine the directories where the dumps should be created.
Test: make findlsdumps
Bug: 133176785
Change-Id: I8540286238cf0ec55c65e1c4f60cb9c12e5e57a1
Use Kythe (https://kythe.io) to build cross reference for the Android
source code. ~generate the input for it during the build. This is done
on demand: if XREF_CORPUS environment variable is set, build emits a
Ninja rule to generate Kythe input for each compilation rule. It
also emits two consolidation rules (`xref_cxx` and `xref_java`),
that depend on all Kythe input generation rules for C++ and Java.
The value of the XREF_CORPUS environment variable is recorded in the
generated files and thus passed to Kythe. For the AOSP master branch it is
`android.googlesource.com/platform/superproject`, so the command to build
all input for Kythe on that branch is:
```
XREF_CORPUS=android.googlesource.com/platform/superproject m xref_cxx xref_java
```
Each Kythe input generation rule generates a single file with .kzip
extension. Individual .kzip files have a lot of common information, so
there will be a post-build consolidation step run to combine them.
The consolidated .kzip file is then passed to Kythe backend.
The tools to generate .kzip files are provided by Kythe (it calls them
'extractors'). We are going to build them in toolbuilding branches
(clang-tools and build-tools) and check them in as binaries into master
and other PDK branches:
For C++, `prebuilts/clang-tools/linux-x86/bin/cxx_extractor`
for Java, `prebuilts/build-tools/common/framework/javac_extractor.jar`
Bug: 121267023
Test: 1) When XREF_CORPUS is set, build generates Ninja rules to create
.kzip files; 2) When XREF_CORPUS is set, building
`xref_cxx`/`xref_java` creates .kzip files; 3) Unless XREF_CORPUS is
set, build generates the same Ninja rules as before
Change-Id: If957b35d7abc82dbfbb3665980e7c34afe7c789e
Clang will soon start using relocations that are currently unsupported by
the version of ld.bfd that Android uses when HWASAN is enabled. This will
cause partialLd to fail since the clang driver defaults to ld.bfd.
Switch to using LLD, since it will support those relocations.
Change-Id: I0964f53dc63773f3b52bb377f863df9c39961a07
This reverts commit 6d8c0a50bc.
The switchover to lld appears to be making adb crash on exit for unclear
reasons. Revert it as a quick fix pending further investigation.
Bug: http://b/134613180
Test: adb.exe under windbg
Change-Id: Ibdf5981c3c6828b3684974b7c30a7c96449c64c5
Failures in strip.sh are still occurring with darwinStripPool set to
10, try 5.
Bug: 132822437
Test: none
Change-Id: I2df247c89b6d8f6e741d4e17057b06ff9ec72b40
New strip option named keep_symbols_and_debug_frame, that will keep the
symbols and the .debug_frame. This is meant for use by libc.so only on
arm32. Other libraries might want to use it to keep better unwinding
information on device.
Bug: 132992102
Test: Built libc.so with this option and verified that it contains
Test: the .debug_frame section.
Change-Id: I823a28199dec8316e8b26fe31ff9f17e6b11d406
strip.sh can use a file descriptor per .o file when run on .a files,
which can hit the system file descriptor limit on darwin. This
causes failures when manay variants of libgcc_stripped are built
simultaneously. Put all strip rules on darwin into a pool that
limits them to 10 concurrent processes, which will limit the file
descriptor usage to ~7500.
Fixes: 132822437
Test: no mention of darwinStripPool in out/soong/build.ninja on linux
Test: m libgcc_stripped on darwin
Change-Id: I3d4fbbd8d44d2e9059a79df113ab95336ec2c658
We use libgcc as fallback for symbols not present in libclang_rt
builtins, however we didn't know what exact symbols were being used,
some may not be intended to fallback.
Create libgcc_stripped, which only contains unwind symbols from libgcc.
Bug: 29275768
Test: bionic-unit-tests
Change-Id: I5b349fa6138e51663bf3b67109b880b4356da8e8
This reverts commit 61166dc047.
One difference from the earlier change is that import libraries are now
using the '.lib' extension instead of '.a' to prevent clash with
AdbWinApi.a.
Bug: http://b/110800681
The following flags that the binutils linkers support are not
available in lld for Windows:
-soname
--no-undefined
-rpath
Windows also uses "import libraries", which are stub libraries used only
for linking. The binutils linkers accepted a DLL and treated them as an
import library. But lld issues the following error:
lld-link: error: ...DLL: bad file type. Did you specify a DLL instead
of an import library?
To resolve this, pass '-out-implib=libFoo.lib' to lld when linking
libFoo.dll to get lld to generate an import library. Add libFoo.lib as
an implicit output to the 'ld' build rule.
Rewrite the shared libraries when building a library/binary to use the
import library instead of the DLL. As a side-effect, this also uses the
newly-created AdbWinApi.lib that's alongside
development/host/windows/prebuilt/usb/AdbWinApi.dll
Test: Run Windows tests (go/android-llvm-windows-testing) and check
absence of regressions. Also check that the following commands pass:
$ adb.exe devices
$ fastboot.exe devices
Change-Id: I34e07d345e0207086ac8e8ea12525d8c322b20fd
So that <module>/gen/yacc/... is (re)created by a single rule, previous
files are removed, and location.hh is in the build graph when it is
produced.
Test: treehugger
Change-Id: I2f6e47ea07f315e10ae1cb8ad50697e7123d0285
This commit add `--llndk` to the command line option for
`create_reference_dumps.py` as well.
Bug: 124620774
Bug: 130324828
Test: lunch aosp_arm64-userdebug && make
Change-Id: I117864209b8cf8c934fd3aa1086b7691c1c449e3
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: I770b2fec4ac44f265ff31731c9c0bd4da14d5b0f
Add a proto.plugin property to allow specifying a custom protoc
plugin to generate the code.
Fixes: 70706119
Test: m am StreamingProtoTest
Change-Id: I1ecdd346284b42bbcc8297019d98d2cd564eb94c
Using blueprint.Rule for protoc commands was causing code duplication
because there was no good way to run the same protoc for cc, java and
python but then run custom source packaging steps for java and python.
Move most of the code into a common function that returns a
RuleBuilder, and then let java and python add their own commands at
the end of the rule.
Bug: 70706119
Test: All Soong tests
Test: m checkbuild
Change-Id: Ic692136775d273bcc4f4de99620ab4878667c83a
clang -Wl,--out-implib doesn't update its output file if it hasn't
changed, always restat the outputs.
Fixes: 129553377
Test: m checkbuild && m checkbuild
Change-Id: I2cb19e1b8280fd69c8a9b2143f55760ec05630f8
Bug: http://b/110800681
The following flags that the binutils linkers support are not available
in lld for Windows:
-soname
--no-undefined
-rpath
Windows also uses "import libraries", which are stub libraries used only
for linking. The binutils linkers accepted a DLL and treated them as an
import library. But lld issues the following error:
lld-link: error: ...DLL: bad file type. Did you specify a DLL instead
of an import library?
To resolve this, pass '-out-implib=libFoo.a' to lld when linking
libFoo.dll. Add libFoo.a as an implicit output to the 'ld' build rule.
Rewrite the shared libraries for a library/binary to use the import
library instead of the DLL. As a side-effect, this also (correctly)
uses the AdbWinApi.a that's alongside
development/host/windows/prebuilt/usb/AdbWinApi.dll
Test: Run Windows tests (go/android-llvm-windows-testing) and check
absence of regressions.
Change-Id: I15a178589aa6882caa6e7e38650cc6ef48109764
This commands adds `--llndk` to `create_reference_dump.py` command if
the module with incompatible ABI changes is an LLNDK or a NDK lib. This
prevents people from uploading a CL that simply removes ABI dumps (the
result even when the uploader runs the command).
Bug: 124620774
Test: Make an incompatible ABI changes in libaaudio and see the flag.
Change-Id: I9f07f879193bd4d73f5924baff298d28d6fe1506
... except for Darwin Mach-O, as it is not supported by llvm-strip.
Test: m checkbuild
Bug: 119221035
Change-Id: I021637b6dd3530bff1f563f2ec7c2168e1083b7e
This commit adds a header_abi_checker section so that the library owner
can have a fine-grained control over the ABIs that must be checked.
For example, a library "libexample" may have following configurations:
cc_library {
name: "libexample",
header_abi_checker: {
symbol_file: "libexample.map.txt",
exclude_symbol_versions: ["LIBEXAMPLE_PRIVATE"],
exclude_symbol_tags: ["platform", "apex"],
},
}
Bug: 122845490
Test: Add header_abi_checker to libc to filter out LIBC_PRIVATE
Change-Id: I60cfea868f815afe6213c242ed0ca818161d55c6
This commit fixes a typo related to abidiffs. The generated abidiffs
should be copied to `$$DIST_DIR/abidiffs` instead of
`$$DIST_DIR/abidiff`.
(See also. https://android-review.googlesource.com/796458/)
Bug: 123491909
Test: lunch aosp_x86-userdebug && make dist
Change-Id: I89c13580344a27cac5ea0d00497f5bba3227cf61
.s files (unlike .S files) aren't run through the preprocessor, so -M*
doesn't actually write out a depfile.
Since our ninja is now going to be verifying that the depfile is created
(https://android-review.googlesource.com/861510), don't specify a
depfile for .s files.
Bug: 121058584
Test: apply https://android-review.googlesource.com/861510
Test: cd external/libavc; mma
Change-Id: I1697aa020c63639317c8f4771147026601ae72fc
llvm-ar takes a --plugin argument but it is ignored for compatibility,
so passing it has no effect.
Change-Id: I4fc51d226d66cf2a43462d3d4ccc12e6e5ebb226
We're only using it to distribute files in case of failure, which isn't
well supported currently, but can be handled for now by using the
DIST_DIR environment variable during the command execution.
This was at least one cause that we'd be re-running Soong during every
build server build, as the DIST_DIR values are unique.
Test: m dist
Change-Id: Ibd5e6b6c46695350de80b745bfb6a6aa685033a0
This commit switches the include path of header-abi-dumper clang headers
to `prebuilts/clang-tools/${os}-x86/clang-headers`. This decouples the
cross git repositories dependencies.
Bug: 111579848
Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py
Change-Id: I53083298ca7be39b3fbaffb123146c12c189e7c3
Clang is always used now, so we can remove all the GCC checks. Removing
GCC-specific configuration will happen in the next CL.
Test: m
Change-Id: I4835ecf6062159315d0dfb07b098e60bff033a8a
Instead, hardcode the ~dozen paths into build/soong/Android.bp, which
will unblock removing more GCC support.
Bug: 114286031
Test: m
Change-Id: I2508432e00b1469141f01e667f3c6a2fe30cd805
* 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