Commit Graph

1122 Commits

Author SHA1 Message Date
Treehugger Robot 9d951a10f3 Merge changes from topic "mingw-clang"
* changes:
  Use clang for windows host modules
  Use -static-libgcc for Windows
2018-06-26 19:47:53 +00:00
Pirama Arumuga Nainar 8a852e7694 Use clang for windows host modules
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
2018-06-25 18:36:50 -07:00
Pirama Arumuga Nainar abf1b31a20 Use -static-libgcc for Windows
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
2018-06-25 18:31:01 -07:00
Chih-Hung Hsieh ad47a27d9c Define CLANG_TIDY_UNKNOWN_CFLAGS for build/make.
Bug: 110538415
Test: build with WITH_TIDY=1
Change-Id: I6c5b5a0cb3ad3c2756bbae5e7c0234a0dafe5991
2018-06-25 13:48:42 -07:00
Colin Cross 6b75360cbc Use WalkDeps instead of VisitDepsDepthFirst
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
2018-06-22 12:44:35 -07:00
Treehugger Robot 87e50a0d14 Merge "Recovery partition uses the first architecture only" 2018-06-20 01:11:10 +00:00
Kostya Kortchinsky d18ae5ce98 Soong support for Scudo
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
2018-06-19 09:46:09 -07:00
Jiyong Park 413cc744b8 Recovery partition uses the first architecture only
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
2018-06-19 10:49:21 +09:00
Yi Kong 9c63363119 Remove workaround for cortex-a55/a75
Test: m checkbuild
Test: boot on a55/a75 device, pass bionic tests
Bug: 110235326
Change-Id: I5ab2102352a6efe1173b3097875e6e779d4a1a09
2018-06-15 23:15:54 +00:00
Yi Kong 8eb8704cf1 Merge "Update ToolingCFlags overrides to include other new architectures" 2018-06-15 05:08:53 +00:00
Yi Kong 72f9a0b2f5 Update ToolingCFlags overrides to include other new architectures
Bug: 110235326
Test: m checkbuild
Change-Id: I9d0ada05d95bb260500c1d694332a73363b0f299
2018-06-14 18:45:54 -07:00
Treehugger Robot 33ab6f6134 Merge changes from topic "sharedlib_in_recovery"
* changes:
  Recovery variants are built with -D__ANDROID_RECOVERY__
  Recovery partition has same layout as system
2018-06-13 23:14:29 +00:00
Logan Chien ef1ff3de98 Fix VNDK-Ext ABI check regression
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
2018-06-13 22:32:16 +08:00
Treehugger Robot 04f0140479 Merge "Revert "Move -Wno-enum-compare{,-switch} to external cflags"" 2018-06-12 06:44:00 +00:00
Yi Kong 2f71a6adcd Revert "Move -Wno-enum-compare{,-switch} to external cflags"
This reverts commit 96d221f914.

Reason for revert: build breakage for sdk target

Change-Id: I933df62738c08b48d8ae4ea951b2cb4837616c78
2018-06-12 04:51:49 +00:00
Yi Kong 276e82ef2a Merge "Move -Wno-enum-compare{,-switch} to external cflags" 2018-06-12 02:58:15 +00:00
Treehugger Robot d27a18ff2f Merge "Only write CMakeLists.txt for normal variants" 2018-06-12 01:36:13 +00:00
Treehugger Robot 01c66c199e Merge "Add lld --no-rosegment flag to work with unwinder." 2018-06-12 00:13:27 +00:00
Chih-Hung Hsieh b18814e7a4 Add lld --no-rosegment flag to work with unwinder.
Bug: 109657296
Test: make checkbuild and boot
Change-Id: If8eda7ced31f5d4abb357935e9292b81936af6be
2018-06-11 15:07:34 -07:00
Yi Kong 96d221f914 Move -Wno-enum-compare{,-switch} to external cflags
Test: m checkbuild
Bug: 72330874
Change-Id: I8aaa020f5efafa8746b2c5ae29cea1a313a28045
2018-06-11 14:54:35 -07:00
Jayant Chowdhary 694b1c7c94 Merge "For llndk libraries add -consider-opaque-types-different to header-abi-diff invocation." 2018-06-11 20:16:21 +00:00
Jayant Chowdhary c7434e28d3 For llndk libraries add -consider-opaque-types-different to header-abi-diff invocation.
Bug: 79576032

Test: Create abi reference for libmediandk; build libmediandk;
      header-abi-diff gets invoked with '-consider-opaque-types-different'

Change-Id: I132138e333cc944b54051243b44fa072af74aa83
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
2018-06-11 10:51:43 -07:00
Jiyong Park d54aee574d Recovery variants are built with -D__ANDROID_RECOVERY__
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
2018-06-09 02:03:45 +09:00
Jiyong Park 2e6743176a Recovery partition has same layout as system
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
2018-06-09 01:57:00 +09:00
Justin Yun 3e2323d202 Add binder32bit to vndk_prebuilt module
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
2018-06-08 15:56:40 +09:00
Chih-Hung Hsieh 30485c920c Use llvm-{objcopy,strip} when clang lld is used.
* 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
2018-06-07 16:04:14 -07:00
Colin Cross dfe4752181 Only write CMakeLists.txt for normal variants
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
2018-06-07 21:34:03 +00:00
Yi Kong cc80f8d64f Revert "Revert "Add external projects only CFlags option""
This reverts commit a9ccbb7b87.

Test: m
Change-Id: I92d7b7707f73ef3af5824d3e8cb6da0465b5e07d
2018-06-06 16:41:26 -07:00
Colin Cross 2d24c1b654 Remove references to SourceDepTag in module types
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
2018-06-06 17:05:20 +00:00
Kevin Rocard a9ccbb7b87 Revert "Add external projects only CFlags option"
This reverts commit 6a350878d8.

Reason for revert: Breakage of many AOSP targets

Change-Id: I917e6daa04ac02ecb98c7bb1816f9bdaf46429f5
2018-06-05 21:43:46 +00:00
Yi Kong 6a350878d8 Add external projects only CFlags option
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
2018-06-05 19:32:02 +00:00
Treehugger Robot 85b1e39ffe Merge "Fix mac sdk build" 2018-06-05 00:47:16 +00:00
Treehugger Robot 1efd4a9c81 Merge "Add a preprocessed_ndk_headers module type." 2018-06-04 23:40:03 +00:00
Dan Willemsen fdb20d05bc Fix mac sdk build
Use the host platform "strip", and also expose "nm" and "otool" used for
toc.

Test: `m PRODUCT-sdk-sdk` on Mac
Change-Id: I7a6d127f479d3e563385ead46bc3a4b49b99776b
2018-06-03 16:19:56 -07:00
Treehugger Robot 1d2318d6cd Merge "Allow more PATH tools, expose HOST_STRIP" 2018-06-01 23:58:15 +00:00
Chih-hung Hsieh a4181126ee Merge "Handle pack_relocations in linker.cc" 2018-06-01 20:43:11 +00:00
Dan Willemsen f6d300662e Allow more PATH tools, expose HOST_STRIP
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
2018-06-01 12:48:41 -07:00
Dan Albert cb1b4b2d53 Add a preprocessed_ndk_headers module type.
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
2018-06-01 11:02:38 -07:00
Vishwath Mohan 05b002dea0 Don't enable diagnostics for CFI when setting the CFI sanitizer.
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
2018-05-30 20:52:39 -07:00
Jiyong Park 97686288dd LOCAL_SDK_VERSION is not emitted for recovery variant
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
2018-05-30 10:37:25 +09:00
Chih-Hung Hsieh 8681471e70 Handle pack_relocations in linker.cc
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
2018-05-29 15:39:47 -07:00
Treehugger Robot 523cef04cb Merge "Use new flex binary" 2018-05-25 22:44:35 +00:00
Treehugger Robot c8036c17ab Merge changes from topic "recovery_available"
* changes:
  fix: recovery.cflags now works
  Mark as recovery_available:true
  Add recovery_available to cc_genrule
2018-05-25 05:58:01 +00:00
Jiyong Park 4a2dcb5c4b fix: recovery.cflags now works
There was a bug that recovery.cflags is ignored. Respect the property
when building for recovery.

Bug: 79146551
Test: m -j
Change-Id: I24c1c1b593c83eb1992721571c6d5c42483a41a0
2018-05-25 08:43:50 +09:00
Dan Willemsen b7adae8aaf Use new flex binary
Test: treehugger
Change-Id: Ie1d41a3ee223a80b6f471b7b1cbede63cc7051f5
2018-05-24 15:45:21 -07:00
Dan Albert 97f9c963ad Rename preprocessed_ndk_headers to versioned_ndk_headers.
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
2018-05-24 15:12:51 -07:00
Dan Albert 19ff8b4662 Add exclude_srcs property to ndk_headers modules.
Test: make checkbuild
Bug: None
Change-Id: I2778c1140ab50abc0f7dee66da35ebacef77ea72
2018-05-24 15:12:26 -07:00
Dan Albert 7122205a5a Fix typo. Properies -> Properties.
Test: make checkbuild
Bug: None
Change-Id: I0b5e3dd44f507207f2de90e922dd7016cffce118
2018-05-24 15:12:20 -07:00
Jiyong Park 6caa21aa82 Mark as recovery_available:true
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
2018-05-24 14:14:08 +09:00
Jiyong Park 3f736c9661 Add recovery_available to cc_genrule
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
2018-05-24 14:01:54 +09:00