Commit Graph

679 Commits

Author SHA1 Message Date
Yi Kong 0047dbed14 Fix CLANG_EXTERNAL_CFLAGS logic
Should be neq instead of eq.

Test: build-full.ninja is now correct
Change-Id: I26c0aa84d9b54a8b19f19124978ac1d49bae7448
2018-06-12 15:49:12 -07:00
Yi Kong 42e18966e2 Add external projects only CFlags option
Apply the flags to Android.mk projects as well.

Test: m checkbuild
Change-Id: Ia5f7f7d9d518820fc825dcf19e8fdd2c434e9013
2018-06-06 16:42:22 -07:00
Chih-Hung Hsieh 289e8d6011 Call lld with --pack-dyn-relocs=none if my_pack_module_relocations is false
* Factor out the logic that sets up my_pack_module_relocations
  from dynamic_binary.mk to pack_dyn_relocs_setup.mk.
* Use stand-alone relocation_packer only if my_pack_module_relocations
  is true and my_use_clang_lld is false.

Bug: 80093890
Bug: 73768157
Test: build and boot with USE_CLANG_LLD=true
Change-Id: I7c4b5fcdce0754c57cff4acf86185cac65a26c40
2018-05-31 16:18:22 -07:00
Colin Cross e2f541bb9f Pass 0 to llvm-rs-cc for current
Apparently empty PRIVATE_RS_TARGET_API is not the same as current,
pass 0 explicitly.

Test: forrest ub-renderscript-test
Change-Id: I8b2001b12161f07c404f78f63a80d82dffa1075f
2018-05-16 09:57:10 -07:00
Colin Cross 532ae3bcfb Support LOCAL_RENDERSCRIPT_TARGET_API := current
Renderscript was using LOCAL_RENDERSCRIPT_TARGET_API := 0 to mean
current.  Use current instead, and check for it when comparing
if LOCAL_RENDERSCRIPT_TARGET_API >= 21.

Fixes an issue where LOCAL_RENDERSCRIPT_TARGET_API := 0 was being
treated as < 21, causing the renderscript resources to be passed
to aapt2:
out/target/common/obj/APPS/RSTestBackward_intermediates/flat-res/zip_res.flata.contents/raw/bc32: error: resource file cannot be a directory.

Bug: 79481102
Test: m java FORCE_AAPT2=true
Change-Id: I7726d0463ce1693bc9653b4d869ced181c491036
2018-05-15 15:28:22 -07:00
George Burgess IV 432899a25b Disable dtor inlining for clang-tidy
LLVM r328258 turned on a feature called temporary dtor inlining by
default for all of C++ in clang-tidy. This feature appears to be
somewhat over-aggressive when objects are being passed by value. For
example, given:

void foo(std::unique_ptr<int> i);

void bar() {
  auto x = std::make_unique<int>();
  int *i = x.get();
  foo(std::move(x));
  *i = 99;
}

...clang-tidy will complain about `*i = 99;` being a definite
use-after-free. This is incorrect, however: `foo` could stash the
`unique_ptr` it's given in a global, or a class member, or ...

Until upstream fixes this bug, it's probably best to keep this disabled.

Bug: None
Test: Ran the analyzer across Android locally. Nothing broke; number of
complaints dropped significantly.

Change-Id: I742eedf598a72a533285d913d191bfbbf0ce1688
2018-05-14 15:48:38 -07:00
Chih-Hung Hsieh 4955b857c4 When my_use_clang_lld, link with lld for host.
When USE_CLANG_LLD is true, my_use_clang_lld is true,
and *GLOBAL_LLDFLAGS will be used instead of *GLOBAL_LDFLAGS.

Bug: 73768157
Test: make checkbuild
Change-Id: I2598b72e9edde32f8e57df860571fd107c005540
2018-04-17 15:30:24 -07:00
Chih-Hung Hsieh 32427d6903 Add USE_CLANG_LLD and LOCAL_USE_CLANG_LLD
* Current default is not using lld.
* When USE_CLANG_LLD or LOCAL_USE_CLANG_LLD is true or 1,
  * Use *GLOBAL_LLDFLAGS instead of *GLOBAL_LDFLAGS.
    GLOBAL_LLDFLAGS should call lld and with correct lld flags.
  * set my_pack_module_relocations to false.

Bug: 73768157
Test: make checkbuild
Change-Id: I3e63cf8ae0865d01d2bc1f36e9304f4a5d092cb8
2018-04-12 11:00:06 -07:00
Jiyong Park c3f1356a3a 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 allows platform modules to link to vendor public libraries.
When the name of a vendor public libraries (whose stub is defined via
vendor_public_library in Android.bp) is listed in
LOCAL_SHARED_LIBRARIES, it is actually linked to the stub library which
is available to platform modules.

Bug: 74275385
Test: m -j
Change-Id: I063b43431196190b59332b1bcad59f267073f89f
2018-03-30 10:12:30 +09:00
Justin Yun 65c680e285 Set __ANDROID_API__ for vendor binaries 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: Iccc603f1b5ffa066e74ba1357f3fbbcc13c58f76
2018-03-27 08:22:11 +09:00
Elliott Hughes 1d7d1eb65e Merge "Use the platform -std= for LOCAL_SDK_VERSION targets too." 2018-02-20 15:27:54 +00:00
Elliott Hughes adf7ef8eb9 Use the platform -std= for LOCAL_SDK_VERSION targets too.
Bug: http://b/72571399
Test: builds
Change-Id: Ifd06798a7c9af9fd316201d88b724a53bcf0bcd9
2018-02-16 17:12:21 -08:00
Chih-Hung Hsieh 7ed0db8d1d Remove core/clang/versions.mk and scan-build wrapper
* Use the definitions of ClangDefaultBase and ClangDefaultVersion
  in build/soong/cc/config/global.go.
* scan-build is too old;
  replaced by better clang-tidy's -clang-analyzer-* checks.
* WITH_STATIC_ANALYZER is still effective
  to invoke ccc-analyzer or c++-analyzer.

Test: make checkbuild
Change-Id: Ifd159dd28e529d5d3c9807f5e391911365da8cdb
2018-02-15 13:38:50 -08:00
Stephen Hines 178cf8e4d4 Remove unnecessary USE_CLANG_PLATFORM_BUILD.
This build variable is unnecessary now that GCC is completely
unsupported for Android platform builds.

Bug: http://b/64032869
Test: Builds
Change-Id: I9d44ebd7129cb2bdfbb26d37922db19c6fb9efc9
2018-01-11 14:29:23 -08:00
Dan Albert 19fbd1ce39 Remove support for stlport.
Test: make checkbuild
Bug: None
Change-Id: Iaaaecbe2608fe7a880236f3bbad0fcfcf62b5096
2018-01-05 11:49:43 -08:00
Dan Albert 94f95cf504 Remove support for gnustl.
Test: make checkbuild
Bug: None
Change-Id: Iaddd40b32f84395a76efaaa74be38770085617d5
2018-01-05 11:49:43 -08:00
Dan Albert 4297c39e75 Also restrict NDK linking by static/shared STL.
Test: make checkbuild
Bug: None
Change-Id: I0eb29ec483c069d1c12f444fd2e94cc6eb320f93
2018-01-05 11:49:43 -08:00
Dan Albert 975e303ad2 Restrict NDK link type to matching STLs.
Test: make native
Bug: None
Change-Id: Ie9d9107fe0eeb425843ae2db197e1c60d14a59ca
2018-01-04 12:51:34 -08:00
Chih-Hung Hsieh 4d31b9da8c Call clang-tidy with -fno-caret-diagnostics by default.
* clang -fno-caret-diagnostics
  suppresses warning source lines, carets, and
  the stats line of "n warnings generated"
* clang-tidy -extra-arg-before=-fno-caret-diagnotics
  only suppresses the "n warnings generated" line.
* Pass this flag and -quiet to clang-tidy when
  WITH_TIDY is not 1 or true.
* Remove redundant quotation marks around -extra-arg-before.

Bug: 69051430
Test: normal build and build with WITH_TIDY=1

Change-Id: I9021ee315edc977c15dda6ab246a00182f31fad1
2018-01-04 01:31:37 -08:00
Treehugger Robot 6663c8476a Merge "Depend on the more specific ndk timestamp." 2017-12-16 03:14:43 +00:00
Treehugger Robot 305d2abb27 Merge "Call clang-tidy with -quiet unless WITH_TIDY is set." 2017-12-16 01:53:44 +00:00
Chih-Hung Hsieh 6375b6d730 Call clang-tidy with -quiet unless WITH_TIDY is set.
* Default builds calls clang-tidy only if enabled locally.
  In this case, clang-tidy should be quiet.
* If WITH_TIDY is 1 or true, let clang-tidy emit default messages.
* Even with -quiet and all warnings are suppressed,
  clang-tidy emits one line message of the number of suppressed messages.
  This one-liner could be suppressed in future changes.

Bug: 69051430
Test: default build and build with WITH_TIDY=1
Change-Id: I3138ef45fc4372f904787bd1a391e8d88050f0b3
2017-12-15 15:41:14 -08:00
Dan Albert 3d1d1ead79 Remove support for pre-r13 NDKs.
We only have r16 checked in now.

Test: make native
Bug: None
Change-Id: I1600598cf86f803f9fdcf3fa5ada8d1871c98b65
2017-12-15 15:25:06 -08:00
Treehugger Robot aec47c67cd Merge "Revert "Default NDK modules to libc++_shared."" 2017-12-15 21:39:29 +00:00
Dan Albert 37099686c0 Revert "Default NDK modules to libc++_shared."
This reverts commit 6168f5baf1.

Reason for revert: http://b/70718590

Change-Id: I3e7afe3d1642260c2b5103cb07c636b0b5d72379
2017-12-15 20:01:03 +00:00
Joe Onorato bfc7811441 When compiling with the lite protobuf option, pass the option to aprotoc to force the lite runtime.
With LOCAL_PROTO_OPTIMIZE_TYPE set to one of the lite variants, the build system thinks
the proto should be compiled with lite, and will link in the line runtime libs. But if
the .proto files don't contain the directive to compile the source as lite
(option optimize_for = LITE_RUNTIME;), then the generated code will be full and the
libraries will be full, and it won't link.

Test: make
Merged-In: Ib8a135218d62fa42fa6448c49c97f7aeb2755c42
Change-Id: Ib8a135218d62fa42fa6448c49c97f7aeb2755c42
2017-12-15 08:40:48 -08:00
Dan Albert 6168f5baf1 Default NDK modules to libc++_shared.
Test: make native
Bug: None
Change-Id: I9ca2313c2082e9841a20e240ffca84219a419d49
2017-12-14 14:45:33 -08:00
Dan Albert 248b832d44 Depend on the more specific ndk timestamp.
There are now two NDK sysroot timestamp files: ndk_base which depends
on the headers and stub libraries, and ndk which depends on ndk_base
and the static libraries. For building modules that need the NDK, we
only need to depend on the base sysroot.

Test: make native
Bug: None
Change-Id: I803032eda125a632d780c9cde10f47270491d0d2
2017-12-14 13:52:04 -08:00
Colin Cross 3277ba34ae Add java modules to soong_to_convert.txt
Test: examine soong_to_convert.txt
Change-Id: Ibb6db664238a4e98f5d8885dfb3ddc0f35d11ff6
2017-12-06 15:38:52 -08:00
Chih-Hung Hsieh ab149cbda0 No need to dump modules added -Werror.
* This reduces size of output file wall_werror.txt.
* Stop collecting $(MODULES_ADDED_WERROR)

Bug: 66996870
Test: normal build
Change-Id: Id750cc7fe6489a7654b20740d503226ec6941bbb
2017-12-04 15:23:37 -08:00
Treehugger Robot 6e4e9f32ec Merge changes from topic "system-api"
* changes:
  Fix build error
  Add LOCAL_SDK_VERSION := system_$(VER)
2017-12-01 04:19:45 +00:00
Sundong Ahn 5a44d1f069 Add LOCAL_SDK_VERSION := system_$(VER)
The system_$(VER) can be set in LOCAL_SDK_VERSION, and the apk will use
android_system.jar at build time.
If LOCAL_SDK_VERSION is not defined and this module is installed in
vendor.img, LOCAL_SDK_VERSION is set to system_current.

Bug: 67724799
Test: 1. build && run on taimen
2. LOCAL_SDK_VERSION:=system_27 in ims.apk && build ims.apk && check
the vsdk_v27_intermediates.

Merged-In: I5b11c78b8fcd4a2f2a5e3b141527cd34dbe80018
Change-Id: I5b11c78b8fcd4a2f2a5e3b141527cd34dbe80018
(cherry picked from commit ef212cbe8d)
2017-12-01 00:39:07 +00:00
Dan Willemsen c01ad7b384 Prepare for clang+mingw windows builds
Use $(prefix)CLANG_SUPPORTED from Soong to control whether to use clang
for host builds or not. It's fairly general, but I only expect it to be
used to so that Windows builds can be switched between GCC and Clang
with a single switch.

Also separate native-host-cross from native-host so that it's easier to
build all possible windows modules.

Bug: 69933068
Test: m native-host-cross
Test: switch clang on and off, grep w64.*g++ out/build-aosp_arm.ninja
Change-Id: I205c5bc6739b72a539ece935381107ec1dd5bd48
2017-11-29 21:05:48 -08:00
Treehugger Robot 061fcfc254 Merge "Use the .cfi variant of a static library where needed." 2017-11-22 00:05:30 +00:00
Vishwath Mohan 96a130bdaf Use the .cfi variant of a static library where needed.
This CL repoints static dependencies to their .cfi variants for CFI
enabled targets. It also disables CFI for host targets because the
version of ar intended for hosts does not have plugin support (which
CFI requires).

Bug: 67507323
Test: m -j40
Change-Id: Id11afd0c8765469858f406aace2a192afff6d042
2017-11-21 14:08:20 -08:00
Chih-Hung Hsieh 1876acdd53 Add default -Wall -Werror or -Wall.
* Skip Android.bp, prebuilt, and HEADER_LIBRARIES targets.
* If neither -Wno-error nor -Werror is used, add default -Wall -Werror.
  However, if the build target is in a project
  under one of ANDROID_WARNING_ALLOWED_PROJECTS, add only -Wall.
* Dump name of modules using -Wno-error or added -Wall -Werror
  into file $(PRODUCT_OUT)/wall_werror.txt.

Bug: 66996870
Test: normal build
Change-Id: Ief8cf776e8613ed073a64dd271534688845d5c2c
2017-11-17 14:06:35 -08:00
Ryan Campbell a435aa5171 Use space-separated coverage paths.
Specify paths to instrument with coverage using space separated lists
instead of comma separated. This makes it easier to specify the lists in
a typical format in the device mk.

Test: add COVERAGE_PATHS to device-sailfish.mk, make -j60
Bug: 67998360
Change-Id: I26c67127d72bd7a153eb4a2c23eae4881a813d54
2017-10-22 19:10:09 +00:00
Jiyong Park a3fb1588f4 Prevent vendor libs from depending on private VNDK libraries
For module installed to /vendor partition, direct linking to the libs
marked as `vendor_available: false` is not allowed. The

Bug: 64730695
Test: Add vendor_available: false to libft2 and
libcompiler_rt. Add the two libs into LOCAL_SHARED_LIBRARIES of a vendor
lib (e.g. libdrm). Build fails with the link_type check error message.

Change-Id: Iaf23574ceddb0c087111e1d95997e9ddd60cdf87
2017-10-10 19:38:06 +09:00
Treehugger Robot 5118763940 Merge "Add -lm to the default libs for Linux & Darwin" 2017-09-27 07:08:57 +00:00
Dan Willemsen a3a06feeed Add -lm to the default libs for Linux & Darwin
libm is a default library for device builds, so default it for host
builds as well.

Also removes duplicate additions of -ldl, -lpthread, -lm and -lrt.

Test: m host
Change-Id: I6a07e12053090eb6997b79d4091c28ac9a9022de
2017-09-26 20:26:11 -07:00
Dan Willemsen 4dbb354514 Check available host libraries
Soong has a list of allowed host libraries. Check that list for make
modules as well.

Test: build/soong/build_test.bash (Linux&Darwin, aosp&internal)
Test: Add bad library in LOCAL_LDLIBS, ensure it errors
Change-Id: Icc48533487576998b049dc6c704c410172a91521
2017-09-26 00:14:01 -07:00
Colin Cross 0bd335f9b0 Make -ldl -lrt -lpthread implicit for host builds
Instead of requiring every host module to specify -ldl -lrt -lpthread
and then break the mac build because -lrt doesn't exist, make them
implicit to match the behavior of modules built for the device.

Test: m -j checkbuild
Change-Id: I7b5b5289a41cd8f6e7dc2da59400955d867ee783
2017-09-08 16:43:55 -07:00
Jiyong Park a0f2b2a286 Merge "cxx_stl_setup is not executed for modules from soong"
am: 9b18ed094c

Change-Id: I08bfd781403ed0b7dd68de2e1045f1fa194bc8f5
2017-08-18 07:16:54 +00:00
Treehugger Robot 9b18ed094c Merge "cxx_stl_setup is not executed for modules from soong" 2017-08-18 07:11:41 +00:00
Jiyong Park 425d489cb9 cxx_stl_setup is not executed for modules from soong
cxx_stl_setup is adding libunwind_llvm to the dependency even for
modules from soong. However, since this dependency was already handled
in soong, those modules don't need to go through it again.

Bug: 64815735
Test: BOARD_VNDK_VERSION=current mma -j (under /hardware/libhardware)

Change-Id: Id6e2547c752ec831aa56a14c0bf4db0a55d51243
2017-08-18 13:46:04 +09:00
Dan Albert 21751a0a67 Merge "Use the min sdk version from soong."
am: 22b45d401a

Change-Id: I3baca77b2774eb93168f6b888f08e8f0e56a1a10
2017-08-18 02:44:33 +00:00
Dan Albert 105e4fe0a6 Use the min sdk version from soong.
Test: make checkbuild
Bug: None
Change-Id: I0306803cebf98748503b7e217db0f0f5959bf4f7
2017-08-17 16:37:49 -07:00
Yifan Hong 6dc0978c5f Merge "Vendor modules in make also have __ANDROID_VNDK__ defined."
am: 9bd6605abe

Change-Id: I7b6fc17cdd244ba6c6a266e0a0951b3a573119c5
2017-08-02 03:45:15 +00:00
Treehugger Robot 9bd6605abe Merge "Vendor modules in make also have __ANDROID_VNDK__ defined." 2017-08-02 03:39:33 +00:00
Yifan Hong d7aa8417de Vendor modules in make also have __ANDROID_VNDK__ defined.
Bug: 64277220
Test: BOARD_VNDK_VERSION m -j
Change-Id: Ia9811ea526d0878b539c8c3da9e82e6bf33fe8e8
Merged-In: Ia9811ea526d0878b539c8c3da9e82e6bf33fe8e8
2017-08-01 18:54:10 -07:00