Bug: http://b/69933068
- Remove GCC's intrinsic header path so Clang's headers get included.
- Add '-B' with GCC's binary directory so Clang detects the linker.
- Bug: http://b/109759970 - Pass '--allow-multiple-definition' linker
flag to deal with ld.bfd's inability to handle Clang-generated section
names is fixed.
- Bug: http://b/110800681 - lld cannot link Android's Windows modules
yet
Test: m native-host-cross and run adb_test.exe under wine.
Change-Id: I9be9cfc34a47cbeee04024438dea214305112eaa
Bug: http://b/69970955
With the MinGW prebuilts update (http://aosp/709402), executables get a
runtime dependency on libgcc_s_sjlj-1.dll with both gcc and Clang.
Passing -static-libgcc removes this dependency and is a better option
than having to package an extra dll with executables.
Test: Run gcc-built adb_test.exe under wine
Change-Id: I18e5fadb1b8ace510ae684e2d4cfa7fe7d007cff
VisitDepsDepthFirst is almost never correct, as it can't query
dependency tags of multiple dependencies between the same two modules.
Replace VisitDepsDepthFirst with WalkDeps in sanitize.go and
python.go. Also verify the dependency tag before continuing to
recurse to ensure that they don't recurse through genrules and into
unrelated modules.
Test: m checkbuild
Change-Id: I2f7560126f56b51a40ec39dfbdcc18b5891489f7
Scudo is a hardened usermode allocator that is part of LLVM's compiler-rt
project (home of the Sanitizers). clang allows for -fsanitize=scudo as a
possible command line option to link the shared Scudo library to a binary.
This patch add Scudo as a potential sanitize option. Scudo is not compatible
with ASan and TSan and will be disabled if either is enabled.
Bug: 72112048
Test: aosp compiled with m -j
Test: local experiment with scudo: true to ensure that a test target
(tombstoned) could be linked with scudo.
Change-Id: I76bb6c60891d4782f6665a112c4c2bf7c31645da
To save space in the recovery partition, modules installed to the
partition are restricted to be built in the first architecure (i.e.,
32bit for 32bit-only device or when TARGET_PREFER_32_BIT is true, and
64bit otherwise).
Most notably, this change removes the 32-bit variant of the linker
(about 1MB). The linker was installed regardless of whether there is a
32-bit executable or not. Now, the unnecessary linker is not installed
and it is guaranteed that all modules in the partition are built with the
same architecture.
Bug: 79146551
Test: m -j
Test: out/target/product/<name>/recovery/root/system/bin/ has only one
variant of the linker.
Change-Id: I4070a43555bad4cfa8eff5253b09dcd004ea8251
VNDK-Ext are modules with `vndk.enabled: true` but not having
`vendor_available: true`. In addition, VNDK-Ext should be checked by
source ABI checker. This change fixes the regression introduced in
Bug: 110142940
Test: Create libminijail_ext, break some ABIs, and see an error.
Change-Id: I8b47ac12d2e132f641129c9549ed22c3971d6c89
Recovery variant of a module is now by default built with
-D__ANDROID_RECOVERY__, thus eliminating the need to define a custom
macro to conditionally compile the module for the recovery mode.
(Of course, they can define their own macro if needed)
Bug: 63673171
Test: m -j
Change-Id: I1d1b990329793472b93c2f56080e72d690eef9ec
Recovery partition has same layout as system. In other words,
executables are installed to <recovery_root>/system/bin and libs are
installed to ../system/lib.
This is made possible because the recovery partition is now
self-contained, i.e., shell, adbd, etc. are hosted in the recovery
partition and thus we no longer has to mount the real system.img
to /system. So /system is now available to executables built for
recovery mode.
Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: Select 'mount /system' in the recovery mode, then `adb shell`.
$ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from
the /lib directory.
Change-Id: I6c4f903ad21fd3dd10a07c4588be85d3d678c099
For a vndk_prebuilt module that was built with 32 bit binder, add
"binder32bit: true" to its Android.bp module.
This will add .binder32 suffix to the name.
Bug: 74362637
Bug: 80450527
Test: m -j vndk_snapshot_package
Change-Id: I81049adbf5e67fe5e63d5ea3a8b027aaf6eb355b
* 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
Modules may have multiple variants for each architecture, and
SOONG_GEN_CMAKEFILES=1 was generating CMakeLists.txt for all of
them, overwriting the first normal variant with the last (and
likely least normal) variant.
Keep a map of generated CMakeLists.txt files, and only generate
each one once.
Bug: 72283227
Test: m SOONG_GEN_CMAKEFILES=1
Change-Id: If31087264d2809088fe36965b9a0ff0f44089852
SourceDepTag is going to become a set of tags of the same type
instead of a single tag, remove references to it outside the
android module.
Bug: 80144045
Test: soong tests
Change-Id: I00b2ea5040e4fc95dfbfdd79e21579853c478fcb
Every time the toolchain adds a new warning, we had to suppress the
warning in every external projects that violates it, or disable it
globally -- which we end up doing most of the time since the first
option is way too time consuming.
Add a separate cflags option for external projects and move existing
-Wno-* flags there so that we can enforce better code quality for
internal projects.
TODO: Move more -Wno-* flags to ClangExtraExternalCflags
Test: m checkbuild
Change-Id: If3dee491616a1e7ba6223c2f522d100e10c5ee76
Use the host platform "strip", and also expose "nm" and "otool" used for
toc.
Test: `m PRODUCT-sdk-sdk` on Mac
Change-Id: I7a6d127f479d3e563385ead46bc3a4b49b99776b
atree was using the host's strip tool during sdk generation, so expose
the prebuilt for use instead.
`id` was used with a test running minijail0 during the build
`sha1sum` is used by development/build/tools/mk_sdk_repo_xml.sh
`rmdir` was being used to remove some tmp files
Test: m PRODUCT-sdk_arm64-sdk dist sdk_repo
Test: Run other builds through forrest
Change-Id: I49c756a3e9497c0bbd9030754e6aa193a2d989a4
Unlike the old version of this (which has been renamed to
verioned_ndk_headers), this module includes a property to specify the
preprocessor to be used.
This is going to be used for preprocessing ICU4C's unicode/uconfig.h
to alter a config value that needs to differ between the platform and
the NDK.
Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/548
Change-Id: If5c6f54f90cf5a4187693a941748d72f39b0d797
The SetSanitizer() method in cc/sanitize.go was also enabling
diagnostics for CFI when invoked from the sanitizer mutator. We
shouldn't be doing this, so this CL disables that.
Bug: 79785496
Test: strings libziparchive.so | grep 'ubsan'
Change-Id: Iffe0d4e9c333ac5dfbec3f48e381c232ce5d4463
recovery variants are not built with NDK (useSdk() is false for
recovery). So LOCAL_SDK_VERSION shouldn't be emitted for the recovery
variants as well.
Test: m -j liblzma.recovery does not show any link type check error
Change-Id: Icb6c4fc766060e3f1555c405d5785ef5a015c629
When pack_relocations is false and clang lld is used,
pass --pack-dyn-relocs=none to lld.
Bug: 80093890
Test: build and boot with USE_CLANG_LLD=true
Change-Id: I0ffe77a111d7fbab5afaa1395d09734a8a390e09
There was a bug that recovery.cflags is ignored. Respect the property
when building for recovery.
Bug: 79146551
Test: m -j
Change-Id: I24c1c1b593c83eb1992721571c6d5c42483a41a0
The current rule runs a specific preprocessor over the source files,
and I'm adding support for generic preprocessed headers in a follow
up patch.
Test: make checkbuild
Bug: None
Change-Id: I1f3193cd595f151309e6321e1b41d8d16085379d
Libraries that are direct or indirect dependencies of modules installed
to recovery partition (e.g. adbd) are marked as recovery_available:
true. This allows a recovery variant of the lib is created when it is
depended by other recovery or recovery_available modules.
Bug: 79146551
Test: m -j
Change-Id: I1181fa0646d840c0194e4af2043ec228ec9eff16
recovery_available property is required in cc_genrule. Specifically,
we will mark libminijail as recovery_available:true as part of building
adbd and other stuffs for recovery. Some source code of libminijail is
created via cc_genrule, so we need recovery_available in the module
type.
Bug: 79146551
Test: m -j
Change-Id: I0cf0d9b1004dda055373573e5c5a7debd112685f