Commit Graph

519 Commits

Author SHA1 Message Date
Fabien Sanglard 7da4926263 [CMakeList generator] Fix executable name
Treble genererated project name feature character no accepted by
CMake. So far only @ is a problem.

Change-Id: Iac460033f1181f46ab8205e5706271f99ab798d3
2017-03-23 17:50:26 -07:00
Fabien Sanglard 6747241b83 CMakelists generator: Maintain include order
For some library, the order of includes is important. e.g: library
can include "system/window.h". Dependending on the dependency order
this could mean libs/nativewindow/include/system/window.h or
system/core/include/system/window.h

This patch changes search path storage from map to array in order
to preserve order the order in which they were received from
soong.

Change-Id: I8ef788633985f4ed04ec3432686eb1427f73d600
Test: Manual
2017-03-21 11:18:10 -07:00
Treehugger Robot ed1665dc8a Merge "Add ar flags for CFI enabled components in Soong." 2017-03-20 22:08:03 +00:00
Colin Cross e3918170ae Merge changes from topic 'prebuilts'
* changes:
  Add support for binary and static library and prebuilts
  Rename to cc_prebuilts_library_shared
  Fix installing prebuilts with no source module
2017-03-20 20:51:45 +00:00
Treehugger Robot 3250879667 Merge "Revert "install *.so in different paths for their types"" 2017-03-17 22:45:31 +00:00
Colin Cross de89fb8707 Add support for binary and static library and prebuilts
Add cc_prebuilt_library_static and cc_prebuilt_binary module types.

Bug: 35576244
Test: Add cc_prebuilt_library_static and cc_prebuilt_binary modules
      and verify they are used
Change-Id: I708ec7b1ed1a0eddae083159575ae04d5ea25a37
2017-03-17 14:06:28 -07:00
Colin Cross dfee1bcf43 Rename to cc_prebuilts_library_shared
Rename cc_prebuilts_shared_library to cc_prebuilts_library_shared
to match cc_library_shared.

Test: builds
Change-Id: I2f48263c3a0830a99ace4e2374de4a702d48c2e4
2017-03-17 14:06:28 -07:00
Colin Cross 054350e8f1 Merge "Use a minimal set of mutators, module types, and singletons for tests" 2017-03-17 05:05:03 +00:00
Dan Willemsen 615609854f Revert "install *.so in different paths for their types"
This reverts commit 4c48f724e1. It's
causing test failures, warnings and complaints, so backing it out and
we'll resolve those before putting it back in.

Bug: 33681361
Test: m -j
2017-03-16 19:48:32 -07:00
Colin Cross 795c377e14 Use a minimal set of mutators, module types, and singletons for tests
Calling android.NewContext() in tests results in a context that
contains all the mutators, module types, and singletons, which
causes unexpected interactions in unit tests.  Create an empty
context instead, and add in only the necessary mutators, module
types, and singletons.

Bug: 36366816
Test: soong tests
Change-Id: Ic61262c37e3436b3ad4ccaca18b737021c304be6
2017-03-16 16:50:10 -07:00
Vishwath Mohan 7a5b46db91 Add ar flags for CFI enabled components in Soong.
CFI enabled components need ar to use the gold linker. This CL adds
that.

Bug: 36290748
Test: Enabling CFI for a Soong component builds without error.
Change-Id: Icbf78fa1ca0d845350516b4dd345b54fbb7ef847
2017-03-16 16:36:16 -07:00
Vishwath Mohan 83d9f71cc5 Allow custom ar flags to be set.
Adds the ability to set custom flags for ar in Soong, similar to how
they can currently be set for make.

Bug: 36290748
Test: sanitize.go is able to correct set custom ar flags for CFI. CFI
enabled Soong components build and boot without issue.

Change-Id: I3212793aa84ba51df910c184d8bb376b3650376e
2017-03-16 14:06:30 -07:00
Dan Willemsen 01a405a481 Add LinuxBionic toolchain and switch
This adds a toolchain definition for LinuxBionic that only supports
Clang/64-bit. It pulls pieces from the x86_linux_host and x86_64_device
configs, and uses the android clang triple, with some manual overrides.

To enable building this, set your soong.config file to:

 {"Host_bionic": true}

Bug: 31559095
Test: out/soong/{Android,make-vars}-aosp_arm64.mk the same with or
      without host bionic turned on
Test: No change to out/soong/build.ninja before/after this change
Change-Id: Id97dda8bd9aa670c32aed31fbe6aaa8175e70b59
2017-03-15 14:18:42 -07:00
Dan Willemsen 0e2d97b4b1 Stop making the ndk headers host-specific
This breaks when I enable a second host configuration for host bionic.

Make non-arch modules !Device and !Host by adding "Generic" as the zero
value. Make the SkipDeviceInstall config only apply to Device modules.

Test: out/soong/build.ninja is identical expect for comments
Change-Id: I6e2bd3814a9968554d3901a508d822d5c79d08a0
2017-03-15 20:20:22 +00:00
Dan Willemsen 7752bca25d Enable large-address-aware for 32-bit windows
Bug: 36046324
Test: m -j winsdk-tools
Change-Id: I232d7dac9a6708542e70392801259141bec297c6
2017-03-14 13:37:26 -07:00
Jiyong Park 4c48f724e1 install *.so in different paths for their types
Shared libraries are now installed to different directories depending on
their types.

* NDK libraries: /system/lib/ndk
* VNDK libraries: /system/lib/vndk
* VNDK-ext libraries: /system/lib/vndk-ext
* Framework-only libraries: /system/lib
* Vendor-only libraries: /vendor/lib
* Same-process HALs: /vendor/lib/sameprocess

In addition, a new module type vndk_ext_library is added. It is almost
identical to cc_shared_library but it introduces another attribute
'extends'. This is use to reference the vndk library that this vndk-ext
library is extending.

For example, in order to extend a vndk library libFoo:

cc_library {
  name: "libFoo",
  srcs: [...]
}
---------------------
vndk_ext_library {
  name: "libFoo-extended",
  srcs: [...]
  extends: "libFoo"
}

Then, libFoo will be installed as /system/lib/vndk/libFoo.so and
libFoo-extended will be installed as /system/lib/vndk-ext/libFoo.so.
Note that file name of the latter is libFoo.so, not libFoo-extended.so:
file name of an extending module is automatically set to that of the
extended module.

Bug: 33681361
Test: build & run. Libraries must be in the correct directories.
Change-Id: Ia1eb3940605d582a252c78da0f3a5b36fdab062b
2017-03-14 09:13:44 +09:00
Dan Willemsen 300151ba19 Always use the standard OSX SDK tools
Instead of whatever happens to be in PATH.

Test: port install gcc5; attempt to build host binaries
Change-Id: If4af32596edd6fd3e459c3d574ab0ff495f236ff
2017-03-13 12:40:30 -07:00
Josh Gao 664806a843 Merge "Add libwinpthread, link it into win32 binaries." 2017-02-24 21:02:24 +00:00
Josh Gao 7bd4c5c339 Add libwinpthread, link it into win32 binaries.
Bug: http://b/31665213
Test: wine adb.exe
Test: wine fastboot.exe
Change-Id: I6d6ff69f0c016e2654119a09161685841cbccc7e
2017-02-23 17:57:03 -08:00
Dan Albert 269fab82eb Add preprocessed_ndk_headers.
Prototypes in the bionic headers are annotated with `__INTRODUCED_IN`
tags that are processed by bionic/tools/versioner into their usable
form (tags replaced with `#if __ANDROID_API__ >= foo` guards). We've
previously done this as a periodic manual step with the results
checked in to prebuilts/ndk, but that's been a huge hassle for me.
Make the tool a part of the build instead.

Test: make checkbuild
Bug: http://b/35673791
Change-Id: I2f5c1aeae239ac4ab6616eb5c71360e3055f86d5
2017-02-22 14:52:52 -08:00
Dan Willemsen d5781347e0 Export cc_library_headers as BUILD_HEADER_LIBRARY
And support the reverse translation in androidmk.

Test: Use a cc_library_headers using LOCAL_HEADER_LIBRARIES in make
Test: androidmk with LOCAL_HEADER_LIBRARIES
Test: androidmk with soong's Android-*.mk file for BUILD_HEADER_LIBRARIES
Change-Id: I17adedb62151f62e67e2168b09ad87f1d5648df6
2017-02-16 10:58:26 -08:00
Colin Cross 449887957c Merge "Export header libraries to make as static libraries" 2017-02-16 16:05:20 +00:00
Colin Cross 4ac44809af Export header libraries to make as static libraries
Header libraries were building an empty .a file but setting
LOCAL_MODULE_CLASS := SHARED_LIBRARIES.  Make the static and shared
checks in libraryDecorator.AndroidMk explicit.

Bug: 35228396
Test: builds, examine out/soong/Android-${TARGET_PRODUCT}.mk
Change-Id: I5653ae92bb41d440d8c3ff4b6d509be188feb961
2017-02-15 23:26:15 +00:00
Treehugger Robot 367a7da041 Merge "Blacklist code for CFI." 2017-02-15 22:52:46 +00:00
Treehugger Robot 31160bef1e Merge "Ban --coverage now that we have native coverage" 2017-02-15 20:58:49 +00:00
Vishwath Mohan f3918d37fb Blacklist code for CFI.
Adds the -fsanitize-blacklist option for CFI, using the built in
blacklist at external/compiler-rt/lib/cfi/cfi_blacklist.txt.

Also refactors the CFI cflags and ldflags into cc/makevars.go to
ensure they're consistent across Soong and make projects.

Bug: 30227045
Test: ENABLE_CFI=true m -j40 builds and boots.
Test: The blacklist prevents runtime errors that otherwise occur.
Change-Id: I91c5420478e7290061d89338a86abdef69c67fe2
2017-02-15 12:46:52 -08:00
Colin Cross a48ab5b207 Build a static library for header-only libraries
library.static() was being used to determine if a library was static,
shared, or header only, which resulted in header only libraries
behaving like shared libraries, when they should be treated as static
libraries with no sources.  Explicitly use library.static(),
library.shared(), and library.header() instead.

Bug: 35228396
Test: builds, manually examine changes to build.ninja and Android.mk
Change-Id: I51729992cc6338deda1396b86f12bc9f73e674d8
2017-02-14 17:52:10 -08:00
Dan Willemsen 17ff636322 Ban --coverage now that we have native coverage
Bug: 32749731
Test: m -j
Change-Id: Icb6ca0d846cba0ca842d3fb12dde1f1e8701cf5d
2017-02-14 13:05:48 -08:00
Dan Willemsen 581341d4f2 Native Coverage support in Soong (gcov)
This is configured the same as make -- a global NATIVE_COVERAGE=true
flag to allow native coverage, then COVERAGE_PATHS=path1,path2,... to
turn it on for certain paths.

There are .gcnodir files exported to Make and saved in $OUT/coverage/...
files which are `ar` archives containing all of the compiler-produced
.gcno files for a particular executable / shared library.

Unlike the Make implementation, this only passes links the helper
library (automatically through --coverage) when one of the object files
or static libraries being used actually has coverage enabled.

Host support is currently disabled, since we set -nodefaultlibs, which
prevents libclang_rt.profile-*.a from being picked up automatically.

Bug: 32749731
Test: NATIVE_COVERAGE=true COVERAGE_PATHS=system/core/libcutils m -j libbacktrace libutils tombstoned
      $OUT/coverage/system/lib*/libcutils.gcnodir looks correct (self)
      $OUT/coverage/system/lib*/libbacktrace.gcnodir looks correct (static)
      $OUT/coverage/system/lib*/libutils.gcnodir doesn't exist (shared)
      $OUT/coverage/system/bin/tombstoned.gcnodir looks correct (executable)
Test: NATIVE_COVERAGE=true COVERAGE_PATHS=external/libcxxabi m -j libc++
      Confirm that $OUT/coverage/system/lib*/libc++.gcnodir looks correct (whole_static_libs)
Change-Id: I48aaa0ba8d76e50e9c2d1151421c0c6dc8ed79a9
2017-02-14 13:05:48 -08:00
Vishwath Mohan e13374d3c1 Merge "Disble CFI for ARM32 processes." 2017-02-13 20:49:20 +00:00
Vishwath Mohan 6d67e6e68e Disble CFI for ARM32 processes.
This CL disables CFI for 32-bit ARM processes, which is broken due to
a compiler error in the most recent version of clang.

Bug: 35157333
Test: ENABLE_CFI=true m -j40 does not enable CFI for 32-bit processes
Change-Id: I52ccf60d91ff1a2af4cf024376b7d70f87040674
2017-02-08 19:46:27 -08:00
Jayant Chowdhary 89a0d797d7 Merge "Add RenderScript toolchain information to soong." 2017-02-08 17:45:38 +00:00
Jayant Chowdhary e622d20659 Add RenderScript toolchain information to soong.
Test: make -j64 from top of tree.

Change-Id: I9e853e64924f26719c0cd7ae8de4958fe97ca04e
2017-02-07 12:15:45 -08:00
Fabien Sanglard 5cb35194c2 Fix CMakeList generator CFlag bug
Properly process CFlags featuring quotes and double quotes.

Test: on libui and libgui
Change-Id: I8581cef9ccc595b6e05d77bee7bea82f2efd219b
2017-02-07 09:43:02 -08:00
Fabien Sanglard d61f1f4559 Add support for CMakefile generation
Test: Manually generated CMakeLists.txt for gui/ui/aapt2.

Change-Id: I7dedc300c1e50b8e39bc58091b650c0bbe2c62da
2017-02-07 09:43:02 -08:00
Nan Zhang 6d34b308ff Added phony module type for soong.
The "required" field within "phony" module in .bp file has to be
non-empty. And "phony" module doesn't contain any "src" files.
Bug: b/32981153
Test: make -j out/soong/build.ninja

Change-Id: Iaa2009467c44702572b97ca9cbd02c1d368c8d83
2017-02-06 22:23:19 -08:00
Colin Cross 77de5a4b9d Merge "Support data properties for test binaries" 2017-02-06 21:17:12 +00:00
Treehugger Robot 721197de2c Merge "Add c_std and cpp_std properties." 2017-02-06 19:18:27 +00:00
Dan Albert 043833ca81 Add c_std and cpp_std properties.
Test: Checked showcommands ouput for each setting.
Bug: None
Change-Id: Ibe02352f19ca2777b9a419136270e5c4390f1149
2017-02-03 16:45:38 -08:00
Evgenii Stepanov a83fdacf7c Disable CFI on Mips and add -march to linkflags on ARM.
Mips toolchain does not have ld.gold.
ARM change is a workaround for LLVM r290384.

Bug: 33678192
Test: make ENABLE_CFI=1
Change-Id: I189ffd42760f0ea8d151717337b9355b37cb207b
2017-02-03 23:50:28 +00:00
Evgenii Stepanov cb3f890263 Remove duplicate code.
Test: NFC
Change-Id: I63a1b1ee244c2ab015914e1879aefc3ba8f886b0
2017-02-03 13:25:03 -08:00
Colin Cross faeb7aa135 Support data properties for test binaries
Allow tests to specify a data property that lists files or filegroup
modules that will be packaged alongside the test.  Also add a path
property to filegroup modules to allow shifting the path of the
packaged files, and add ExpandSourcesSubDir to expand the filegroup
sources while including a shifted relative path in the Paths objects.

Test: soong tests, manually adding data to a module
Change-Id: I52a48942660e12755d313ef13279313361b4fc35
2017-02-02 16:23:30 -08:00
Stephen Hines e25bc9ba83 Merge "Switch to clang-3688880." 2017-02-01 21:25:03 +00:00
Stephen Hines d19f58a162 Switch to clang-3688880.
Bug: http://b/31532493
Test: Manual validation.
Change-Id: I386c7fc06bd4ca092535365bccbed0a898eb69da
2017-01-31 12:13:37 -08:00
Colin Cross 7a108bccad Allow clang builds to disable -pie
-pie triggers a bug in glibc's linker when used with goma
(https://sourceware.org/bugzilla/show_bug.cgi?id=16381).  Allow
the clang build to disable -pie for host modules through the
DISABLE_HOST_PIE environment variable so it can produce a toolchain
that works with goma.

Bug: 15814177
Bug: 34722791
Change-Id: Ic664a1b821aaeaf2bde14b0afa1a1975e31300cb
2017-01-30 22:51:59 -08:00
Dan Albert dc2597d25a Don't force libraries upon static executables.
The linker uses libc++_static but needs to avoid the libc.a
dependency. It does this by setting `stl: "none"` and manually
linking libc++. This behavior matches make.

A better approach would probably be to generalize system_shared_libs
to system_libs and apply those to static executables the same way we
do for dynamic ones, but that's a patch for another day.

Test: make checkbuild
Bug: http://b/34740564
Change-Id: Ie9da0d49a453a220593e8ec2ee721e9af9378007
2017-01-26 17:44:26 -08:00
Treehugger Robot 29c69e83dd Merge "Add libc++ and libc++_static aliases for SDK builds." 2017-01-26 21:28:11 +00:00
Brian Carlstrom 7f205c8289 Merge "Revert "Switch to clang-3625443."" 2017-01-26 08:05:35 +00:00
Stephen Hines 73431cb86e Revert "Switch to clang-3625443."
This reverts commit 1d7513decd.

Reason for revert: <INSERT REASONING HERE>

Change-Id: Ida39c91bfc70ba60b2a3113544ec43c566b6c494
2017-01-26 07:59:16 +00:00
Treehugger Robot 49110a5d88 Merge "Switch to clang-3625443." 2017-01-26 07:13:21 +00:00