Commit graph

1021 commits

Author SHA1 Message Date
Jayant Chowdhary
bc30a77591 Merge "Add informational message to help with updation of VNDK abi references." 2018-04-04 23:40:06 +00:00
Yifan Hong
946e32e184 Add overrides to cc_binary
Test: use it for healthd, it is not installed.
Bug: 77541952

Change-Id: I170a31d1b4d15f20de6a6b6279a2eeda49ca7447
2018-04-03 16:02:29 -07:00
Ivan Lozano
a9255a8378 Support integer_overflow static lib diagnostics.
This extends the minimal runtime dependency mutator to allow signed
and unsigned integer overflow diagnostics in static libraries and
binaries. This also enables the integer_overflow flag for static
libraries and binaries.

Note compilation will fail if the static library is a dependency
of a Make module that does not also have diagnostics enabled.

Bug: 66952339
Bug: 73283972
Test: make SANITIZE_TARGET{,_DIAG}=integer_overflow
Test: Enabled diagnostics in a static lib, saw results in logcat.
Test: Checked showcommands output for ubsan runtime library inclusion.

Change-Id: Ic52881a0f74cdcac0e4a15335df493b59b002ae5
2018-04-02 12:54:52 -07:00
Jayant Chowdhary
d8b70a39d1 Add informational message to help with updation of VNDK abi references.
Test: create reference dump for libjpeg; add exported function to libjpeg;
      m -j libjpeg.vendor, build fails with helpful message.

Test: create reference dump for libjpeg; add exported function to libjpeg;
      m -j libjpeg.vendor dist DIST_DIR=dist, build fails with helpful message.

Change-Id: Iae25374fe937a0cbe8a8ddf9e23c3bc1f62bbb2a
2018-03-30 11:08:00 -07:00
Logan Chien
d3c59a2b3a Allow VNDK-SP extensions to use vendor lib
This commit changes the VNDK-SP dependencies check.  With the commit,
VNDK-SP-Ext can link to non-VNDK vendor shared libs.  This commit also
refines the "cc_test" so that more error handling cases are properly
tested.

Before this commit, VNDK-SP-Ext could not depend on vendor libs.  It
was disallowed because there were no correct way to load vendor libs.
The fallback link had to specify the shared lib names.  On the other
hand, adding "/vendor/${LIB}" to search paths will lead to
double-loading issue.

In aosp/595067, "allow_all_shared_libs" was added to bionic dynamic
linker.  Now, we can link the "vndk" namespace to "sphal" namespace.
Thus, like VNDK-Ext, VNDK-SP-Ext can link to vendor libs now.

Bug: 77249955
Test: lunch aosp_walleye-userdebug && make -j8  # runs unit tests
Test: lunch aosp_sailfish-userdebug && make -j8  # runs unit tests
Test: Create a VNDK-SP-Ext, link to vendor libs, and run it.
Change-Id: I5511204539a22c998528111076f46756807faf29
2018-03-30 11:46:26 +08:00
Treehugger Robot
01b715e94e Merge "Allow platform modules to link to vendor public libraries" 2018-03-30 03:41:22 +00:00
Vishwath Mohan
f895051c85 Merge "Revert "Change PRODUCT_CFI_INCLUDE_PATHS to opt-out (Soong)"" 2018-03-30 02:58:32 +00:00
Vishwath Mohan
3af8ee0288 Revert "Change PRODUCT_CFI_INCLUDE_PATHS to opt-out (Soong)"
This reverts commit 289d548c3e.

Change-Id: Ic284687157d5cb4122899c84a37c5db507aaee2a
2018-03-30 02:55:23 +00:00
Jiyong Park
374510bcb6 Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.

However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).

This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:

cc_library {
   name: "libvendor",
   proprietary: true,
   ...
}

vendor_public_library {
   name: "libvendor",
   symbol_file: "libvendor.map.txt",
}

This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.

Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-30 10:22:52 +09:00
Treehugger Robot
3ab49a2927 Merge "Change PRODUCT_CFI_INCLUDE_PATHS to opt-out (Soong)" 2018-03-29 22:55:35 +00:00
Ryan Prichard
b1703659a8 Use Soong modules for the NDK's extra STL libraries
* The extra STL libs are:

       libc++abi.a [needed for ndk_libc++_static]
       libandroid_support.a [always needed in NDK r16]
       libunwind.a [needed for ARM32]

 * The existing STL-dependency logic in linkShared only applies to shared
   libraries. By moving it to STL deps, the extra STL libs are linked into
   both shared libraries and executables.

 * Remove the ndk_prebuilt_library/ndkPrebuiltLibraryFactory module type,
   which is unused now.

 * Reuse the ndk_prebuilt_static_stl module type to describe the extra
   static libraries that are linked with both the static and shared libc++
   STLs.

Bug: b/73133405
Test: manual
Change-Id: I3f73e4f882d39e6efa470073bb4fc8c42dff8253
2018-03-29 21:26:06 +00:00
Vishwath Mohan
289d548c3e Change PRODUCT_CFI_INCLUDE_PATHS to opt-out (Soong)
This CL changes PRODUCT_CFI_INCLUDE_PATHS to be included in all
product configs by default. To maintain the status quo, the sanitizer
logic has been modified to only respect this product config for Arm64
devices (where this was previously enabled).

Bug: 63926619
Test: m -j60 # the device still has CFI enabled thanks to the default
opt-in

Change-Id: Ia613aec545ad3e544dea41a6dbdb4112aef4afab
2018-03-28 20:30:05 -07:00
Colin Cross
1218a19f0d Fix data race on cfiExportsMap
cfiExportsMap was reinitialized for every module, which caused
data races.  Create the path from the string on each use
instead.

Bug: 77234104
Test: m nothing with race detector turned on
Change-Id: Ibca3149dcbe8a9d4d9f7ec6dd0b164697e7ae5cd
2018-03-28 16:19:50 -07:00
Colin Cross
f46e37f5f7 Fix format string issues
Fix issues caught by go vet.

Test: m checkbuild
Change-Id: Ib8d740457c15432dabe1575a6707726ddaf93084
2018-03-28 15:54:52 -07:00
Nan Zhang
e42777a05a Fix the flaky build breakage for droiddoc target.
ExpandSourcesSubDir was calling SourceFileProducer.Srcs(), and then
doing:
moduleSrcs = append(moduleSrcs[:j], moduleSrcs[j+1:]...)
This modifies the backing store of the slice, which may affect the
original data stored in the SourceFileProducer.  Make all Srcs
implementations return slice that points to a copy of the backing
array.

Test: m out/target/common/obj/PACKAGING/checkpublicapi-current-timestamp
Bug: b/76179848 b/76397326
Change-Id: I2432ce196984814daafc5aa9a2746e81de74494c
2018-03-28 05:12:15 +00:00
Treehugger Robot
215cedde6a Merge "Fix omission of llndk libraries during abi dump creation." 2018-03-27 22:48:40 +00:00
Chih-hung Hsieh
055fa01693 Merge "Switch to clang 7.0" 2018-03-27 18:38:19 +00:00
Jayant Chowdhary
fa920fabda Fix omission of llndk libraries during abi dump creation.
We omit vendor unavailable modules. This should not apply to llndk
libraries since currently, we do abi checks on their system variants.

Bug: 77101345

Test: m -j libc creates libc.so.lsdump

Test: m -j libjpeg.vendor creates libjpeg.so.lsdump

Test: m -j external/cblas still does not create libblas.so.lsdump

Change-Id: I5522c1cd471bfba8a1f632270ab2f167b4b17117
2018-03-27 11:30:18 -07:00
Ryan Prichard
05206118dc Remove an extraneous space character.
The space prevents "repo upload" from running on my machine:

    $ repo upload .
    [COMMIT 50e35bea87f0] Use Soong modules for the NDK's extra STL libraries
    [FAILED] gofmt
      FILES: ('cc/cc.go',)    <standard input>
    [FAILED] repohooks for platform/build/soong failed
    FATAL: Preupload failed due to above error(s).
    For more info, please see:
    https://android.googlesource.com/platform/tools/repohooks/

Bug: none
Test: repo upload
Change-Id: I6b5de8f5d4edb38ca26a999e561df10262844b3d
2018-03-27 05:09:37 +00:00
Chih-Hung Hsieh
3ede294729 Switch to clang 7.0
* Suppress more noisy new warnings at global level.
* Add -no-pie to partial link .o files, with -r.
* Revert workaround of b/72706604, no need of
  -Wl,-plugin-opt,-emulated-tls
* Filter out clang 7.0 unknown flag "-Wno-extended-offsetof"

Bug: 72706604
Bug: 72412006
Test: make checkbuild
Change-Id: I7ff45465c4bd771991f42b40f68dc35586045656
2018-03-26 18:04:47 -07:00
Justin Yun
732aa6afdf Set __ANDROID_API__ for vendor modules to vndk version.
When building vendor modules with BOARD_VNDK_VERSION=current, the
API of the vendor modules will be current PLATFORM_VNDK_VERSION.
__ANDROID_API_FUTURE__ will be used as before if the version is a
CODENAME.

If BOARD_VNDK_VERSION is not "current", that means the VNDK version
of the vendor modules is BOARD_VNDK_VERSION.

Bug: 74833244
Test: Build and check boot.
Change-Id: I383c76a36101e39c70575b463880b52d3e9d90bb
2018-03-27 08:21:19 +09:00
Martijn Coenen
eab15645fe Add trace flag for cpp/Java AIDL generation.
The AIDL code generator can now include trace code in every generated
AIDL call. We don't want to enable this by default for all interfaces
for two reasons:
1) Potential performance overhead
2) For Java targets, the code depends on @hide APIs in android.os.Trace,
   and I haven't found a clean way to determine whether a target is
   allowed to use @hide stuff in the SDK. LOCAL_PRIVATE_PLATFORM_APIS
   is almost it, but it's not set for the core framework (which is
   exactly one of the things we'd like to trace).

Bug: 74416314
Test: verify correct code is generated when flag is set
Change-Id: Ic6ab8aee3e708207813da3e803911a844ff3e52b
Merged-In: Ic6ab8aee3e708207813da3e803911a844ff3e52b
2018-03-26 09:59:02 +02:00
Logan Chien
a8f5158594 Use PlatformVndkVersion to find ABI dump by default
This commit changes "current" to ctx.DeviceConfig.PlatformVndkVersion().
This change make it possible to place ABI dumps in
prebuilts/abi-dumps/vndk/${version} instead of
prebuilts/abi-dumps/vndk/current.

If BOARD_VNDK_VERSION is not specified or is equal to "current",
PLATFORM_VNDK_VERSION (either PLATFORM_SDK_VERSION or
PLATFORM_VERSION_CODENAME) will be chosen.  Currently,
BOARD_VNDK_VERSION is always equal to "current" because both system and
vendor images are built in a single source tree.

In the future, if the system image and vendor images are separately
built in different source trees, BOARD_VNDK_VERSION will be set to other
values and we should respect that value.

Test: Create an ABI dump under
prebuilts/abi-dumps/vndk/${PLATFORM_VNDK_VERSION}, make some ABI
breakages, and see whether the checks are working.

Bug: 76036094
Change-Id: I6242e0c71ebd9acd5c4a3497c67539cb3e6663f3
2018-03-21 14:54:31 +08:00
Treehugger Robot
bfe65a32bb Merge "Mark generated renderscript header files as implicit outputs" 2018-03-20 08:04:32 +00:00
Colin Cross
80e6054eab Mark generated renderscript header files as implicit outputs
If a generated renderscript header is referenced by a cpp file
clang will insert a depsfile dependency on the header.  If the
generator rule does not include the header as an output, ninja
will not consider the cpp file dirty after the generator runs,
and not rebuild it.  On the next build, it will see that the
timestamp of the generated header is new and consider the cpp
file dirty.

Mark the header files as implicit outputs of the generator.

Bug: 75982985
Test: m libstagefright_mediafilter
      touch frameworks/av/media/libstagefright/filters/saturationARGB.rs
      m libstagefright_mediafilter
      m libstagefright_mediafilter

Change-Id: I3ac899322fe9cae2a6e4171092740339ef844494
2018-03-19 22:44:29 -07:00
Yi Kong
04a0fe3245 Merge "Add opt-in option to turn on ThinLTO caching" 2018-03-19 22:03:15 +00:00
Chih-Hung Hsieh
1e7d1bf1c7 Use armv7a-linux-androideabi for arm device triple.
* This is a workaround of llvm LTO bug.
* Keep using current NDK include directory path.
  NDKTriple is default ClangTriple but kept as GccTriple for arm device.

Bug: 72619014
Test: make checkbuild
Change-Id: I5dc63c99760325c60bc2da98fd6a3125cef7267d
2018-03-19 11:19:06 -07:00
Logan Chien
45d4f09f2f Merge changes I406c5bef,Ibde685d7,I1c09412d
* changes:
  Allow VNDK extensions under vendor or device
  Add unit tests for android/neverallow.go
  Extract failIfErrored() to android/testing.go
2018-03-16 01:57:31 +00:00
Logan Chien
ee97c3ed75 Add unit tests for android/neverallow.go
Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests
Change-Id: Ibde685d7213713be219681cb039ad58a43d9c377
2018-03-15 11:02:38 +08:00
Logan Chien
4203971351 Extract failIfErrored() to android/testing.go
Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests
Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
2018-03-15 11:02:38 +08:00
Yi Kong
8aeaa7158a Add opt-in option to turn on ThinLTO caching
Allow developers to enable ThinLTO caching on their local build by
setting USE_THINLTO_CACHE environment variable.

This significantly speeds up incremental ThinLTO builds by caching
intermediate results. An incremental ART build (by `touch
compiler/compiler.cc`) reduced from 01:32 to 00:45.

We put the cache under out/soong/thinlto-cache as the cache can be
valid across different targets, and allows us to set a global cache
pruning policy.

The current cache policy is sufficient for current list of
ThinLTO-enabled projects, we can tune it up/down in the future.

Test: USE_THINLTO_CACHE=true m
Bug: 62839002
Change-Id: I4838fe833a1d8fbc73d743da6d19e3698dc89600
2018-03-12 16:54:58 -07:00
Dan Willemsen
bc0c509267 Add DistPath to reference the dist folder
Instead of open-coding the logic of whether there is one, or where to
find it.

Test: diff out/soong/build.ninja without dist
Test: diff out/soong/build.ninja with dist specified
Change-Id: Ia3f1ef335e2d6e2175343338d04867d778a50300
2018-03-12 15:48:30 -07:00
Dan Willemsen
54daaf0371 Switch PackageContext functions to take a ctx
So that the Path and similar functions can be used directly, without
manually adding something like configErrorWrapper (it just uses it all
the time now).

Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
2018-03-12 15:48:26 -07:00
Dan Willemsen
a052599bb6 Remove obsolete Brillo variable
Test: none
Change-Id: I6a5ce57b317f0cdae1abef15def01e6a31e18d3e
2018-03-10 15:29:03 -08:00
Treehugger Robot
9c6bc37da1 Merge "Use xz prebuilt" 2018-03-10 03:00:29 +00:00
Treehugger Robot
19e62e5ebf Merge "Revert "Fix absolute paths in clang debug output"" 2018-03-09 20:59:33 +00:00
Dan Willemsen
8fec83a8b9 Use xz prebuilt
Instead of whichever xz happens to be on the PATH.

Bug: 36130900
Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: Ic9b66062ca7947f0eca9d839c0864da492d4ef71
2018-03-09 10:53:26 -08:00
Pirama Arumuga Nainar
8aed42c798 Use a versioned profile file if available
Bug: http://b/74395273

Update profile-search logic to look for profile files named
<profile_file>.<arbitrary-version> in the profileProject and use that if
available.  This works around an issue where ccache serves stale cache
entries when the profile file has changed.

Test: touch toolchain/pgo-profiles/art/dex2oat.profdata.foo and check it
gets used.

Change-Id: I3de095c263b952cede25af7d0b63dc7280914d76
2018-03-09 16:05:54 +00:00
Dan Willemsen
8054f0a9d2 Revert "Fix absolute paths in clang debug output"
This reverts commit 253cab89ee. It is no
longer necessary.

Bug: 36463318
Bug: 72408185
Test: compare output directories after `m libc`
Test: compare treehugger output files
Change-Id: Ib5d7bbc13fa6f547e658247559153c61387e3604
2018-03-08 17:10:54 -08:00
Dan Willemsen
6424d17a2d Allow proto properties in cc/java_defaults
Test: Add proto.canonical_path_from_root: true in a cc_defaults
Test: Add proto.canonical_path_from_root: true in a java_defaults
Change-Id: I9ddfc8af0025705a34b6e487225f1f98915054c3
2018-03-08 13:34:34 -08:00
Ivan Lozano
30c5db2f47 Add minimal-runtime support for integer overflows.
Adds Soong support for -fsanitze-minimal-runtime when using
the integer overflow sanitizers. This makes the crashes due to these
sanitizers less mysterious.

Bug: 64091660
Test: Compiled and checked the generated compiler commands
Test: Checked program that overflows for the abort reason

Change-Id: Ieeceaf6c35c8371592952d3b8b977aefc11601c5
2018-03-07 18:41:20 -08:00
Stephen Hines
d4bc55624a Switch to clang-4639204.
Bug: http://b/68397894
Test: build/run sailfish.
Change-Id: I980cf8458651317b33197253d0b870e66e936d05
2018-03-07 15:36:24 -08:00
Jayant Chowdhary
22963cda0e No abi diffing for vndk libraries which are not vendor available.
Vendor binaries cannot directly link with vndk libraries which are not vendor
available. We don't need them to be abi stable.

Bug: 66301104

Test: cd external/cblas; touch src/cblas_cher.c; mm -j64 does not
      produce an lsdump for libblas, since it isn't vendor available,
      even though it is vndk_enabled: true.

Change-Id: Ib2e1eaa06c4dc2e05623bd7b9aa3a83010f76bd1
2018-03-06 15:01:27 -08:00
Pirama Arumuga Nainar
f975865a12 Merge "Switch to clang-4630689" 2018-03-05 17:57:38 +00:00
Treehugger Robot
83a495830b Merge changes I6f7d40b7,I25654032
* changes:
  add a library to report build numbers without causing rebuilds
  Rewrite symbol_inject to be testable
2018-03-03 03:16:48 +00:00
Colin Cross
86803cfe6e add a library to report build numbers without causing rebuilds
Allow native modules to specify use_version_lib, which will make
an android::build::GetBuildNumber() function available.  For host
builds, the function will return the build number at the time that
the module was linked.  For device modules it will return the
value of the ro.build.version.incremental property.

Bug: 71719137
Test: build_version_test
Test: m build_version_test && touch build/make/core/Makefile build/soong/cc/libbuildversion/tests/build_version_test.cpp && m build_version_test shows different build numbers for binary and library tests.
Change-Id: I6f7d40b7574bb8206866c4e39bad9c710c796e32
2018-03-02 16:55:51 -08:00
Jayant Chowdhary
ea0a2e1928 Disable abi diffs for sanitized variants of modules.
asan variants can sometimes have extra exported symbols (this is a vndk
extension violation). Since asan variants are only used for testing,
don't do abi diffs for them.

Bug: 66301104

Test: Without the change, libc++.so.lsdump exists for the asan variant;
      with the change, it does not.

Test: make -j64.

Change-Id: I61a4c7a3e9aa0028a54ad0ca8715e8c77aebad94
2018-03-02 22:13:15 +00:00
Pirama Arumuga Nainar
4a825ee14a Switch to clang-4630689
Bug: http://b/73127367
Bug: http://b/68659946

These new prebuilts have fixes for the bugs mentioned above.

Test: Build and verify that issues in both bugs above are fixed.
Change-Id: I410a43b70920d509118f8e6fdb012ef6b078d657
2018-03-02 13:38:42 -08:00
Jayant Chowdhary
dcd33b6c29 Create a make variable for all lsdump files.
This is needed so that we can embed the paths of lsdump files in a file,
in order to make lookup faster, while creating reference dumps.

Test: mm -j64 in external/libjpeg-turbo for aosp_arm64_ab;
      out/soong/make_vars-aosp_arm64_ab.mk contains
      SOONG_LSDUMP_PATHS := <list of lsdump paths>

Change-Id: I04608429e1add307cc1ee79d2f0c348fb041613c
2018-03-01 17:19:25 -08:00
Dan Willemsen
540a78c1ce Turn GlobFiles into a Glob for files, use it
GlobFiles had allowed results to be anywhere in the source tree,
restrict it to results within the current module directory.

Then use it for ExpandSources and other places where we only want files.
This fixes using '*' in cc_test's `data` property, which can only
support files.

The only thing this changes today is that java_resource_dirs and
java_resources no longer pass directories to soong_zip's -f argument.
core-libart previously added some icu directories, now it only passes
files.

Bug: 71906438
Test: only expected changes in out/soong/build.ninja
Test: add data: ["**/*"] to a cc_test, build successfully
Change-Id: Iff1bd8c005a48e431c740706d7e23f4f957d8b1d
2018-03-01 14:05:20 -08:00