Commit graph

1538 commits

Author SHA1 Message Date
Dan Willemsen
105de3443d Merge "*_OUT_INTERMEDIATE_LIBRARIES has been removed from Make" 2018-09-19 17:19:37 +00:00
Steven Moreland
f7873ecf6d Merge "Add libbinder_ndk to the NDK." 2018-09-18 15:19:44 +00:00
Treehugger Robot
cc737f6fe0 Merge "Link msvcr110.a after mingwex.a" 2018-09-18 05:20:36 +00:00
Pirama Arumuga Nainar
e5d974d67a Link msvcr110.a after mingwex.a
Bug: http://b/115909626

Some executables linked with msvcr110.a before mingwex.a loop on start
up with the following message:
    err:ntdll:RtlpWaitForCriticalSection section 0x7fdcb000 "?" wait
        timed out in thread 0009, blocked by 0000, retrying (60 sec)

https://android-review.googlesource.com/c/758688/ has a reproducer.

Test: The reproducer above works, and verify that few Windows binaries
behave correctly (print help message and such).

Change-Id: I837f421532d86f73713d70b3d93609b50d238af9
2018-09-17 23:33:28 +00:00
Treehugger Robot
cc2746d1f2 Merge "Add OutputFile to cc.Module" 2018-09-17 20:03:09 +00:00
Dan Willemsen
2e224cae8e *_OUT_INTERMEDIATE_LIBRARIES has been removed from Make
So LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES is no longer necessary. And just
export the object paths directly to make instead of copying into the
intermediate libraries directory.

Test: m
Change-Id: Iba1523aec642fc81e9bf61da3125f714e91cd557
2018-09-15 10:46:17 -07:00
Colin Cross
446c666672 Don't pass -pie for Windows binaries
Passing -pie to clang for Windows binaries causes a warning:
clang-7: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]

Bug: 115776263
Test: m checkbuild
Change-Id: Ie502a05dac32c192c38953c684dc80d1db24b792
2018-09-14 23:02:31 +00:00
Jiyong Park
c20eee3605 Add OutputFile to cc.Module
APEX needs to know the location of the output file of cc.Module to copy
it to an intermediate directory and package there.

Bug: 112672359
Test: m apex.test
Change-Id: Iaa19b29c2859df96f50716001dbd57df3f596050
2018-09-13 12:45:00 +09:00
Colin Cross
b60190a4f8 Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules
Export Soong cc modules to Make using a new soong_cc_prebuilt.mk that
bypasses all of prebuilt_internal.mk, dynamic_binary.mk and binary.mk.
This also means that stripping is handled in Soong instead of Make.

Relands If9008c50920779048480f5eeeb0084f26006c998 with fixes for
mac builds.

Bug: 113936524
Test: m checkbuild
Change-Id: I9710ff57f0793f36eb889eabd08bd60a365a88dd
2018-09-10 23:12:12 -07:00
Colin Cross
b496cfd9d2 Enable toc support for Darwin and Windows
Bug: 113936524
Test: m checkbuild
Change-Id: I0f2030ad75daae2cbe44e8cbedad329d33df55f7
2018-09-10 23:12:11 -07:00
Colin Cross
cf7d5ab6d6 Merge "Revert "Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules"" 2018-09-10 21:36:38 +00:00
Colin Cross
cb9342eabd Revert "Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules"
This reverts commit e2874cd99d.

Reason for revert: broke mac builds
Bug: 113936524

Change-Id: Id0311d6b202b18e80953da632133548d56ed851a
2018-09-10 21:35:34 +00:00
Colin Cross
d2e92da626 Export build/soong/scripts/strip.sh to Make
Bug: 113936524
Test: m checkbuild
Change-Id: I2d3d1e579b05117bf377852abedd5fc6d320401f
2018-09-10 11:05:01 -07:00
Colin Cross
e2874cd99d Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules
Export Soong cc modules to Make using a new soong_cc_prebuilt.mk that
bypasses all of prebuilt_internal.mk, dynamic_binary.mk and binary.mk.
This also means that stripping is handled in Soong instead of Make.

Bug: 113936524
Test: m checkbuild
Change-Id: If9008c50920779048480f5eeeb0084f26006c998
2018-09-10 11:04:01 -07:00
Evgenii Stepanov
dbf1d4f884 (soong) Add -fsanitize= argument to assembly flags.
It allows use of sanitizer preprocessor macros (like __has_feature())
in assembly files.

Bug: 112438058
Test: SANITIZE_TARGET=hwaddress
Change-Id: Id3fed5492ab9473cbb13cd6c0485302412e8b1de
2018-09-07 10:23:07 -07:00
Treehugger Robot
2f7e3bb4d0 Merge "Remove GCC support from Make" 2018-09-07 02:42:27 +00:00
Dan Willemsen
f640dbcd1f Remove GCC support from Make
We need to keep support in Soong until toolchain_library no longer uses
GCC.

Test: out/build-aosp_arm64.ninja is the same before/after
Test: build_test on downstream branches
Change-Id: Ib78bcd6d5544afc3a3164f65fa72a3f08b2acf29
2018-09-06 22:37:54 +00:00
Colin Cross
ed064c0b1f Fix logic for adding gnu debuglink to match Make
Only add gnu debuglink on userdebug builds to match Make, and don't
add it when using minidebuginfo, which doesn't support it.

Bug: 113936524
Test: m checkbuild
Change-Id: Ifd529f88d63afa5627172fb6ea612aea77159f40
2018-09-05 16:30:16 -07:00
Colin Cross
9a959cd519 Add Soong support for stripping all symbols
Bug: 113936524
Test: m checkbuild
Change-Id: I2fb4429aee689dc6a99dc973b37575a114e46be6
2018-09-05 16:30:16 -07:00
Colin Cross
88f6fefeb4 Add stripping and toc support to Soong cc_prebuilt modules
Bug: 113936524
Test: m checkbuild
Change-Id: I67ec2e94d349924c3e209939030b204fdaff9c47
2018-09-05 16:30:16 -07:00
Colin Cross
22f3795dca Remove relocation packer
The relocation packer prebuilt is gone, remove the references to it.

Bug: 110715614
Test: m checkbuild
Change-Id: Ia20f8198e4fc206f4995dd5168c811dac7c9df89
2018-09-05 16:30:11 -07:00
Colin Cross
1ab10a7310 Don't clear flags in prebuiltLibraryLinker.linkerFlags
linkerFlags takes the current flags struct, it should return it
unmodified if it has nothing to do, not return an empty one.

Bug: 113837811
Test: m SANITIZE_TARGET=address
Change-Id: I35ec260f49c832a5b50ff77395eda618679e6ef9
2018-09-04 11:02:37 -07:00
Yi Kong
e944600978 Merge "Add BuiltinsRuntimeLibrary" 2018-09-01 00:09:19 +00:00
Yi Kong
1662e3c76d Merge "Prebuilts shouldn't inherit linker interface" 2018-08-31 22:25:00 +00:00
Yi Kong
924adc4d17 Add BuiltinsRuntimeLibrary
... and rename SanitizerRuntimeLibrary to LibclangRuntimeLibrary since
some of them are not sanitizers.

Bug: 29275768
Test: m
Change-Id: Id638adea42d22b02438fce26120aa155bea14d42
2018-08-31 14:53:54 -07:00
Logan Chien
f4b79c684a Check ABI stability of all NDK libs
This commit extends ABI stability checks to all NDK shared libs
(including the framework-related ones such as libandroid.so).

Bug: 112404572
Bug: 79576032
Test: make findlsdumps  # (and check the output)
Change-Id: I0147c60ce0c90d187f85b996911d98326a0c37ae
2018-08-31 02:55:28 +00:00
Treehugger Robot
418d261481 Merge "Skip DepsMutator on disabled modules" 2018-08-30 22:56:32 +00:00
Yi Kong
0098166cb4 Prebuilts shouldn't inherit linker interface
Prebuilts doesn't go through linking stage, thus it should not inherit
any dependencies or flags from linker.go.

Test: m checkbuild
Bug: 29275768
Change-Id: I1f1dc5d65c2fc2dd905e8df44e08d5c83b224d0c
2018-08-30 14:33:06 -07:00
Colin Cross
6db4a6a7d9 Skip DepsMutator on disabled modules
Dependencies of disabled modules may not have the right variations
for calling AddVariationDependencies, skip DepsMutator completely
on disabled modules.

Bug: 112707915
Test: m checkbuild
Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: I702e591437e5e6eb9f91f3b7eb32bacc4bd5d249
2018-08-30 19:54:37 +00:00
Pirama Arumuga Nainar
191f646295 Use Windows security mitigation features: ASLR, DEP
Bug: https://issuetracker.google.com/36952278
Bug: http://b/113171785

From
https://android-review.googlesource.com/c/platform/system/core/+/737292:

The --dynamicbase linker flag enables use of Address Space Layout
Randomization (ASLR) on Windows Vista and newer. It causes the code
segment / module to be loaded at unpredictable addresses to make
exploits harder to construct.

The --nxcompat linker flag enables use of Data Execution Protection
(DEP) on Windows XP SP2 and newer. It causes the process to be killed if
the process tries to execute code on memory pages not marked executable.
This makes exploits harder to construct because the stack is then not
executable, other data pages aren't, etc.

These bits are already set on AdbWinApi.dll and AdbWinUsbApi.dll.

--high-entropy-va provides improved ASLR.

Credit: Spencer Low for doing the initial work at
https://android-review.googlesource.com/c/platform/system/core/+/737292.

Test: Verify that DLLCharacteristics reported by 'objdump -x' is:
      0x140 for 32-bit and 0x160 for 64-bit.  Also verified trivial use
      cases under Wine.

Change-Id: I1b898cd36c7c627916dae9ce7dfd1c27de1e3c59
2018-08-30 12:54:33 -07:00
Colin Cross
42d48b7b8b Enforce dependencies have right architecture
ctx.AddDependency will succeed if the named dependency only has a
single variant, even if that variant is the wrong architecture.
Use ctx.AddVariationDependency(nil, ...) instead, which requires
that all variations of the calling module match the dependency.

Bug: 112707915
Test: no change to out/soong/build.ninja
Test: using a device dependency in a host java module is an error
Change-Id: I70b661a57d4412eb63b8c9841febfb756e9e025d
2018-08-30 16:31:02 +00:00
Steven Moreland
fa287846ea Add libbinder_ndk to the NDK.
Bug: 111445392
Test: atest android.binder.cts.NdkBinderTest
Change-Id: If7e25f6e856524c531c41dacf3e7f798f42cc7a5
2018-08-29 21:45:51 -07:00
Dan Willemsen
e97e68a05a Clean up darwin cc toolchain
Remove the ability for Soong to build 32-bit darwin code. We've already
disabled this in Make, this is just removing the unused bits in Soong
and simplifing the toolchain config.

Test: m host
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I968c5d98bdf162297d639f7988918dadb7ba6e07
2018-08-28 20:08:50 -07:00
Treehugger Robot
6dcc81c3c6 Merge "Support Mac 10.14 SDK" 2018-08-29 01:53:42 +00:00
Dan Willemsen
5a050c0183 Support Mac 10.14 SDK
Now that we don't compile 32-bit binaries, this seems to work, at least
in Xcode 10 beta 6.

Test: m checkbuild host
Change-Id: I61a98a3c31b331d6d01cd633f8d949fad86047cb
2018-08-28 16:48:45 -07:00
Evgenii Stepanov
a6302337c8 Pass hwasan extra cflags to make.
Bug: 112438058
Test: SANITIZE_TARGET=hwaddress
Change-Id: If57e5f4cf78037992936ce94a98f017676b7e74b
2018-08-28 13:51:05 -07:00
Chih-hung Hsieh
4b42edbca0 Merge "Define PATH_TO_CLANG_TIDY_SHELL for build/make rules." 2018-08-28 18:18:32 +00:00
Jiyong Park
5baac54d58 link type of recovery variant of a vendor module should not be native:vendor
This CL fixes a bug that when a module is configured as 'vendor: true' &&
'recovery_available: true', the link type of the recovery variant of the
module is incorrectly set to 'native:vendor'. This was because,
androidmk.go emits 'LOCAL_PROPRIETARY_MODULE := true' whenever
Proprietary property is set to true, regardless of whether it is a
recovery variant or not. This in turn makes LOCAL_USE_VNDK := true for
the module which in turn causes the link type to be 'native:vendor'.

Fixing the bug by resetting the properties like Proprietary, Vendor,
Soc_specific, etc. for the recovery variants.

Bug: 113277544
Test: m -j (test added)
Change-Id: I5d6ae76e46ef8fcd9204d386d0809862a7b0ff7e
2018-08-28 10:03:17 +09:00
Chih-Hung Hsieh
b699c43f89 Define PATH_TO_CLANG_TIDY_SHELL for build/make rules.
* PATH_TO_CLANG_TIDY_SHELL is ${config.ClangTidyShellPath},
  wich is "build/soong/scripts/clang-tidy.sh"

Bug: 110538415
Test: build with WITH_TIDY=1
Change-Id: I27d7be095c998583fa9ad4d705aa1332bd018140
2018-08-27 16:19:59 -07:00
Treehugger Robot
09664bd9a5 Merge "NDK sysroot: include each license file only once" 2018-08-24 22:40:32 +00:00
Ryan Prichard
b1c9d40b6f NDK sysroot: include each license file only once
bionic/libc/NOTICE file is 6000 lines long and is referenced by 10
modules in bionic/libc/Android.bp. We're currently including 10 copies of
the license file, which makes it hard to view a "platform prebuilts" CL
in Gerrit.

For example, click "Expand All" on:
https://android-review.googlesource.com/c/platform/prebuilts/ndk/+/730825

Bug: none
Test: m out/soong/ndk.timestamp
Change-Id: I857e70d7d900688532ab988800c98bbd0899cc31
2018-08-24 13:28:04 -07:00
Chih-Hung Hsieh
9e88ba9f22 Remove flto dependent flags when -flto is removed.
* C++ source files could be compiled with "-fwhole-program-vtables"
  in cppflags. We need to filter out those flto dependent flags
  in flags.CppFlags and use flags.toolingCppFlags instead of
  flags.cppFlags.

Test: build with WITH_TIDY=1
Change-Id: Ic2b0f99b95a5f0422f879226e6f6060cab71456a
2018-08-24 18:42:22 +00:00
Chih-Hung Hsieh
a7aa958e6e Add clang-tidy.sh to filter out troublesome flags.
* Some flags are accepted by clang but not clang-tidy.
  They could cause the diagnostic-unused-command-line-argument warning.
  Flag -flto messed up the -I flags.
* Add clang-diagnostic-unused-command-line-argument to
  default clang-tidy checks.
* Move CLANG_TIDY_UNKNOWN_CFLAGS to build/make/core/clang/tidy.mk.

Bug: 111850071
Bug: 111885396
Test: build with WITH_TIDY=1
Change-Id: Iabeeb27715acf83ef6aafe3e77206b9a01a0d889
2018-08-22 09:21:45 -07:00
Treehugger Robot
9b4f9afbaf Merge "Add "hwaddress" sanitizer." 2018-08-20 23:22:35 +00:00
Evgenii Stepanov
d97a6e9483 Add "hwaddress" sanitizer.
This is a new sanitizer similar to ASan, but with a few differences
from the build system perspective:
* Only runs on AArch64.
* Supports static binaries.
* Bionic itself will be built with HWASan.
* Does not have any "if a library is sanitized than the binary must
  be, too" requirements unlike ASan. Even better, individual static
  libraries can be freely sanitized or not. We propagate "nosanitize"
  from binaries to static libraries anyway, because otherwise there
  is no good way to disable hwasan on a binary as a whole.

Same a CFI, we export a list of sanitized static libraries to make.
In fact, we export separate lists for vendor and regular libraries,
because it is possible for one to be sanitized without the other
(i.e. there can be mylib.hwasan.vendor w/o mylib.hwasan or vice
versa).

Bug: 112438058, 112709969
Test: manual, part of a bigger patch set

Change-Id: Ie4fdeb522ac03cf9684526882e84dfee3807b6a7
2018-08-16 13:18:47 -07:00
Colin Cross
303e21f695 Move autogenerated test config into Soong
Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.

Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
2018-08-14 15:44:08 -07:00
Logan Chien
0c3b508d2b Merge "Support prebuilt shared libs end with versions" 2018-08-13 01:52:23 +00:00
Hridya Valsaraju
280febfb14 Add exclude_header_libs for recovery_available:true libs
Bug: 78793464
Test: mmm
libhardware needs to be made available in recovery without
exporting bluetooth and audio headers.

Change-Id: Ib1d1bcda49abccfb9a4768580e1c1d92ead68773
2018-08-10 09:35:47 -07:00
Jiwen 'Steve' Cai
8dbc653dff Add exclude_header_libs for vendor_available:true libs
Adding a mechanism to conditionally exclude some header library
dependencies when a lib is built for vendors.

Without this, some libraries cannot be earily marked as vendor_available
if they are depending on header libs can shouldn't be marked as
vendor_available.

By using exclude_header_libs with exclude_srcs (or __ANDROID_VNDK__
macro), we can eliminate the unnecessary dependency for vendors.

Bug: 112338314
Test: build
Change-Id: If12dceb6045099fe828fe33af2ac4428f88499a2
2018-08-09 21:19:32 -07:00
Logan Chien
031d2b32e3 Support prebuilt shared libs end with versions
This commit changes how `cc/androidmk.go` generates LOCAL_MODULE_STEM,
LOCAL_MODULE_SUFFIX, and LOCAL_BUILT_MODULE_STEM.  Now, `splitFileExt()`
takes a file name and a list of expected file extensions.
`splitFileExt()` searches the first occurrence of expected file
extensions in the file name.  If it can not find any, it will simply
return the last file extension.

Before this commit, `cc/androidmk.go` simply extracts the last file
extension (e.g. `.so`).  However, if the prebuilt shared libs end with
version numbers (e.g. `libc++.so.1`), it will use `$(LOCAL_MODULE).1` as
LOCAL_BUILT_MODULE_STEM and this will lead to missing target ninja
error.

Bug: 111579848
Test: Build a program that links libc++_host (from prebuilts/clang)
Change-Id: Id96726c69705d518ea725bb6abd8ff4527ca0cbc
2018-08-09 10:45:18 +08:00