Commit graph

76 commits

Author SHA1 Message Date
Peter Collingbourne
d7225eaac4 Stop mapping c++17 to c++1z.
Clang has been accepting -std=c++17 since August 2017.

Change-Id: Iebb91438ba26b3cc4dbbdcd86e15c9df5901f402
2018-12-04 16:46:27 -08:00
Dan Albert
fac114b9a5 Remove legacy NDK code.
Test: make checkbuild
Bug: None
Change-Id: Ib25e851b5ac25e918c5e20d79348c6d705bddeb2
2018-11-27 13:58:18 -08:00
Dan Willemsen
10db384ff7 Apply rtti settings to linux_bionic
Otherwise linking fails with:

ld.lld: error: undefined symbol: vtable for __cxxabiv1::__si_class_type_info
>>> referenced by contexts_split.cpp
>>>               contexts_split.o:(typeinfo for ContextsSplit) in archive out/soong/.intermediates/bionic/libc/libc_common/linux_bionic_x86_64_static/libc_common.a

ld.lld: error: undefined symbol: vtable for __cxxabiv1::__class_type_info
>>> referenced by contexts_split.cpp
>>>               contexts_split.o:(typeinfo for Contexts) in archive out/soong/.intermediates/bionic/libc/libc_common/linux_bionic_x86_64_static/libc_common.a

ld.lld: error: undefined symbol: vtable for __cxxabiv1::__si_class_type_info
>>> referenced by contexts_serialized.cpp
>>>               contexts_serialized.o:(typeinfo for ContextsSerialized) in archive out/soong/.intermediates/bionic/libc/libc_common/linux_bionic_x86_64_static/libc_common.a

ld.lld: error: undefined symbol: vtable for __cxxabiv1::__si_class_type_info
>>> referenced by system_properties.cpp
>>>               system_properties.o:(typeinfo for ContextsPreSplit) in archive out/soong/.intermediates/bionic/libc/libc_common/linux_bionic_x86_64_static/libc_common.a
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)

Bug: 31559095
Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: I03a02c7e55948a0cd04bdcb5c090bb74e1723a0f
2018-10-23 19:53:13 +00:00
Inseob Kim
21f26907cc Add support for sysprop description files to c++
From now on, a c++ shared library can be built only with adding
".sysprop" description file to srcs. Sysprop library generator will
automatically generate a .cpp and .h files, and the header file will be
exposed to any clients linking against the shared library. For the full
schema of description file, see system/tools/sysprop/sysprop.proto.

Bug: 80125326
Test: 1) write a .sysprop description file.
2) create cc_library_shared and add description file to srcs.
3) create another module, link against library of 2), include generated
header, and access generated sysprop functions
4) see compile succeeded.

Change-Id: I95005a0724aeb8f11a856b7aee92787a16a5374d
2018-10-10 00:33:01 +00:00
Dan Willemsen
8536d6b3b7 Remove GCC checks
Clang is always used now, so we can remove all the GCC checks. Removing
GCC-specific configuration will happen in the next CL.

Test: m
Change-Id: I4835ecf6062159315d0dfb07b098e60bff033a8a
2018-10-09 02:16:58 +00:00
Pirama Arumuga Nainar
43cfe82174 GccCppStdVersion should not be needed anymore
Test: Build
Change-Id: I2cd16deed269fb40a59754dec94b376383346bf0
2018-09-25 21:27:45 +00:00
Dan Willemsen
59339a29e1 Fix go vet issues
Test: go vet ./...
Change-Id: Ifb936ccc5e2b5a2c3fcbbbcb54f680e2973ea1b3
2018-07-22 21:18:45 -07:00
Jiyong Park
d54aee574d Recovery variants are built with -D__ANDROID_RECOVERY__
Recovery variant of a module is now by default built with
-D__ANDROID_RECOVERY__, thus eliminating the need to define a custom
macro to conditionally compile the module for the recovery mode.
(Of course, they can define their own macro if needed)

Bug: 63673171
Test: m -j
Change-Id: I1d1b990329793472b93c2f56080e72d690eef9ec
2018-06-09 02:03:45 +09:00
Yi Kong
cc80f8d64f Revert "Revert "Add external projects only CFlags option""
This reverts commit a9ccbb7b87.

Test: m
Change-Id: I92d7b7707f73ef3af5824d3e8cb6da0465b5e07d
2018-06-06 16:41:26 -07:00
Kevin Rocard
a9ccbb7b87 Revert "Add external projects only CFlags option"
This reverts commit 6a350878d8.

Reason for revert: Breakage of many AOSP targets

Change-Id: I917e6daa04ac02ecb98c7bb1816f9bdaf46429f5
2018-06-05 21:43:46 +00:00
Yi Kong
6a350878d8 Add external projects only CFlags option
Every time the toolchain adds a new warning, we had to suppress the
warning in every external projects that violates it, or disable it
globally -- which we end up doing most of the time since the first
option is way too time consuming.

Add a separate cflags option for external projects and move existing
-Wno-* flags there so that we can enforce better code quality for
internal projects.

TODO: Move more -Wno-* flags to ClangExtraExternalCflags

Test: m checkbuild
Change-Id: If3dee491616a1e7ba6223c2f522d100e10c5ee76
2018-06-05 19:32:02 +00:00
Jiyong Park
4a2dcb5c4b fix: recovery.cflags now works
There was a bug that recovery.cflags is ignored. Respect the property
when building for recovery.

Bug: 79146551
Test: m -j
Change-Id: I24c1c1b593c83eb1992721571c6d5c42483a41a0
2018-05-25 08:43:50 +09:00
Jiyong Park
f9332f1c86 Support recovery and recovery_available
`recovery: true` installs a module to the recovery partition.
`recovery_available: true` makes a module to be available to other
`recovery:true` or `recovery_available: true` modules.

These to are very similar to vendor, vendor_available properties, except
for the target partition.

Bug: 67916654
Bug: 64960723
Test: m -j, toybox_recovery is installed to the recovery/root/sbin
Change-Id: Iaebe0593de16c69fa70de251a61f4d018a251509
2018-05-15 16:27:12 +09: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
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
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
Dan Willemsen
a052599bb6 Remove obsolete Brillo variable
Test: none
Change-Id: I6a5ce57b317f0cdae1abef15def01e6a31e18d3e
2018-03-10 15:29:03 -08:00
Elliott Hughes
5789ca9f28 Use the platform -std= for sdk_version.
Bug: http://b/72571399
Test: builds
Change-Id: I294cfadb7de54b1ae648e02ac9af34ed7a7405d8
2018-02-20 15:27:45 +00:00
Nan Zhang
27e284d2b0 Revert "Revert "Support filegroup in exclude_srcs""
This reverts commit 606e9de344.

Reason for revert: <try to fix the broken build yesterday>

Change-Id: I2963b9af63c7c7398159e5e9a1e448266e1c81d5
Test: unittest
2018-02-15 14:38:40 -08:00
Tobias Thierer
606e9de344 Revert "Support filegroup in exclude_srcs"
This reverts commit f36a3d9b6d.

Reason for revert: Broke several builds. I'm acting build cop, reverting.

Bug: 70351683

Change-Id: I775ada4e9cb6473519d51420b41b818af163da44
2018-02-09 09:46:11 +00:00
Nan Zhang
f36a3d9b6d Support filegroup in exclude_srcs
Test: add unit-test, m -j32
Bug: b/70351683
Change-Id: Iff83c56d45dd668d9df6131c7df2e23e5c73a21b
2018-02-07 10:18:41 -08:00
Pirama Arumuga Nainar
28316d4e3b Store missing profile files into a Make variable
Bug: http://b/72642679

Store missing profile files and the modules that refer to them in the
SOONG_MODULES_MISSING_PGO_PROFILE_FILE variable passed to Make.  The
contents of this variable will be written to
$DIST_DIR/pgo_profile_file_missing.txt as part of the 'dist' target.

Test: 'm dist' and verify creation of pgo_profile_file_missing.txt.
Change-Id: I237cd0398be418be2b7db6fa65ece5ef347ecbc1
2018-01-29 10:02:27 -08:00
Pirama Arumuga Nainar
f231b19017 Add only compiler-flag dependencies as implicit
Bug: http://b/72343691

Change https://android-review.googlesource.com/c/572758, in addition to
dependencies from the compiler flags, also marked all exported
dependencies as implicit.  This can cause lots of unnecessary
recompiles.  This change moves exported dependencies back as order-only
dependencies.

Test: 1. mma in art after changing profile_compilation_info.h triggers
         only a limited number of recompiles.
      2. verify that changes to PGO profile files trigger recompiles.

Change-Id: Icb0f4cd2b6da0add3b6e5206661e6aa7a577602f
2018-01-23 11:24:33 -08:00
Pirama Arumuga Nainar
fadb7b511a Add 'openmp' compiler property
Bug: http://b/70692399

If a module has 'openmp: true', add '-fopenmp' to CFlags during any
compile step and pass the libomp runtime to the linker during any link
step.

Test: Build samples in http://aosp/572924
Change-Id: Ic2a6410ec69aae548edaf582ee41659b0058561e
2017-12-19 23:14:19 -08:00
Pirama Arumuga Nainar
70ba5a38d1 Add compile-time pathDeps as implicit dependencies
Bug: http://b/70820751
Bug: http://b/70857959

Clang does not output file dependencies from the -fprofile-use= flag
during -MD/-MM.  Add this and other path dependencies as implicit Ninja
dependencies.  Generated header dependencies are retained as OrderOnly
dependencies.

Test: Perturb profdata files for hwui/skia in internal branch and verify
that the sources get rebuilt.

Change-Id: I3247d995ee27a4882172eb15ff36acf56536b6f7
2017-12-19 15:44:38 -08:00
Dan Albert
6ab43d8597 Allow NDK static libraries to use the NDK sysroot.
Building a static library for the NDK only requires that the NDK
headers be available. Currently, A module with both
`static_ndk_lib: true` and `sdk_version: something` will have a cyclic
dependency since it both needs the NDK and is in the NDK. Create two
NDK timestamp files: one for the isolated parts of the NDK (headers
and stub libraries), and another for the full sysroot with the static
libraries.

Test: set static_ndk_lib on compiler-rt-extras, make ndk
Bug: None
Change-Id: Iab50ffa0e4cbf4cd164f376e15281030c7aad984
2017-12-14 14:13:56 -08:00
Chih-Hung Hsieh
fa0e27a1f3 No need to dump modules added -Werror.
* This reduces size of output file wall_werror.txt.
* Stop collecting SOONG_MODULES_ADDED_WERROR.

Bug: 66996870
Test: normal build
Change-Id: Ic6d87f6ee2b36b90ad0de4ac4f6f176334aba55e
2017-12-04 15:30:26 -08:00
Colin Cross
6510f91a1c Replace ModuleContext.AConfig() with Config()
AConfig() now duplicates Config().  Replace the uses of AConfig()
with Config().  Leave AConfig() for now until code in other
projects is cleaned up.

Test: m checkbuild
Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
2017-11-30 00:44:18 +00:00
Chih-Hung Hsieh
64a38dcb18 Add default -Wall -Werror or -Wall.
* When -Wno-error and -Werror are not used:
  add -Wall to the front of cflags
  if the project is in the WarningAllowedProjects,
  otherwise add -Wall -Werror.
* Add -Wall -Werror to ndk_library build targets.
* Collect names of modules with -Wno-error or without -Werror,
  and pass them to makefile variables:
      SOONG_MODULES_USING_WNO_ERROR
      SOONG_MODULES_ADDED_WERROR
      SOONG_MODULES_ADDED_WALL
* Generate ANDROID_WARNING_ALLOWED_PROJECTS for old makefiles.

Bug: 66996870
Test: normal build
Change-Id: I31385e12b80ca946c7395a5a184ef259b029aac6
2017-11-20 18:28:26 -08:00
Colin Cross
f18e11074d Fix using aidl files from filegroups
Compute sources including from filegroup and genrule dependencies
before determining if any sources will cause flags to be added.

Test: gen_test.go
Change-Id: I0434b003bbda07a58bb2ce1a0a72997918c8fae2
2017-11-17 11:22:08 -08:00
Colin Cross
26f14509d1 Move -fvisibility-inlines-hidden to global device cppflags
It was previously set on arm[64] and mips[64], this will cause it
to be set for x86[_64] too.

Bug: 68855788
Test: m checkbuild
Change-Id: I75af16e7d259963ad633cc664929144332bb435d
2017-11-13 15:18:19 -08:00
Nan Zhang
0007d810e2 Change bool, and string properties to *bool, and *string for cc
there's no use case for prepending/appending to bool, and string
properties within module struct. Declearing "*bool" and "*string" almost
cover everything user need.

I did see one case that user specify relative_install_path as
path prefix in cc_defaults, and concatenate with the one in real module
to get the final relative install path in Android.bp <bionic/tests/libs>.

Test: m -j checkbuild
Bug: b/68853585
Change-Id: If3a7a2689c3fc307aae136af6bc9c57f27a1e1a0
2017-11-07 15:57:16 -08:00
Colin Cross
87dd963ace Remove no_default_compiler_flags property
no_default_compiler_flags is only used by the crt* modules,
is unnecessary, and causes problems when necessary flags like
-no-canonical-prefixes are not passed.  Remove the property.

Use useVndk() instead of noDefaultCompilerFlags() to determine
if adding libc as a dependency is necessary and won't cause a
circular dependency.

Bug: 68719465
Test: m checkbuild
Change-Id: Iea1a082dc701dfeab211049a22f7066257347b80
2017-11-03 22:28:57 -07:00
Dan Willemsen
5922f3cb6e Switch instruction_set to *string
So that the contents gets replaced when prepended/appended instead of
merged.

Test: Set instruction_set in a cc_defaults, and in a module.
Change-Id: I0f2c789231d89efa1ab053f9dc118cd19f11b0e6
2017-10-25 15:20:50 -07:00
Jeff Gaston
af3cc2d23c Some clarifications in preparation to automatically order linker dependencies
Test: Browse the code and determine whether it's easier to understand
Bug: 66260943
Change-Id: I88c24a8a31ef68f428919087d206433659265684
2017-10-18 18:06:02 +00:00
Jiyong Park
6a43f04777 Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.

However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume

cc_library {
    name: "libfoo",
    srcs: ["foo.c"],
    target: {
        vendor: {
            srcs: ["bar.c"],
        },
    },
}

Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o

So, bar.o is included twice and this causes multiple symbol definition
error.

In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.

Bug: 67731122
Test: build
Test: cc_test.go

Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-13 14:36:12 +09:00
Jeff Gaston
7b6118be6b Revert "Some clarifications in preparation to automatically order linker dependencies"
This reverts commit 2370af0e23.

Reason for revert: New Build Breakage: aosp-master/aosp_arm64_ab-userdebug @ 4376965

Change-Id: Ibe4b819c4292457c454bf42e6d94fba3071ec04b
2017-10-04 21:07:42 +00:00
Jeff Gaston
2370af0e23 Some clarifications in preparation to automatically order linker dependencies
Test: Browse the code and determine whether it's easier to understand
Bug: 66260943
Change-Id: Ia3fdb8f38e83ad8225a72c8de2804db23a90ef9b
2017-10-03 17:18:01 -07:00
Colin Cross
38f794ee49 Refactor proto in preparation for java proto support
Test: m -j checkbuild
Change-Id: Idf00ea0bacb2777458f9af2c7eb47e1e1854eeba
2017-09-11 12:41:58 -07:00
Dan Willemsen
4f1c3d4116 Add support for Windows Message Compiler
We've only got one user of this currently, but since it needs the
location of the toolchain, and different flags based on 32 vs 64-bit,
it's easier just to add support than to get this into a genrule.

Test: Convert external/mdnsresponder to Soong, build
Change-Id: I6c19a82bc14f6ab556f6cc5f37164862ba5f9083
2017-09-09 13:06:25 -07:00
Jiyong Park
a622de8498 cflags for vendor variants
cflags that are only applied when building the vendor variant of a lib
is now supported. This will be particularily useful when existing macro
should be turned off for the vendor variant:

cflags: ["-DENABLE_FEATURE_X"],

target: {
    vendor: {
        cflags: ["-UENABLE_FEATURE_X"],
    },
},

Without this, the library author has to undef the macro inside the
source code using __ANDROID_VNDK__, which is not desired especially for
external projects.

Bug: 64514237
Test: BOARD_VNDK_VERSION=current m -j libsqlite libsqlite.vendor
Merged-In: Ib484b5b12e14ab776276a30ed2763dffadc9d642
Change-Id: Ib484b5b12e14ab776276a30ed2763dffadc9d642
(cherry picked from commit 1e7495d973)
2017-08-14 11:46:42 +09:00
Josh Gao
f5720175dd Map cpp_std c++17/gnu++17 to 1z.
C++17 is basically done, but not rubber stamped yet. Rewrite c++17 and
gnu++17 to their 1z equivalents until this happens, and we get a
version of clang that allows it.

Test: mma in a project with cpp_std c++17
Change-Id: I1626c366c3a9b47c997cc27dc9c5205201ebbdf5
2017-07-26 15:13:50 -07:00
Colin Cross
2a252bef50 Support .rs and .fs files in cc_* module srcs lists
Translate .rs and .fs files to .cpp files using llvm-rs-cc.

Test: builds
Change-Id: I242cea0d09c9985730a512cec7705c3f1479f4ed
2017-05-05 18:22:30 -07:00
Colin Cross
307d145ed5 Remove -isystem frameworks/av/include
Remove the last -isystem for global include directory (besides
bionic).

Bug: 31751828
Test: builds
Change-Id: I8f38332de8f0cffd5c56b9b5ebeacbaaf3a4faea
Merged-In: I8f38332de8f0cffd5c56b9b5ebeacbaaf3a4faea
(cherry picked from commit d13a457a45)
2017-05-03 23:56:47 +00:00
Colin Cross
10d2231d44 Check reused source files in hasSrcExt
hasSrcExt is used to determine extra flags and dependencies when
generated files are used.  If the generated files are being handled
in a static library whose objects are reused in a shared library,
the flags and dependencies still need to apply.  Instead of clearing
the source files in the shared library, move them to an OriginalSrcs
property, and check that in hasSrcExt along with the Srcs property.

Also pass extra exported include directories from the static
library to the shared library.

Bug: 37555583
Test: use protos in a cc_library
Change-Id: I709779ec03b66b220b7bd58a1f6f0b9b5067d955
2017-05-03 12:28:27 -07:00
Colin Cross
ccf01e755e Prepend arch variant include directories
Arch variant include directories should override existing include
directories, add prepend_variant to the struct tags.

Test: m -j checkbuild
Change-Id: I4a758b42c19481f9496880d29dffea7836f613c5
2017-04-27 12:21:24 -07:00
Colin Cross
dad8c954b2 Pass -I to yasm
external/libvpx needs -I flags to be propagated to yasm, but can't
handle all the other global flags (like -no-exceptions).  Add -I
arguments to YasmFlags as well as GlobalFlags.

Test: mega-device build of external/libvpx
Change-Id: I1607211c34b031fae8ffc1bd558b26019965a696
2017-04-27 12:21:24 -07:00
Dan Willemsen
4416e5db69 Split /system and /vendor modules, allow multi-installation
Nothing changes if BOARD_VNDK_VERSION isn't set.

When the VNDK is enabled (BOARD_VNDK_VERSION in Make), this will split
/system and /vendor modules into two different variant spaces that can't
link to each other. There are a few interfaces between the two variant
spaces:

The `llndk_library` stubs will be available in the /vendor variant, but
won't be installed, so at runtime the /system variant will be used.

Setting `vendor_available: true` will split a module into both variants.
The /system (or "core") variant will compile just like today. The
/vendor ("vendor") variant will compile against everything else in the
vendor space (so LL-NDK instead of libc/liblog/etc). There will be two
copies of these libraries installed onto the final device.

Since the available runtime interfaces for vendor modules may be
reduced, and your dependencies may not expose their private interfaces,
we allow the vendor variants to reduce their compilation set, and export
a different set of headers:

  cc_library {
      name: "libfoo",
      srcs: ["common.cpp", "private_impl.cpp"],
      export_include_dirs: ["include"],
      target: {
          vendor: {
	      export_include_dirs: ["include_vndk"],
	      exclude_srcs: ["private_impl.cpp"],
	      srcs: ["vendor_only.cpp"],
	  },
      },
  }

So the "core" variant would compile with both "common.cpp" and
"private_impl.cpp", and export "include".

The "vendor" variant would compile "common.cpp" and "vendor_only.cpp",
and export "include_vndk".

Bug: 36426473
Bug: 36079834
Test: out/soong/build.ninja, out/soong/Android- only changes due to _core addition and
      .llndk -> .vendor
Test: attempt to compile with BOARD_VNDK_VERSION:=current
Change-Id: Idef28764043bf6c33dc0d2e7e2026c38867ff769
2017-04-11 12:27:41 -07:00
Dan Willemsen
b916b80bf3 Add LLNDK support for the VNDK
Instead of using the NDK headers and libraries, add LL-NDK specific
headers and library stubs for VNDK users. This allows us to provide an
expanded liblog interface.

Test: aosp_arm; m -j
Test: Enable BOARD_VNDK_VERSION on aosp_arm; m -j
Test: Inspect out/soong/build.ninja before/after (w/o vndk)
Change-Id: Ic85f07fa10c695b5baab10c41f5e0ad38700bf3d
2017-04-07 10:18:56 -07:00