Add a missing toolchain method, don't require modules to opt in to
linux_bionic.
Bug: 31559095
Test: attempt to build host bionic
Change-Id: Ia5c8e2f127b88f56191b7abc389d5329cfdb0720
This breaks when two host OSes are enabled for example.
Bug: 31559095
Test: enable host bionic as a second Host OS, attempt a build
Test: treehugger
Change-Id: If52f77d7d3b0755d768028cbddda320303a69e65
When building with two OSes of the same class (Host, etc) enabled,
independently produce variants of each module for each OS, instead of
making `compile_multilib: "first"` select just one of the OSes.
My use case this is for Linux + LinuxBionic, which are both considered
Host class, but this would also applied if we wanted to generate rules
for Linux+Darwin, or some combination of firmware bits (either in
addition to Android in the Device Class, or multiple firmwares in a new
Class)
Bug: 31559095
Test: enable host bionic, see a linux(_glibc) and linux_bionic
definition for binaries
Change-Id: I55e7f046758b3dc2a31da2c4b20274ec68ece0a0
Proposal for adding SHT_RELR sections in the generic-abi is at
https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg
This CL requires clang-r328903.
The following test results are on clang-r339409.
Size comparison for "aosp_marlin-userdebug":
$ du -B1 -s {none,pack,relr,both}/out/target/product/marlin/system
1014616064 none/out/target/product/marlin/system
1001074688 pack/out/target/product/marlin/system
1004273664 relr/out/target/product/marlin/system
1000099840 both/out/target/product/marlin/system
none contains a build with no packing (--pack-dyn-relocs=none).
pack contains a build with current settings (--pack-dyn-relocs=android).
relr contains a build with relr packing only (--pack-dyn-relocs=relr).
both contains a build with both options enabled (--pack-dyn-relocs=android+relr).
With --pack-dyn-relocs=android+relr, lld will encode the relative
relocations in a SHT_ANDROID_RELR section, and pack the rest of
the dynamic relocations in a SHT_ANDROID_REL(A) section.
--pack-dyn-relocs=android was saving us 13,541,376 bytes (1.35%) (none - pack).
--pack-dyn-relocs=relr will save us 10,342,400 bytes (1.03%) (none - relr).
--pack-dyn-relocs=android+relr is saving us 14,516,224 bytes (1.45%) (none - both).
Size comparison for the "system/bin" directory:
$ du -B1 -s {none,pack,relr,both}/out/target/product/marlin/system/bin
29413376 none/out/target/product/marlin/system/bin
28319744 pack/out/target/product/marlin/system/bin
28258304 relr/out/target/product/marlin/system/bin
28180480 both/out/target/product/marlin/system/bin
--pack-dyn-relocs=android was saving us 1,093,632 bytes (3.72%) (none - pack).
--pack-dyn-relocs=relr will save us 1,155,072 bytes (3.93%) (none - relr).
--pack-dyn-relocs=android+relr is saving us 1,232,896 bytes (4.19%) (none - both).
Bug: None
Test: Built aosp_marlin-userdebug image, boots on device.
Test: Built aosp_x86_64-userdebug image, boots in emulator.
Change-Id: Ibb726c3b9d87688f387a7f2974fdae9bfc24efc9
This should always be true now. It will be a change for side branches
(build_tools, etc) that weren't setting UseClangLld in the
soong.variables file.
Test: treehugger
Change-Id: I9fd6157fda630bf8bb939677dbcb026f02685f19
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 removes flags from ClangLibToolingUnknownCflags. These
flags were added to workaround an old version of clang in
`external/clang`. Since we have updated to clang-r339409b, we don't
need these workaround anymore.
Bug: 117764794
Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py
Change-Id: Ifbeebf05df5c08ee3bb7d489f39250d8fd5f5acf
Scudo is now compatible with the -fsanitize-minimal-runtime, and offers a new
dynamic library that doesn't bundle UBSan.
This patch adds support for this new library in Soong, preferring it over the
full one, unless a UBSan or diagnostic dependency is found.
Test: aosp compiled with m -j
Test: local test enabling Scudo for tombstoned
Change-Id: I17794131db148b33f8a8710ac43302cadf1af314
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
ApexModule is the interface for APEX-aware modules. The module type apex
uses the interface to get APEX-specific information from other modules,
such as the list of APEXs that a module should be built for.
A module that is included in an APEX will be built specificaly for the
APEX. This is especially required for shared libraries; we shouldn't
just copy the artifacts built for platform, because they may be linking
against private (=unstable) symbols that are not available to APEXs
which are basically unbundled.
This CL, as a first step, makes cc.Module an APEX-aware module type.
Bug: 112672359
Test: m apex.test; the built apex has all the direct and transitive
shared lib dependencies of the libs and executables listed in Android.bp
Change-Id: I21f6a586654779984f0f5154b2a08b2adbf2168b
Bug: http://b/109759970
Bug: http://b/91353691
There are no multiple-defintion errors after switching to clang-r339409
and libc++.
Test: m native-host-cross
Change-Id: I5576b3894ed1d88c9b2e5f4d92e1d3bfadfb029b
- Stop including libstdc++ headers.
- '-pthread' and 'static-libgcc' are unused when we pass -nodefaultlibs.
We didn't pass -nodefaultlibs for libstdc++.
- Use SjLj exceptions for 32-bit. libgcc_eh implements SjLj exception
model for 32-bit.
- Disable visibility annotations for libcxx and libcxxabi since we are
only going to support these as static libraries.
- Use Win32 threads. MinGW pthreads throws an error when building
libcxx since it's pthread_mutex_initializer is not constant (needs a
cast).
- Link libgcc_eh, which needs pthread, which in turn depends on
kernel32. Wrap the libraries with --start-group and --end-group and
remove duplicates.
Test: Build and test Windows binaries under Wine.
Change-Id: I8be51b004585e11ef51b7d5012f2a51330d1260f
From now on, a c++ shared library can be built only with adding
".sysprop" description file to srcs. Sysprop library generator will
automatically generate a .cpp and .h files, and the header file will be
exposed to any clients linking against the shared library. For the full
schema of description file, see system/tools/sysprop/sysprop.proto.
Bug: 80125326
Test: 1) write a .sysprop description file.
2) create cc_library_shared and add description file to srcs.
3) create another module, link against library of 2), include generated
header, and access generated sysprop functions
4) see compile succeeded.
Change-Id: I95005a0724aeb8f11a856b7aee92787a16a5374d
https://android-review.googlesource.com/c/platform/build/soong/+/689585
added, but was skipped going into pi-dev-plus-aosp, as the pi-dev
version (which did not have these lld bits) was already merged there.
When pi-dev-plus-aosp was pushed to aosp-master, this got lost.
Merged-In is a random git_master change, since this needs to go
into pi-dev-plus-aosp too, but no further.
Bug: 78133793
Test: git diff aosp-master..master -- cc/config/arm64_device.go
Change-Id: Iea69a2c040d11249e43a76a78859944274ce6a92
Merged-In: I7799feac522a1097ec4271bd7868cd6bfe147ad9
Make sure that the minimal runtime gets applied to the rest
of the sanitizers we might use from ubsan.
Bug: 80195448
Test: Build success and checked build flags.
Change-Id: I31b211b80bb1068c153a9b65454a2605933c9568
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
JNI testing will need to create basic native shared library
modules, export the minimum mutators and module types for
the required dependencies of a native shared library.
Bug: 80095087
Test: cc_test.go
Change-Id: Ibe7bc88b69cb0851291cb09a4c0c6cdb421b8651
After we fix all existing such warnings, it can be changed to an error.
Bug: 112564944
Test: make checkbuild
Change-Id: I61ee3a24a3f992ef018cfe6c995e957416551183
Instead, hardcode the ~dozen paths into build/soong/Android.bp, which
will unblock removing more GCC support.
Bug: 114286031
Test: m
Change-Id: I2508432e00b1469141f01e667f3c6a2fe30cd805
Remove 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: I61e4c5a92113d4ff3b95261783269dc1d226c57a
This reverts commit 77e62dbf59.
Reason for revert: caused boot failure on mirror-aosp-master-with-vendor
Change-Id: I594df35878616dba8990d044d7cd529458a601b6
libgcc is kept behind libcrt.builtins to provide unwinder symbols and
any other missing symbols.
libc and libm are excluded from the switch due to some symbols being
hidden in libcrt.builtins but not in libgcc. These will be addressed in
a separate CL.
Bug: 29275768
Test: checkbuild and bionic native tests on arm/arm64/x86/x86_64
Change-Id: Icc85bf88513e989a4b1547564405a22cf847db8a
prefer32 needs to be set differently for app and native modules.
Make it use lambda provided by the module type instead of trying
to make archMutator figure it out.
Test: m checkbuild
Change-Id: Ibf8af35fdd3e1721725539d1f5452f4439d2125c
Bug: http://b/109759970
r335286 fixed this for 64-bit Windows. This remains broken for 32-bit
Windows.
Test: m native-host-cross
Change-Id: I4d11b83d51db055406c6723aad89efd1b86b9b7b
compdb.go was incorrectly splitting compiler arguments. This could
cause empty strings to be included in compile_commands.json,
potentially confusing tools.
Bug: 117124308
Test: m checkbuild
Test: m SOONG_GEN_COMPDB=1 \
SOONG_GEN_COMPDB_DEBUG=1 \
SOONG_LINK_COMPDB_TO=$ANDROID_BUILD_TOP nothing
Examine $ANDROID_BUILD_TOP/compile_commands.json
Change-Id: I375baf255c50a1329cd644ac584d200aba9daa69
The double space is confusing compdb.go. compdb.go should be fixed,
but the double space is unnecessary so remove it.
Also make -isystem consistently followed by a space.
Bug: 117124308
Test: m checkbuild
Change-Id: I5ce7530d2ef66be8d8285e252d60a39299984a06
* Add relativeFilePathFlag compiler flag category whose format must be
a=b/c/d, where "a" is the flag name and "b/c/d" is the flag value that
is a relative path
* During CMake conversion, "b/c/d" will be prefixed with ANDROID_ROOT
before being written to CMakeLists.txt
Bug: 112599284
Test: cd system/bt; mm -j40
croot; make -j40
Change-Id: I4bb039678482201db60f0af97ab280d5028e0463
* Allow module owner to specify a test_config_template in Android.bp
* The rule goes:
1. When "test_config" is set, Soong uses specified test config
2. If 1 is not true, check if "AndroidTest.xml" exist in the
directory, if so, use "AndroidTest.xml
3. If 1 and 2 are not true, check if "test_config_template" is set.
If so, use module specific template to generate test config
4. Otherwise, use Soong default template for test config for autogen
Bug: 113359343
Test: make
Change-Id: I9fb4b2b266be9e0c7cf23da4a51e1c8ae67cd857
This also changes over llvm-strip to use the -o flag, rather than
relying on nonstandard (and no longer functional) positional arguments.
Bug: http://b/111998531
Test: Multiple new builds. For googlers - http://go/clang-r339409-testing
Change-Id: I8c82d06304af24a001e6552e36e2f540d8e364ce
This commit allows cc_prebuilt version suffix to include `svn`, e.g.
`libclang.so.8svn`. The rationale behind this commit is that latest
LLVM/Clang prebuilt binaries use `.8svn` as the version suffix.
Bug: 111579848
Test: header-abi-dumper builds with the latest binaries
Change-Id: I91594c5d8bc57605e2e0facb0a867dc4a4a17fe6
This reduces amount of warnings in default builds,
until we add noexcept to those move constructors.
Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: Iaa9e9480dbc72a7370ccbe10ed232b87dc8d6184
This variable is a space separated string of clang-tidy flags to be passed
to clang-tidy before any other system required extra flags.
Note that when this flag or local tidy_flags is defined,
the default -header-filter flag is suppressed.
Test: make with WITH_TIDY=1 WITH_TIDY_FLAGS="-extra-arg=-DABCD1=1 -extra-arg=-DABCD2=2"
Bug: 32668284
Change-Id: If7bd31c65404ef7fe6c3499d51f0f209a704efd9
This variable is a regular expression to be passed as
additional patterns to the -header-filter flag for clang-tidy.
For example, when make with WITH_TIDY=1 DEFAULT_TIDY_HEADER_DIRS="d1/d2|mydir/*"
for a project in external/xyz, clang-tidy will be called with additional flag
-header-filter=\"(external/xyz|d1/d2|mydir/*)\"
Test: make with WITH_TIDY=1 DEFAULT_TIDY_HEADER_DIRS="d1/d2|mydir/*"
Bug: 32668284
Change-Id: I6051f4f80bc6dbab882bd81435ccbc772772ac63
Bug: http://b/115909626
Some executables linked with msvcr110.a before mingwex.a loop on start
up with the following message:
err:ntdll:RtlpWaitForCriticalSection section 0x7fdcb000 "?" wait
timed out in thread 0009, blocked by 0000, retrying (60 sec)
https://android-review.googlesource.com/c/758688/ has a reproducer.
Test: The reproducer above works, and verify that few Windows binaries
behave correctly (print help message and such).
Change-Id: I837f421532d86f73713d70b3d93609b50d238af9
So LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES is no longer necessary. And just
export the object paths directly to make instead of copying into the
intermediate libraries directory.
Test: m
Change-Id: Iba1523aec642fc81e9bf61da3125f714e91cd557
Passing -pie to clang for Windows binaries causes a warning:
clang-7: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
Bug: 115776263
Test: m checkbuild
Change-Id: Ie502a05dac32c192c38953c684dc80d1db24b792
APEX needs to know the location of the output file of cc.Module to copy
it to an intermediate directory and package there.
Bug: 112672359
Test: m apex.test
Change-Id: Iaa19b29c2859df96f50716001dbd57df3f596050
Export Soong cc modules to Make using a new soong_cc_prebuilt.mk that
bypasses all of prebuilt_internal.mk, dynamic_binary.mk and binary.mk.
This also means that stripping is handled in Soong instead of Make.
Relands If9008c50920779048480f5eeeb0084f26006c998 with fixes for
mac builds.
Bug: 113936524
Test: m checkbuild
Change-Id: I9710ff57f0793f36eb889eabd08bd60a365a88dd
Export Soong cc modules to Make using a new soong_cc_prebuilt.mk that
bypasses all of prebuilt_internal.mk, dynamic_binary.mk and binary.mk.
This also means that stripping is handled in Soong instead of Make.
Bug: 113936524
Test: m checkbuild
Change-Id: If9008c50920779048480f5eeeb0084f26006c998
It allows use of sanitizer preprocessor macros (like __has_feature())
in assembly files.
Bug: 112438058
Test: SANITIZE_TARGET=hwaddress
Change-Id: Id3fed5492ab9473cbb13cd6c0485302412e8b1de
We need to keep support in Soong until toolchain_library no longer uses
GCC.
Test: out/build-aosp_arm64.ninja is the same before/after
Test: build_test on downstream branches
Change-Id: Ib78bcd6d5544afc3a3164f65fa72a3f08b2acf29
Only add gnu debuglink on userdebug builds to match Make, and don't
add it when using minidebuginfo, which doesn't support it.
Bug: 113936524
Test: m checkbuild
Change-Id: Ifd529f88d63afa5627172fb6ea612aea77159f40
The relocation packer prebuilt is gone, remove the references to it.
Bug: 110715614
Test: m checkbuild
Change-Id: Ia20f8198e4fc206f4995dd5168c811dac7c9df89
linkerFlags takes the current flags struct, it should return it
unmodified if it has nothing to do, not return an empty one.
Bug: 113837811
Test: m SANITIZE_TARGET=address
Change-Id: I35ec260f49c832a5b50ff77395eda618679e6ef9