Commit graph

3281 commits

Author SHA1 Message Date
Jiyong Park
73c54ee7fe native shared libs in an SDK can be snapshotted
The snapshot script can now handle native shared libs in an SDK.

Bug: 138182343
Test: create following sdk module:
sdk {
    name: "mysdk",
    native_shared_libs: ["libc", "libdl"],
}
, then execute `m mysdk` and execute the update_prebuilt-1.sh as
prompted. Following directories are generated under the directory where
mysdk is defined at:

1
├── aidl
├── Android.bp
├── arm64
│   ├── include
│   ├── include_gen
│   └── lib
│       ├── libc.so
│       └── libdl.so
├── include
│   └── bionic
│       └── libc
│           └── include
│               ├── alloca.h
│               ├── android
│               │   ├── api-level.h
<omitted>

Change-Id: Ia1dcc5564c1cd17c6ccf441d06d5995af55db9ee
2019-10-29 12:27:35 +09:00
Kris Alder
f979ee3873 add additional fields to cc_fuzz build types
Specifically, this adds:
* Owner
* Disable (stop fuzzer from running in Haiku)
* Bug Component
* Bug Hotlist

The fields are all inside a new 'options' struct.

The values from these fields (if any) are written into a config file as
json.

Bug: 142551000
Test: ran locally with a modified build file and verified output in .zip
Change-Id: I86edf74c2cebe9912ac0ad203f99028be4062c8b
2019-10-28 16:15:50 -07:00
Ivan Lozano
183a3218e2 Add a common interface for cc linkable libraries.
Adds an interface, CcLinkableInterface, for cc linkable dependencies
which come from other toolchains such as Rust.

Bug: 140726209
Test: Soong tests pass, rust modules still compile.
Change-Id: I7378a46fad94fd0b735746aaf4e265fd2c2c04d8
2019-10-28 13:45:12 -07:00
Ryan Prichard
ce6b216c5e Merge "Stop linking libdl.a into static bins" 2019-10-28 20:14:37 +00:00
Jooyung Han
6db2f177db Partial reverts of vndk-apex
This installs vndk libs under system/lib/vndk
instead of vndk-apex.
(Partial reverts of 31c470b5d5)

Also fixes the bug 097087be53 brought.
This produced incomplete list of vndkcorevariant.libraries.txt.

Bug: 143374795
Test: m && boot
Change-Id: I17864de4770a84431756e0c3765b601d3dc2abb1
2019-10-28 14:12:48 +09:00
Treehugger Robot
b480debbd8 Merge "Change exportedDirs and exportedSystemDirs from []string to android.Paths" 2019-10-28 02:24:41 +00:00
Treehugger Robot
7d6b21c265 Merge "Soong generates libraries.txt files for vndk" 2019-10-26 01:52:39 +00:00
Jooyung Han
7289ddbeba Merge changes from topic "add-vndk-again"
* changes:
  add symlink for compatibility (vndk apex)
  Revert "Revert "Add __ANDROID_APEX_<NAME>__ for apex variants""
  Revert "Revert "Supports VNDK APEX with different versions""
2019-10-25 08:21:13 +00:00
Yi Kong
00ae8b3996 Merge "Repack libgcc.a to only include required objects" 2019-10-25 08:00:58 +00:00
Ryan Prichard
b49fe1bde7 Stop linking libdl.a into static bins
libdl.a has a no-op dlopen, which breaks static libraries that need a real
dlopen. Instead of automatically linking libdl.a into static executables,
make it optional.

Until recently, the libunwind_llvm.a unwinder, used on arm32, needed the
no-op dladdr, but it's now built using -D_LIBUNWIND_USE_DLADDR=0.

The HWASan run-time uses dlsym and dladdr, so add a libdl dependency for
HWASan-built static binaries. We could also remove the dependency from
libclang_rt.hwasan_static-*.a, but this is also easy to do.

Bug: http://b/141485154
Test: bionic unit tests, device boots, verify that static and dynamic
   executables can throw/catch an exception
Test: verify that a static executable using dlopen doesn't link (unless it
   adds an explicit dependency on libdl)

Change-Id: Ic52c3f336b671b4ed335e99c94a64dfe8614b618
2019-10-24 22:25:54 -07:00
Jooyung Han
097087be53 Soong generates libraries.txt files for vndk
These files were generated by Make. This is an effort to converting make
to soong.

These files are created under a known location: $SOONG_OUT_DIR/vndk
- llndk.libraries.txt
- vndksp.libraries.txt
- vndkcore.libraries.txt
- vndkprivate.libraries.txt
- vndkcorevariant.libraries.txt
- vndk.libraries.txt: merged all of above with tags

The last one is used by 'check-vndk-list'.
(See the topic)

Others will be packaged by VNDK APEX of current VNDK.
(This is not merged yet. After landing, a follow-up CL will be
followed.)

Bug: 141019581
Bug: 141450808
Test: m check-vndk-list
Change-Id: I9a24f6975bd4b226a94f61a13d43857dcdce6b88
2019-10-25 14:08:28 +09:00
Jiyong Park
7495504db4 Change exportedDirs and exportedSystemDirs from []string to android.Paths
exportedDirs and exportedSystemDirs are now changed to android.Paths so
that we can later manipulate the paths via Rel(), etc.

Test: m

Change-Id: I6fb02ea4983bcebac351bc284f75b44885379e8f
2019-10-25 09:52:08 +09:00
Yi Kong
c49c393f73 Repack libgcc.a to only include required objects
Previous solution by using objcopy uses a quirky behaviour of the GNU
objcopy and there is no equivalent option in llvm-objcopy.

Instead of removing symbols, extract and repack libgcc to only include
required objects.

Bug: 142585047
Test: presubmit
Change-Id: I58af74c18838f797e481da38c3265f0624fddf99
2019-10-24 16:34:54 -07:00
Treehugger Robot
ac1b07e2dc Merge "fix: Override vndk-ext lib name with original lib" 2019-10-24 22:38:00 +00:00
Dan Willemsen
89dad60ed5 Add support for 10.15 SDK
I haven't found any issues so far.

Test: try the build
Change-Id: I1e2f4095795daead6eb96280d60a122c51ba66ba
2019-10-22 17:01:15 -07:00
Jooyung Han
4c2b942e92 fix: Override vndk-ext lib name with original lib
vndk-ext should have the same output filename with the lib which it
extends. "extends" property is "module name", not "filename" of output.

Bug: 143130384
Test: add "protox" as a vndk-ext module (extends 'libprotobuf-cpp-full')
      m protox.vendor && check output filename under /vendor/lib/vndk/
      (should have correct suffix)

Change-Id: I5741ea87b4f2ad375b69f54c93dcb8753d9952dd
2019-10-22 20:01:28 +09:00
Jooyung Han
7798857a0d Revert "Revert "Add __ANDROID_APEX_<NAME>__ for apex variants""
This reverts commit 12f629b26d.

Bug: 142582178
Test: m (soong test added)
2019-10-19 02:28:39 +09:00
Jooyung Han
31c470b5d5 Revert "Revert "Supports VNDK APEX with different versions""
This reverts commit 48dd4b5ea4.

Bug: 141451661
Bug: 139772411
Test: m (soong tests)
Test: boot with aosp_arm64 system image on Q vendor device
2019-10-19 02:28:39 +09:00
Pete Bentley
ab65ba9481 Handle partial link of a single object with a linker script.
Fixes: 142931094
Test: m bssl with -DNO_ASM and all assembly sources commented out
Change-Id: Id56d325fbf1d4a0777944512a88f3c086e930af7
2019-10-18 12:42:18 +01:00
Treehugger Robot
43bfaf9f65 Merge "Re-plumb fuzz corpora." 2019-10-18 02:43:26 +00:00
Treehugger Robot
c5bba642f1 Merge "Prohibit dependencies outside of uses_sdks" 2019-10-18 00:30:18 +00:00
Mitch Phillips
8a2bc0b9fd Re-plumb fuzz corpora.
Re-plumb the fuzz corpora through an intermediates directory.
Previously, due to the way that LOCAL_TEST_DATA is implemented, we would
break when corpora were included:
 a) outside of a corpus/ directory, or
 b) not directly under the module directory (i.e. my_module/subdir/corpus)

Corpora are now written into an intermediates directory so that they
play nice with LOCAL_TEST_DATA, because unfortunately the key-value pair
required there is not as simple as source:destination.

Test: m example_fuzzer && ls \
$ANDROID_PRODUCT_OUT/data/fuzz/arm64/example_fuzzer/corpus
Bug: N/A

Change-Id: I5888b06ed349781c6712f1ae77cc3582283a9552
2019-10-17 16:11:00 -07:00
Treehugger Robot
81a4016f61 Merge "Add android.hardware.neuralnetworks@1.3" 2019-10-17 22:47:15 +00:00
Treehugger Robot
7617fc2fab Merge "Extend ALLOW_MISSING_DEPENDENCIES coverage" 2019-10-17 19:46:53 +00:00
Colin Cross
ad4a597c79 Merge "Add method to determine variations from a Target" 2019-10-17 18:52:20 +00:00
Treehugger Robot
a8f91ec00d Merge "Revert "Supports VNDK APEX with different versions"" 2019-10-17 11:50:47 +00:00
Treehugger Robot
50dce7372b Merge "Revert "Add __ANDROID_APEX_<NAME>__ for apex variants"" 2019-10-17 11:50:47 +00:00
Isaac Chen
2c0a180be0 Extend ALLOW_MISSING_DEPENDENCIES coverage
Make build system respect ALLOW_MISSING_DEPENDENCIES, when building
architecture B products, and ignore targets with dependencies that
are not available for architecture B.

Bug: 142701187
Test: # Add a dummy Android.bp with a module only for arm64
      $ m -j TARGET_PRODUCT=aosp_x86 TARGET_BUILD_VARIANT=userdebug

Change-Id: I64de33674732df8c286671c806a07bcd19862b80
2019-10-17 11:02:21 +08:00
Jiyong Park
a7bc8ad0b9 Prohibit dependencies outside of uses_sdks
When an APEX is built with uses_sdks, any depedndency from the APEX to
the outside of the APEX should be from the SDKs that the APEX is built
against.

Bug: 138182343
Test: m

Change-Id: I1c2ffe8d28ccf648d928ea59652c2d0070bf10eb
2019-10-17 11:19:53 +09:00
Jooyung Han
12f629b26d Revert "Add __ANDROID_APEX_<NAME>__ for apex variants"
This reverts commit d29e551efd.

Reason for revert: some targets are broken

Bug: 142773030
Change-Id: I50ac6842ab8aa572c11262ee0ec965ddbe903b0e
2019-10-16 23:51:09 +00:00
Jooyung Han
48dd4b5ea4 Revert "Supports VNDK APEX with different versions"
This reverts commit 394951da73.

Reason for revert: some targets are broken

Bug: 142773030
Change-Id: I4ce2e4a4c683c71958bc4f73e45a5ddd4a4ae32a
2019-10-16 23:50:39 +00:00
Colin Cross
0f7d2ef3ac Add method to determine variations from a Target
The arch variants are hardcoded in every module type.  Refactor
them out into a Target.Variations() method in preparation for
splitting the arch mutator into two, which will require using
different variations.

Test: m checkbuild
Change-Id: I28ef7cd5168095ac888fe77f04e27f9ad81978c0
2019-10-16 14:52:30 -07:00
Treehugger Robot
959a3ffbda Merge "Fuzz corpus entries should not go in a subdirectory." 2019-10-16 21:09:59 +00:00
Treehugger Robot
98eccba8b4 Merge "Do not link libc++.so statically on device." 2019-10-16 20:28:54 +00:00
Treehugger Robot
83246459d1 Merge "Workaround unexported sancov symbols. Fix multiple sanitizer RT deps." 2019-10-16 20:28:38 +00:00
Elliott Hughes
60ee98582c Merge "Revert "-D__ANDROID_NDK__ for SDK builds."" 2019-10-16 16:01:14 +00:00
Slava Shklyaev
7779766411 Add android.hardware.neuralnetworks@1.3
Bug: 139120468
Test: m
Change-Id: I4f305a7698f2d9ec5f8f4244124570d9318b58a1
Merged-In: I4f305a7698f2d9ec5f8f4244124570d9318b58a1
(cherry picked from commit f4b5a5ba08)
2019-10-16 14:01:25 +01:00
Pirama Arumuga Nainar
a60e81853f Merge "Pass -static-libgcc to Windows link commands" 2019-10-16 03:06:30 +00:00
Treehugger Robot
a4cdb8dd40 Merge "add [static|shared].apex_available to cc_library" 2019-10-16 02:09:44 +00:00
Pirama Arumuga Nainar
105cab2b5a Pass -static-libgcc to Windows link commands
This was unnecessary in the past, when -nodefaultlibs was used while
linking, but that changed with
aosp/I722bd6596a1f3f5819f2767c29c0fa1e8b3ec0e8.

Test: simpleperf_ndk64.exe no longer depends on libgcc_s_seh-1.dll.
Change-Id: I435d7302906eb3758e758b5aefca8763bfba6290
2019-10-15 13:58:30 -07:00
Jiyong Park
a90ca00786 add [static|shared].apex_available to cc_library
apex_available property can be appended differently per the linkage
type. This will be used to restrict certain libs (e.g.
libc_malloc_debug) to an APEX while allowing them to be statically
linkable from platform for testing purpose.

Test: m (apex_test amended)
Change-Id: I6dec23129c5ac93a3ef06fea28f26f240c0ba410
2019-10-15 15:28:07 +09:00
Mitch Phillips
302f964aa0 Do not link libc++.so statically on device.
If fuzzer coverage sanitized shared libraries are not deployed - we shouldn't
break users during dynamic link time. I need to think more about how we
should solve this problem in earnest, but for now let's just disable
static linkage of libc++ on device.

Bug: 142671952
Test: Cherrypick ag/9550833 and ag/9544155, make and run the fuzz target
there.

Change-Id: I39dfd6ba314e7a610ef3f0b30f35383a5e3a1e4b
2019-10-14 18:35:17 -07:00
Jooyung Han
d29e551efd Add __ANDROID_APEX_<NAME>__ for apex variants
With __ANDROID_APEX_<NAME>__ definition, native modules may have
different behavior when it is built for a specific apex module.

Previously, the name is passed as value of definition __ANDROID_APEX__
like -D__ANDROID_APEX__=com.android.foo. But it is difficult to do
conditional compilation with it.

Now, since the name is incorporated into definition itself, it gets
easier to set #ifdef condition.

Bug: 142582178
Test: m (soong test added)
Change-Id: I3c90c789fa692a19addf2e5a7c8d4cc571cde112
2019-10-15 07:34:02 +09:00
Jooyung Han
394951da73 Supports VNDK APEX with different versions
Older VNDK libraries are provided as vndk_prebuilt_shared modules. Those
are added to corresponding VNDK APEX as dependencies.

With VNDK APEX installed, VNDK libs are unnecessary. By the way, since
there can be vendor modules which depend on VNDK libs, Make targets are
still emitted with UNINSTALLABLE=true.

Android.mk has additional modules for vndk libraries which are named
with apex name as suffices. For example, if libfoo is a vndk library,
then libfoo.vendor is its vendor variant and it would be in
/system/lib/vndk. But with vndk apex, it has additional
libfoo.com.android.vndk.current variant.

Bug: 141451661
Bug: 139772411
Test: m (soong tests)
Test: boot with aosp_arm64 system image on Q vendor device
Change-Id: I269c28a4d4c4e2f1518bd51df558438fe5316774
2019-10-15 07:33:49 +09:00
Elliott Hughes
a11242da49 Revert "-D__ANDROID_NDK__ for SDK builds."
This reverts commit c324729692.

Reason for revert: defined in bionic instead (https://android-review.googlesource.com/c/platform/bionic/+/1135146).

Change-Id: Ia5d4d1b087cd43e14919a5791b44d4816ecbb434
2019-10-11 01:25:04 +00:00
Mitch Phillips
b8e593d600 Workaround unexported sancov symbols. Fix multiple sanitizer RT deps.
Fuzz targets currently have dependencies on multiple libclang_rt runtime
libraries when building with ASan/HWAsan on device. This is an error.

This happens as Soong adds the dependency on the ASan/HWASan shared
runtime library. These libraries should provide the required UBSan
components. The clang driver was previously being passed
-fsanitize=fuzzer-no-link at link time, and as it doesn't know about the
already-established dependency on ASan/HWASan, it mistakenly thinks that
there is not runtime providing the UBSan components.

This patch fixes that problem by not adding -fsanitize=fuzzer-no-link to
the link-time flags.

This revealed a underlying issue in the upstream runtime compilation.
Android uses emulated TLS, which changes the symbol names from
<my_symbol_name> to __emutls_v._<my_symbol_name>. In particular, this
fails to account for the '__sancov_lowest_stack' symbol, as it no longer
matches the linker script rule for '__sancov*', and the symbol is no
longer exported in the shared library variant of ASan/HWASan.

This patch works around the discovered issue, which is being tracked in
the linked bug. It disables stack depth instrumentation, and we no
longer depend on this symbol. This means we get a missing sanitizer
coverage feature when fuzzing, but shouldn't be too detrimental.

Bug: 142430592
Test: SANITIZE_TARGET=hwaddress m example_fuzzer && \
readelf -d example_fuzzer # ensure only ONE libclang_rt dep (in this
case, hwasan)

Change-Id: Iea6df55d592a801732511c9b690134367429d62a
2019-10-10 10:53:48 -07:00
Lev Proleev
d84ed52753 Revert "Add android.hardware.neuralnetworks@1.3"
This reverts commit 3cf57d72ce.

Reason for revert: the topic breaks git_qt-dev-plus-aosp

Change-Id: I4ee625982dac1b12755e9ebc6e0cdb2bfbd25613
2019-10-10 13:54:14 +00:00
Mitch Phillips
641575ad41 Fuzz corpus entries should not go in a subdirectory.
Corpus files called 'FOO' incorrectly go into a subdirectory in the
exported zipfile, e.g.:
my_fuzzer/corpus/FOO/FOO

This patch removes that extra, unnecessary intermediate directory,
e.g.:
my_fuzzer/corpus/FOO

Bug: 142432347
Test: m fuzz && unzip -l out/soong/fuzz-host-x86_64.zip
Change-Id: Id23d4dd2d8322a8ad0234f8acb6878ea4dc3c6e4
2019-10-09 17:34:42 -07:00
Slava Shklyaev
3cf57d72ce Add android.hardware.neuralnetworks@1.3
Bug: 139120468
Test: m
Change-Id: Iee24fd8e70805eab3e352186e543fe02246a6a72
Merged-In: Iee24fd8e70805eab3e352186e543fe02246a6a72
(cherry picked from commit f4b5a5ba08)
2019-10-08 16:58:43 +01:00
Treehugger Robot
e89b8fb919 Merge "Remove no_apex in favor or apex_available" 2019-10-08 05:33:29 +00:00
Treehugger Robot
c6136c9d65 Merge "Remove old-style support for translated second architectures" 2019-10-07 20:48:07 +00:00
Treehugger Robot
96ce6ab143 Merge "Use localPool consistently for UseGoma() == true" 2019-10-04 18:36:07 +00:00
Colin Cross
92e03dfb3e Merge "Use -nostdlib++ instead of -nodefaultlibs" 2019-10-04 03:26:11 +00:00
Colin Cross
f7a17daefe Use -nostdlib++ instead of -nodefaultlibs
Host builds using libc++ used -nodefaultlibs to turn off the default
C++ runtime, and then added back all the other necessary libraries.
Clang supports -nostdlib++ since https://reviews.llvm.org/D47115
that removes the C++ runtime without affecting the other default
libraries.  Use -nostdlib++, and remove the lists of default
libraries.

Test: m checkbuild
Change-Id: I722bd6596a1f3f5819f2767c29c0fa1e8b3ec0e8
2019-10-03 16:09:01 -07:00
Colin Cross
ff6c33d885 Replace RelPathString() with ToMakePath()
Add a ToMakePath() method that returns a new path that points out
out/ instead of out/soong/, and replace the
"$(OUT_DIR)/" + path.RelPathString()
pattern with
path.ToMakePath().String()

Bug: 141877526
Test: m checkbuild
Change-Id: I391b9f2ed78c83a58d905d48355ce9b01d610d16
2019-10-03 10:07:53 -07:00
Colin Cross
70dda7e3da Separate InstallPath from OutputPath
Create a new type InstallPath that is similar to OutputPath to
differentiate intermediates output paths from installed output
paths.

RelPathString is a poorly defined, undocumented function that is
primarily used to get an install path relative to out/soong to
generate an equivalent install path for Make relative to $(OUT_DIR).
Move it to InstallPath for now, and fix the one remaining user on
OutputPath.

Add a method to create an NDK install path so that ndk_sysroot.go
doesn't have to do it manually with PathForOutput.

Bug: 141877526
Test: m checkbuild
Change-Id: I83c5a0bd1fd6c3dba8d3b6d20d039f64f353ddd5
2019-10-03 10:07:53 -07:00
Treehugger Robot
62be1e3e33 Merge "Hide static from cc_library_shared and vice versa" 2019-10-02 21:39:37 +00:00
Treehugger Robot
b244e84de6 Merge "Use SHA-256 for hashing BoringSSL crypto module." 2019-10-02 15:59:36 +00:00
Yi Kong
444c809bbc Merge "Remove -Wno-c++98-compat-extra-semi warning flag" 2019-10-02 05:16:46 +00:00
Jiyong Park
7916bfc3cc Remove no_apex in favor or apex_available
This change reverts following three changes to remove the no_apex
property. no_apex: true is equivalent to apex_available:
["//apex_available:platform"].

Revert "fix: "no_apex" can be put in defaults"
This reverts commit cc372c5b1d.

Revert "Add no_apex check for static library"
This reverts commit 2db7f46d0c.

Revert "Add no_apex property"
This reverts commit 4f7dd9b4db.

Bug: 139870423
Bug: 128708192
Test: m

Change-Id: Ia4b094e371e9f8adff94ae6dc3ebb8e081381d4e
2019-10-02 14:12:16 +09:00
Yi Kong
d0ce0fbfde Remove -Wno-c++98-compat-extra-semi warning flag
hidl/aidl actually does concern about this warning. After fixing their
codebase, this flag is no longer needed.

Test: presubmit
Change-Id: Id88abea88137be0f873c21db76644fe78b9045c8
2019-10-01 22:42:59 +00:00
Colin Cross
2e2dbc250a Use localPool consistently for UseGoma() == true
Remove the distinction between pctx.StaticRule and
pctx.AndroidStaticRule so that all of the local rules correctly
get assigned to the localPool.  Also put Module and Singleton
rules into the localPool.

Test: compare out/soong/build.ninja
Change-Id: Id2bb38eff3c7209340fe55bc9006f00bd3661d81
2019-10-01 14:11:20 -07:00
Treehugger Robot
f856c005cb Merge changes from topic "soong_c_flags"
* changes:
  Creation of C Flags Build Variables
  Move sharding functions for reuse
2019-10-01 19:25:50 +00:00
Pete Bentley
5c4be82ce0 Use SHA-256 for hashing BoringSSL crypto module.
Reason: Performs significantley better than SHA-512
on ARM64 devices

Bug: 141710485
Test: flashall
Change-Id: I40f0873d3e705a75b9a7a3ba1445a9176afff77b
2019-10-01 17:03:17 +01:00
Treehugger Robot
ec3b133b8b Merge "Move fuzz phony to be make-defined, and add to dist." 2019-09-30 20:24:19 +00:00
Mitch Phillips
a0a5e19140 Move fuzz phony to be make-defined, and add to dist.
Add the fuzz packages to dist. This requires that the phony for 'make'
be define in make itself, rather than in Soong. See comments on other
patch in topic for more information.

Bug: 141026328
Test: m fuzz dist

Change-Id: I4cd476adcfa42e4b40911c4a32427a7b00c67cc3
2019-09-30 10:36:11 -07:00
Jesse Pai
4d33666639 Creation of C Flags Build Variables
Modifications made to soong/cc to look for specific C Flags used by
Android modules and store name of module into a build variable array.

Bug: 140442588
Test: Executed m dist and presubmit
Change-Id: If46a11462369c43bbcd445156aff0641514c58b1
2019-09-30 16:24:16 +00:00
Treehugger Robot
318c9c5d17 Merge "Pass filename mappings to C++ and Java extractors." 2019-09-27 20:00:44 +00:00
Peter Collingbourne
bcb5ca006c Merge "Allow sanitize attribute on cc_objects and propagate sanitize attributes into them." 2019-09-27 19:31:13 +00:00
Sasha Smundak
651436460a Pass filename mappings to C++ and Java extractors.
Android builds by default put artifacts into out/ subdirectory of
the source tree, causing the extractor to record their names as
relative. The indexer considers such files as sources, which is wrong.
Fortunately, the extractor can be fed a set of filename rewriting
rules (see build/tools/vnames.json).
Also, undo previous unsuccessful attempt use to absolute path for the
output directory to distinguish between source code and artifacts.

Bug: 141385476
Test: run the build, inspect compilation units of the kzip file
Change-Id: I89ec3aed8fd14f43ea6e0b226d54f643346f6125
2019-09-27 10:28:11 -07:00
Dan Shi
6ffaaa830d Allow test to specify whether or not to auto-generate test config
Attribute `auto_gen_config` is added to test modules.
Test config will be generated if:
the attribute is not set and AndroidTest.xml doesn't exists
or
the attribute is set to true, whether or not AndroidTest.xml exists.

Test config will NOT be auto-generated if:
the attribute is not set and AndroidTest.xml exists
or
the attribute is set to false, whether or not AndroidTest.xml exists.

Bug: 141684102
Test: build test module with auto_gen_config set to true
Change-Id: I64fb003a83d8c32a967835e5f8d12fe4476043be
2019-09-26 13:29:28 -07:00
Peter Collingbourne
1c648b8936 Allow sanitize attribute on cc_objects and propagate sanitize attributes into them.
Without this change, we can end up failing to sanitize parts of libraries
that are compiled as cc_objects, such as bcm_object.o in boringssl. This
is normally harmless (except that the sanitizer would fail to detect bugs
in unsanitized code), however boringssl in particular needs to be compiled
with HWASAN enabled in all translation units in order to avoid link errors
with newer toolchains that support HWASAN global instrumentation.

Change-Id: Ib8bd325f76b7852cab435bff79d6945768298a5c
2019-09-26 12:35:06 -07:00
Jooyung Han
5e493d5660 Merge "fix: "no_apex" can be put in defaults" 2019-09-26 01:07:21 +00:00
Daniel Norman
488e7e02a2 Merge "Performs same checks as aidl_interface.go before stripping leading "I"." 2019-09-26 00:33:57 +00:00
Jooyung Han
cc372c5b1d fix: "no_apex" can be put in defaults
Currently, putting no_apex in defaults module doesn't work.

To fix this,
* 'no_apex' property is added as 'defaultable'.
* apex module doesn't follow beyond 'defaults' module.

Bug: 141560644
Test: m (soong tests added)
Change-Id: I8410785f7f83d843689a33b1241d74086c6a7671
2019-09-25 15:27:47 +09:00
Treehugger Robot
72b43adb56 Merge "Add 'make fuzz' build rule." 2019-09-25 06:14:41 +00:00
Mitch Phillips
d3254b4899 Add 'make fuzz' build rule.
Adds the `make fuzz` build rule. This offers a few features on top of
`make haiku`:
 1. Identifies all fuzz targets through the build system, rather than
 having to maintain a golden file.
 2. Packages now exist in out/soong/ and are packaged on a per-architecture
 basis. Packages also now contain fuzzer seed corpus && dictionary.
 3. This gives us further extension options:
  - Packaging shared libraries for shared library fuzzing.
  - Presubmit tests for fuzzing. Each fuzz target could be made into a
  regression test by adding the crash testcase to the corpus. We can
  also ensure that example_fuzzer finds a bug with an ASan report as a
  presubmit smoke test.

Bug: 141026328
Test: m fuzz && unzip -l out/soong/fuzz-$ARCH.zip

Change-Id: I7aaad616d6b194a3beaf908241a9817df9dfdce1
2019-09-24 20:48:00 -07:00
Daniel Norman
10b743509e Performs same checks as aidl_interface.go before stripping leading "I".
Test: building AIDL interface named IntEnum.aidl. Leading I is not
removed.
Change-Id: Ia40cbdf9b8936f6f58a99971eae1b2138a678c91
2019-09-24 17:41:15 -07:00
Colin Cross
e1bb5d092a Hide static from cc_library_shared and vice versa
The static properties don't make sense for cc_library_shared
modules, and the shared properties don't make sense for
cc_library_static modules.  Move them into separate property
structs so they can be added conditionally.

Test: m nothing
Test: DefaultsTest
Change-Id: I0b0cedf9eba07deb721fae138ffa7bedcfbfe71e
2019-09-24 15:05:57 -07:00
Ivan Lozano
f23f6d20f0 Merge changes from topic "add_rust_arm64_devices"
* changes:
  Add ARM32 device Rust toolchain.
  Add AArch64 device Rust toolchain.
2019-09-24 21:39:51 +00:00
Ivan Lozano
f1c8433b40 Add AArch64 device Rust toolchain.
Bug: 141207434
Test: build example rust device module.
Change-Id: I0932a614942bf4a4d4b6c153fcc4fc79c7f202bd
2019-09-24 10:35:28 -07:00
Yi Kong
aefd0af575 Merge "Remove -Wno-format-pedantic cflag" 2019-09-23 17:48:21 +00:00
Treehugger Robot
b1102ba828 Merge "Introduce module type 'sdk'" 2019-09-23 04:38:24 +00:00
Jiyong Park
d1063c1586 Introduce module type 'sdk'
This change introduces a new module type named 'sdk'. It is a logical
group of prebuilt modules that together provide a context (e.g. APIs)
in which Mainline modules (such as APEXes) are built.

A prebuilt module (e.g. java_import) can join an sdk by adding it to the
sdk module as shown below:

sdk {
    name: "mysdk#20",
    java_libs: ["myjavalib_mysdk_20"],
}

java_import {
    name: "myjavalib_mysdk_20",
    srcs: ["myjavalib-v20.jar"],
    sdk_member_name: "myjavalib",
}

sdk {
    name: "mysdk#21",
    java_libs: ["myjavalib_mysdk_21"],
}

java_import {
    name: "myjavalib_mysdk_21",
    srcs: ["myjavalib-v21.jar"],
    sdk_member_name: "myjavalib",
}

java_library {
    name: "myjavalib",
    srcs: ["**/*/*.java"],
}

An APEX can specify the SDK(s) that it wants to build with via the new
'uses_sdks' property.

apex {
    name: "myapex",
    java_libs: ["libX", "libY"],
    uses_sdks: ["mysdk#20"],
}

With this, libX, libY, and their transitive dependencies are all built
with the version 20 of myjavalib (the first java_import module) instead
of the other one (which is for version 21) and java_library having the
same name (which is for ToT).

Bug: 138182343
Test: m (sdk_test.go added)
Change-Id: I7e14c524a7d6a0d9f575fb20822080f39818c01e
2019-09-22 08:21:27 +09:00
Yi Kong
011aaa46c5 Remove -Wno-format-pedantic cflag
This is no longer needed.

Test: presubmit
Bug: 20148343
Change-Id: Ie377b3cd183ae89bc159c3b31c64960bce3bc753
2019-09-20 17:24:21 -07:00
Treehugger Robot
83dcee3094 Merge "soong: -Werror=fortify-source" 2019-09-20 23:49:33 +00:00
George Burgess IV
6c691644f7 soong: -Werror=fortify-source
Recently, we started deferring to clang for some of its built-in
FORTIFY-like warnings. We should always treat these as errors, since
they represent potential security vulnerabilities.

Bug: 131861088
Test: m. Also made a compilation in Bionic fail; verified the build
  command had -Werror=fortify-source in it.

Change-Id: I2715ea411ef067f801534dab4d306fef5431f290
2019-09-20 11:15:40 -07:00
Treehugger Robot
9f6cbaca21 Merge "Fix missing deps found through RBE" 2019-09-19 20:34:05 +00:00
Colin Cross
3b19f5d71d Remove old-style support for translated second architectures
Translated second architectures now go in NativeBridgeArch instead
of DeviceSecondaryArch.

This reapplies I568046330abc002d4eed582cb999b62a5eaba790 with
ctx.Config().HasMulitlibConflict() added to fix the NDK build,
which has arm64, arm, x86_64, and x86 architectures enabled.

Test: m checkbuild
Test: OUT_DIR=out_ndk build/soong/scripts/build-ndk-prebuilts.sh
Test: no change to build.ninja or Android-aosp_cf_x86_phone.mk
Change-Id: Iadcafbd64bfb9579ae7c86914927c43a062b0c8e
2019-09-19 12:54:32 -07:00
Dan Willemsen
724ab5d5f7 Fix missing deps found through RBE
Bug: 130111713
Test: run with RBE, no longer see error about file not found
Change-Id: Ib6192f2a537f49efdb69b3f3bf28aef1660dec01
2019-09-19 10:51:03 -07:00
Treehugger Robot
de8b140bf6 Merge "Add option test_min_api_level and test_min_sdk_version for auto-generated test config" 2019-09-19 16:48:48 +00:00
Treehugger Robot
4e839ec3a5 Merge "Add corpus and dictionary properties to cc_fuzz." 2019-09-19 13:51:17 +00:00
nelsonli
0d7111ec0f Add option test_min_api_level and test_min_sdk_version for auto-generated test config
The new option will allow the auto-generated test config for cc_test to
include MinApiLevelModuleController and check the api-level before test.

Bug: 140912549
Test: 1. $vi platform_testing/tests/example/native/Android.bp
      2. add
          test_min_api_level: 29,
          or
          test_min_sdk_version: 29,
      3. $m -j hello_world_test
      4. check hello_world_test.config

Change-Id: Ic742d41898928df1637890bec87796d90e886516
2019-09-19 12:14:16 +08:00
Mitch Phillips
4e4ab8a141 Add corpus and dictionary properties to cc_fuzz.
Adds the corpus and dictionary properties to the cc_fuzz target.
Propagates these entries to the makefile backend via LOCAL_FUZZ_DATA, in
a similar manner to LOCAL_TEST_DATA.

Bug: 141026328
Test: m example_fuzzer, fuzz target should have adjacent corpus/dict
files.

Change-Id: If5add5a597cc479f4e084bdafbd0fc175cfd6321
2019-09-18 18:55:27 -07:00
Inseob Kim
64c4395386 Add version to vendor variants
Vendor variant is now divided into several vendor.{version} variants,
depending on their intended usages:

vendor.{BOARD_VNDK_VERSION}: vendor and vendor_available modules
vendor.{PLATFORM_VNDK_VERSION}: VNDK modules in the source tree
vendor.{snapshot_ver}: VNDK snapshot modules

This also affects exported module names from Soong to Make. But to
maintain backward compatibility, ".{BOARD_VNDK_VERSION}" suffix will not
be emitted for modules having version BOARD_VNDK_VERSION, so that vendor
modules still can be referred as-is.

Bug: 65377115
Bug: 68123344
Test: clean build and boot blueline
Change-Id: Ib9016a0f1fe06b97e9423fd95142653a89a343fa
2019-09-18 10:53:30 +09:00
Treehugger Robot
f7e6870f81 Merge "Revert "Revert "Force gtest to use adb unroot if required_root is false or not set""" 2019-09-18 00:20:16 +00:00
Treehugger Robot
1f6c94a3ac Merge "Add "apex_vndk" module type" 2019-09-17 17:14:48 +00:00
Dan Shi
bc0f26028a Revert "Revert "Force gtest to use adb unroot if required_root is false or not set""
This reverts commit 1a5eeb3e35.

Reason for revert: Fix landed in aosp/1122723

Change-Id: I8b487d602d48b9dba35affc8eb31578efd815e52
2019-09-17 02:43:50 +00:00
Pirama Arumuga Nainar
24d49119d8 Switch to clang-r365631b
Bug: https://github.com/android/ndk/issues/1076
Test: TH
Change-Id: Ica61fd13d9d7ecc742a7a89f5bb04cc6e1caf9f2
2019-09-16 15:06:41 -07:00
Julien Desprez
74b0a4891e Merge "Revert "Force gtest to use adb unroot if required_root is false or not set"" 2019-09-14 03:08:57 +00:00