Commit graph

954 commits

Author SHA1 Message Date
Zhizhou Yang
51be632b95 Fix llvm-ar error caused by using lto and sanitizer together
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)
2018-02-14 21:21:14 +08:00
Pirama Arumuga Nainar
49540800f0 Search for PGO profiles in PGO_ADDITIONAL_PROFILE_DIRS
This variable can be set in BoardConfig.mk to specify a list of
additional paths that contain PGO profiles.  These directories are
searched after the predefined paths in soong/cc/pgo.go while finding
PGO profiles.

Test: Set this variable in a BoardConfig and verify that such profiles
are found and that these paths are searched after the predefined paths
in soong/cc/pgo.go.

Change-Id: I0bb9523de614d0f23aba8d51c887d8fc8f41c993
2018-02-13 09:41:13 -08:00
Dan Albert
f2ceea7f1f Disable a warning that libc++'s headers trip.
Test: make checkbuild
Bug: None
Change-Id: I117bd9ef3f4f3c8792f4b6692d7b70ad69b6922d
2018-02-07 17:24:42 -08:00
Treehugger Robot
966bdded1f Merge "Enable emutls with -flto for Android sanitize=cfi" 2018-02-07 03:14:20 +00:00
Treehugger Robot
ca59511e21 Merge "Support filegroups for version_script and related properties" 2018-02-07 00:58:43 +00:00
Ryan Prichard
3ed1f70414 Enable emutls with -flto for Android sanitize=cfi
-fsanitize=cfi requires LTO. Normally, the Clang driver automatically
enables emutls, but it's broken with -flto, so work around it by passing
-Wl,-plugin-opt=-emulated-tls.

See https://buganizer.corp.google.com/issues/72706604#comment15

Enable the workaround with ctx.Device(), which is the same condition used
in the existing I18acac41aac885fc6635fbd55f96ba7c845eb5e7 workaround.

Bug: b/72706604
Bug: https://github.com/android-ndk/ndk/issues/498
Test: m libaudioflinger (on internal master); \
  readelf -sW symbols/system/lib64/libaudioflinger.so | grep tlNBLogWriter
  check that __emutls_t.tlNBLogWriter exists
  check that no symbols of type TLS exist

Change-Id: I2cf65574c52476843cc017ee176a7d6777e2ce0b
2018-02-06 15:11:38 -08:00
Stephen Hines
a42e0a0eca Silence warnings rather than keeping them in the logs.
We can simply revert this patch to work on these warnings independently.

Bug: http://b/72331526
Bug: http://b/72331524
Bug: http://b/72330874
Test: Build

Change-Id: I9cec51578a1c6de33fb6f832c758b9916c61b735
2018-02-06 14:51:08 -08:00
Colin Cross
2383f3b693 Support filegroups for version_script and related properties
Bug: 71715793
Test: m checkbuild
Change-Id: Ibf78a5ec88e743f29504c91057d2cfced667c8b4
2018-02-06 14:42:06 -08:00
Yi Kong
599a6032fc Switch to clang-4579689.
Bug: 68397894
Test: http://go/clang-4523590-testing
Change-Id: Ief806250572fe2cc5f39b4c47ff74863acbbb26d
2018-02-01 10:23:32 -08:00
Yi Kong
03d383d038 Add environment variable to globally disable LTO
Allow developers to disable LTO to reduce build time.

Test: m checkbuild
Test: DISABLE_LTO=true m checkbuild
Bug: 62839002
Change-Id: I30642e3cfff60c4874a2f8797d08105b4e07cc6d
2018-01-31 16:26:12 -08:00
Pirama Arumuga Nainar
28316d4e3b Store missing profile files into a Make variable
Bug: http://b/72642679

Store missing profile files and the modules that refer to them in the
SOONG_MODULES_MISSING_PGO_PROFILE_FILE variable passed to Make.  The
contents of this variable will be written to
$DIST_DIR/pgo_profile_file_missing.txt as part of the 'dist' target.

Test: 'm dist' and verify creation of pgo_profile_file_missing.txt.
Change-Id: I237cd0398be418be2b7db6fa65ece5ef347ecbc1
2018-01-29 10:02:27 -08:00
Treehugger Robot
ad4692d5af Merge "Support instrumenting all PGO-enabled modules" 2018-01-26 02:52:44 +00:00
Stephen Hines
755fe07256 Prebuilt sanitizer libraries should always come from linux-x86.
Bug: http://b/68397894
Test: Build on darwin with new toolchain.
Change-Id: I4d81efdc84d0b6f07482206430252ea63a4b081b
2018-01-24 19:58:36 -08:00
Justin Yun
312ccb974f Skip installing the VNDK prebuilt if arch does not match
For the VNDK prebuilt modules that does not match the target arch,
skip installing the module instead of marking the module to prevent
installing.

Bug: 72310137
Bug: 71787263
Test: Install VNDK snapshot v27
      lunch aosp_arm64_ab-userdebug; m vndk_v27_arm64
      - vndk libs must be installed
      m vndk_v27_arm
      - no vndk libs must be installed because target does not match
      OUT_DIR=out_clean m --skip-make

Change-Id: I9df25d90c276ce5e0d94ec7f9bee32f9ce7231df
2018-01-24 07:52:47 +09:00
Pirama Arumuga Nainar
f231b19017 Add only compiler-flag dependencies as implicit
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
2018-01-23 11:24:33 -08:00
Pirama Arumuga Nainar
e236b5acfa Support instrumenting all PGO-enabled modules
Bug: http://b/63768402

If ANDROID_PGO_INSTRUMENT has "all" or "ALL", all PGO-enabled modules
are built for profile generation.

Test: Build with and without 'all' in ANDROID_PGO_INSTRUMENT
Change-Id: I3b1a9b562775e80a4ab3965100341d9e8e4ffde9
2018-01-22 20:26:16 -08:00
Logan Chien
f351174107 Support VNDK extensions
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
2018-01-23 01:40:54 +00:00
Dan Albert
7d1eecf3cc Fix static_ndk_lib for sanitized libraries.
Test: build-ndk-prebuilts.sh with libc/libm included in the NDK
Bug: https://github.com/android-ndk/ndk/issues/272
Change-Id: Ic398f541036f6c16f7dc58b9af984c60ed948495
2018-01-22 12:40:13 -08:00
Treehugger Robot
e021b0405d Merge "Revert "Support enabling overflow sanitization by path."" 2018-01-20 03:54:23 +00:00
Ivan Lozano
b7d0f52337 Revert "Support enabling overflow sanitization by path."
This reverts commit 17df3c1b76.

Change-Id: Id5dab777da591c24113c3048b8606547a661afdd
2018-01-20 01:44:38 +00:00
Treehugger Robot
4fe7c6aee8 Merge "Update NdkMaxPrebuiltVersionInt." 2018-01-19 23:48:32 +00:00
Ivan Lozano
c1fecc2dfa Merge "Support enabling overflow sanitization by path." 2018-01-19 15:55:38 +00:00
Treehugger Robot
d40471c7c8 Merge "VNDK snapshot modules must have vndk subdirectory" 2018-01-19 07:14:27 +00:00
Treehugger Robot
b0712e8014 Merge "Use -advice-only for libraries which do not export headers." 2018-01-19 05:20:33 +00:00
Justin Yun
3e15b96234 VNDK snapshot modules must have vndk subdirectory
VNDK snapshot modules must have vndk subdirectory for their
LOCAL_MODULE_PATH regardless of BOARD_VNDK_VERSION definition.
The snapshot target output file must be not changed.

Bug: 71782197
Test: Build marlin with snapshot in the source and boot
Change-Id: I2b6ec9a5c20d6a5014f690d4eb8e6cd7b3b2f2fa
2018-01-19 12:19:24 +09:00
Justin Yun
74c3f5c9d1 Include VNDK snapshot modules only if the arch matches
If the target_arch for the snapshot module does not match with
the build variable TARGET_ARCH, hide the module from the make file.

Bug: 71787263
Test: Install VNDK snapshot v27
      lunch aosp_arm64_ab-userdebug; m vndk_v27_arm64
      - vndk libs must be installed
      m vndk_v27_arm
      - no vndk libs must be installed because target does not match

Change-Id: I32ab5004832a4164e1b2c056ad149ede50828b92
2018-01-19 09:48:45 +09:00
Jayant Chowdhary
e44995078f Use -advice-only for libraries which do not export headers.
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
2018-01-18 15:52:43 -08:00
Ivan Lozano
17df3c1b76 Support enabling overflow sanitization by path.
Handle paths variable provided from Make about where integer overflow
sanitization should be enabled by default, and prepare to enable minimal
runtime diagnostics for integer overflow sanitizers in userdebug/eng builds.

This provides Soong support for on-by-default paths from Make for
integer overflow sanitization.

Bug: 30969751
Bug: 63927620
Test: Include paths passed from Make are being sanitized.
Test: Compilation succeeds with and without diagnostics enabled.
Test: See Make patch for further test notes.

Change-Id: I803a75646cc27ef5b4b5b74b8eb2981c39f8a6a3
2018-01-18 14:16:47 -08:00
Dan Albert
c715eda106 Update NdkMaxPrebuiltVersionInt.
We have newer NDK prebuilts now.

Test: make checkbuild
Bug: None
Change-Id: I00ba5d1638832bc0feff46599afbaa201294fdad
2018-01-18 13:25:41 -08:00
Pirama Arumuga Nainar
64946fec54 Update profile_file discovery rules
Bug: http://b/63768402

Profile files are searched in multiple directories in a pre-define list,
instead of just one.

PGO profile_file enforcement is also removed - profile_file dependency
and -fprofile-use are added iff the profile_file is present.

Test: Build https://android-review.googlesource.com/c/474805 with
.profdata files in vendor/google_data/pgo-profiles and
toolchain/pgo-profiles and verify expected behavior.

Change-Id: I2604713a8a7a682bd5c6bde569dc32335be5eca9
Merged-In: I2604713a8a7a682bd5c6bde569dc32335be5eca9
2018-01-18 10:26:34 -08:00
Jayant Chowdhary
df344d57b0 Remove the use of version scripts with header-abi-linker.
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
2018-01-17 11:17:40 -08:00
Stephen Hines
2e020842dc Merge "Remove unnecessary DeviceUsesClang." 2018-01-12 18:19:45 +00:00
Treehugger Robot
2835af801c Merge "Disable availability macros in libc++ on Darwin." 2018-01-12 05:46:22 +00:00
Treehugger Robot
7d3e0709a5 Merge "Remove armv5te" 2018-01-12 05:41:11 +00:00
Stephen Hines
6ea0f81c3f Remove unnecessary DeviceUsesClang.
This build function is unnecessary now that GCC is completely
unsupported for Android platform builds. It is similar to
USE_CLANG_PLATFORM_BUILD from the build/make side of things.

Bug: http://b/64032869
Test: Builds
Change-Id: Iddf5f91cc997c337c77a644265cb8dc4e5a915b4
2018-01-11 14:29:41 -08:00
Dan Albert
a07b84598f Disable availability macros in libc++ on Darwin.
libc++'s headers are annotated with availability macros that indicate
which version of Mac OS was the first to ship with a libc++ feature
available in its *system's* libc++.dylib. We do not use the system's
library, but rather ship our own. As such, these availability
attributes are meaningless for us but cause build breaks when we try
to use code that would not be available in the system's dylib.

Test: removed the darwin check and checked showcommands on linux
Bug: None
Change-Id: I3d328d7363eba83f1cb857c8abfd6cd0173a3058
2018-01-11 13:00:46 -08:00
Treehugger Robot
4acd66ae94 Merge "Switch back to llvm-ar (with crsD flags only)." 2018-01-11 07:36:07 +00:00
Stephen Hines
f1addebb44 Switch back to llvm-ar (with crsD flags only).
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
2018-01-10 15:57:49 -08:00
Dan Willemsen
f3768f5011 Merge "Switch to build-tools bison" 2018-01-10 21:49:28 +00:00
Treehugger Robot
2605a61f2d Merge "Remove support for stlport." 2018-01-09 23:38:39 +00:00
Dan Willemsen
6f46a38e56 Switch to build-tools bison
Test: m
Test: mma system/tools/hidl
Change-Id: I467c63792082ef335f2d7788d538db76e9e91d87
2018-01-08 17:34:47 -08:00
Dan Willemsen
e401a8315e Remove armv5te
This architecture only existed for unbundled use, but even the NDK is
removing support in their r17 release, so just remove support for it.

Test: build/soong/build_test.bash -only-soong
Change-Id: I4bd23babf567128d2d242cbdee3311abb198dd7c
2018-01-08 15:48:25 -08:00
Treehugger Robot
e6f4ee2061 Merge "Add target.vendor.override_export_include_dirs." 2018-01-08 22:15:51 +00:00
Yi Kong
8a832c3e6d Merge "Revert "Switch to llvm-ar (with crsD flags only)."" 2018-01-08 19:51:19 +00:00
Yi Kong
df97a8ac9c Revert "Switch to llvm-ar (with crsD flags only)."
This reverts commit 13bc31d6e1.

Bug: 71694982
Reason for revert: Broke Mac build

Change-Id: I0da6866442ca9273dd329f0b82932f939b7f65ed
2018-01-08 18:10:35 +00:00
Steven Moreland
b21df8f66f Add target.vendor.override_export_include_dirs.
This property was originally called export_include_dirs,
but because it has different semantics, it is renamed
here to override_export_include_dirs.

Bug: 62878521
Test: soong finds targets which use this property properly
Change-Id: Iac7c2a89ee8e389977c7a8e3b8c03c1a0d1608bb
2018-01-06 01:35:35 +00:00
Treehugger Robot
0a8a2720e2 Merge "Remove support for gnustl." 2018-01-06 01:12:21 +00:00
Yi Kong
aa92b80bc3 Merge "Switch to llvm-ar (with crsD flags only)." 2018-01-05 22:54:53 +00:00
Chih-hung Hsieh
c355edc09b Merge "Add default -Werror to hardware/qcom projects" 2018-01-05 21:54:50 +00:00
Dan Albert
749fc7885f Remove support for stlport.
Test: make checkbuild
Bug: None
Change-Id: I066574dd623ddd617f7cdbabbb16e01ece0b4cdc
2018-01-05 10:59:33 -08:00