Commit graph

1272 commits

Author SHA1 Message Date
Colin Cross
75b50421af Compile with javac by default
javac is replacing jack as the default compiler for platform builds.
Leave it on for unbundled builds, we don't have a solution for lambdas
in unbundled builds yet (b/62038127).

Temporarily allow products to continue to default to jack by setting
PRODUCT_COMPILE_WITH_JACK=true.

This reapplies I1c3857f64eafa445ad1b9dd94eff85bef05f4649.

Bug: 36902714
Test: m -j checkbuild
Test: https://android-build.googleplex.com/builds/view-workplan?viewType=Table&workplanId=L50600000086240009&nodeType=Trybot
Test: https://android-build.googleplex.com/builds/view-workplan?viewType=Table&workplanId=L68900000086676531&nodeType=Trybot
Test: https://android-build.googleplex.com/builds/view-workplan?viewType=Table&workplanId=L37200000086753998&nodeType=Trybot
Test: https://android-build.googleplex.com/builds/view-workplan?viewType=Table&workplanId=L74600000087054271&nodeType=Trybot
Test: sailfish-userdebug boots and basic interactions work
Test: art tests pass
Test: libcore tests pass
Change-Id: Icd1b549cd8a010758a6e5d98b39569fcd1825f60
2017-07-28 13:01:32 -07:00
Tobias Thierer
1b53ea0908 Allow builds with costum toolchains.
Android bundles an OpenJDK-derived toolchain to avoid issues with
unsupported toolchains. For development / experiment purposes, this
CL the toolchain to be overridden via OVERRIDE_ANDROID_JAVA_HOME.

It is an error for OVERRIDE_ANDROID_JAVA_HOME to be set but not
point to a valid toolchain, but this error is not explicitly
checked for.

Bug: 38177295
Test: Treehugger

Change-Id: I72f641f560501e498f9c86a4380f19941fca11ad
2017-07-26 17:54:11 +01:00
Colin Cross
3a1544ab1a Make JAVA_HOME absolute inside build
Export JAVA_HOME as an absolute path to commands running inside
a build.

Should fix errors invoking gradle from inside a build:
ERROR: JAVA_HOME is set to an invalid directory: prebuilts/jdk/jdk8/linux-x86
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

Test: treehugger
Change-Id: I16e4482b2d74ede0843715be3b08c65ce33cf403
2017-07-24 19:27:31 -07:00
Colin Cross
e97e69359a Use java prebuilts
Point the make java variables at JDK prebuilts in
prebuilts/jdk/jdk8, add them to the path, and clean up
some old overrides.

Reapplies Ibbeb30fab96e45aedd5bb6d710d1170f85789982 after updating
some more manifests to include the prebuilts.

Bug: 62956999
Test: m -j checkbuild
Change-Id: I9e27aa5cb04d1ed09e43b798e5d654843afc000f
(cherry picked from commit 1931750940)
2017-07-20 15:14:26 +00:00
Colin Cross
02112900cc Revert "Use java prebuilts"
This reverts commit 1931750940.

Change-Id: I7a99fd6c53d35a2a674f2d60b113a727f3c453ce
2017-07-19 22:42:46 +00:00
Colin Cross
1931750940 Use java prebuilts
Point the make java variables at JDK prebuilts in
prebuilts/jdk/jdk8, add them to the path, and clean up
some old overrides.

Bug: 62956999
Test: m -j checkbuild
Change-Id: Ibbeb30fab96e45aedd5bb6d710d1170f85789982
2017-07-14 14:18:53 -07:00
Colin Cross
a12d38a721 Increase max heap size for javac to 2GB.
Compiling Dialer requires increasing the javac heap size above
1GB, probably due to the extensive use of annotation processors.
Increase it to 2GB.

Test: m -j ANDROID_COMPILE_WITH_JACK=false
Change-Id: I4dd3759a98ea915469e69f563dc49be8a25d518e
Merged-In: I4dd3759a98ea915469e69f563dc49be8a25d518e
(cherry picked from commit 0e785c79b8)
2017-07-06 16:13:00 -07:00
Colin Cross
0851df8c82 Provide make variables for java binaries
Replace java -> $(JAVA), etc. to prepare for moving java binaries
out of the path and using full paths to them.

Test: builds
Bug: 62956999
Change-Id: I5dfcd0d4e855ecde69cd127169e9545e59723d12
2017-07-01 01:03:14 +00:00
Colin Cross
79e2f73b6c Re-enable dx support
This is a partial revert of commits:
858657366f Remove support of disabling Jack.
3ae7861252 Remove javac support in host dex rules.
22313f2b2a Remove rules for building dex with dx

Test: builds
Change-Id: Ie12d743cbe978bdeb030910848b67f5945a4fec8
2017-02-16 14:08:45 -08:00
Colin Cross
067d781530 Remove global linker search paths
Remove the global linker search path, as it can cause spurious build
failures.  If a library with the same name as a system library is in the
process of being written to the directory in the global search path, and
the linker may try to read the partially-written built one instead of the
system one.  We already use full paths to libraries for target builds,
do the same for host builds.  Also remove the normalize library
functions, they are no longer necessary.

Test: m -j checkbuild
Bug: 31393456
Change-Id: If9fc631e111f568c700fd73e103445c30d7e9d11
2016-09-09 11:01:15 -07:00
Duane Sand
47b57e6bd2 Allowing pairing mips64r6 with mips32r1 and r2
On mips64r6 builds, the shell variable ARCH_MIPS_REV6 is not
cleared before compiling 2nd arch parts.  This bug is harmless when
2nd arch is mips32r6 but it omits needed mips-specific assembly
files when compiling libagl and libpixelflinger for mips32r1 or r2.

Clearing the variable is impractical.  Using TARGET_2ND_ARCH qualifiers
would work, but Arm and x86 use a simpler method with distinct ARCH_ARM
and ARCH_ARM64 symbols.  ARCH_MIPS_REV6 is used in two places.
Both controll 32-bit parts only, so neither place needs adjustment.

Change-Id: Id1ea5e8b6f8666d9df219fa9ef41834bd31f5dd8
2016-08-10 12:13:30 -07:00
Dan Willemsen
e72fc63901 Merge "Add NATIVE_TESTS class, move host native tests" 2016-06-06 23:59:23 +00:00
Dan Willemsen
056609ccfe Remove unnecessary variables
These are all either recently unused due to the removal of CFLAGS/etc,
or have been exported by Soong and are no longer necessary.

Change-Id: I5930d43fda21acc8202b3d8ea010fbefb6ae4cf1
2016-05-25 21:23:20 -07:00
Dan Willemsen
7fe992c0cc Add NATIVE_TESTS class, move host native tests
Host native tests have been getting installed into
out/host/linux-x86/bin/..., but this pollutes the bin directory with a
lot of poorly named tests. Also, to support 32-bit and 64-bit tests, we
need to have different names with different suffixes. This causes
problems when tests expect to be named something specific (like gtest).
It's also convenient to store test data next to the test itself.

So with this change, native tests will be installed in
out/host/linux-x86/nativetest[64]/$(LOCAL_MODULE)/$(LOCAL_MODULE_STEM)
just like target tests get installed into /data/nativetest[64].

Implement this using a new NATIVE_TESTS class, which is like
EXECUTABLES, but sets up the install path differently, and configures
the rpath to load shared libraries with the proper relative path.
LOCAL_MODULE_RELATIVE_PATH can be used to control the directory name, it
will default to $(LOCAL_MODULE). This way multiple related tests can be
grouped together.

Target native tests also use NATIVE_TESTS now, but nothing should change
other than LOCAL_MODULE_RELATIVE_PATH can be used.

Change-Id: I535e42b1a6b21c5b8d6a580aa2f944d2be35e27d
2016-05-24 12:43:16 -07:00
Dan Willemsen
174feb906f Remove (C|CPP|CONLY|LD)FLAGS checked by Soong
At the beginning of every build, Soong has exported its version of these
variables, and has been ensuring that when sorted, the result is the
same. So these variables all have the same flags of the Soong ones, but
may be in different orders. We don't believe any of the remaining order
differences matter. As we remove the Make definitions, the exported
Soong variables will take over.

This only removes lines that change one of these variables:

  [2ND_][CLANG_]HOST_CROSS_GLOBAL_CFLAGS
  [2ND_][CLANG_]HOST_CROSS_GLOBAL_CONLYFLAGS
  [2ND_][CLANG_]HOST_CROSS_GLOBAL_CPPFLAGS
  [2ND_][CLANG_]HOST_CROSS_GLOBAL_LDFLAGS
  [2ND_][CLANG_]HOST_GLOBAL_CFLAGS
  [2ND_][CLANG_]HOST_GLOBAL_CONLYFLAGS
  [2ND_][CLANG_]HOST_GLOBAL_CPPFLAGS
  [2ND_][CLANG_]HOST_GLOBAL_LDFLAGS
  [2ND_][CLANG_]TARGET_GLOBAL_CFLAGS
  [2ND_][CLANG_]TARGET_GLOBAL_CONLYFLAGS
  [2ND_][CLANG_]TARGET_GLOBAL_CPPFLAGS
  [2ND_][CLANG_]TARGET_GLOBAL_LDFLAGS

Many other variables are unnecessary now too, but those will be removed
in another change. For those we can ensure the build.ninja file does not
change, but we expect it to change here due to the ordering differences.

Change-Id: I0bd0778706d02ee27b2784dd8dc6b2c71d37bd3a
2016-05-18 18:10:04 -07:00
Dan Willemsen
3fe3248c36 Windows: Stop adding to GLOBAL_LD_DIRS
Soong does not have the idea of global linking directories, so move the
windows prebuilt library directory to GLOBAL_LDFLAGS instead.

Change-Id: Ie101146f4682cd85924463aa5acaa46869938e6c
2016-05-18 16:50:46 -07:00
Dan Willemsen
6864e3790c Merge "Remove trailing newline from TARGET_C_INCLUDES" 2016-05-18 23:50:27 +00:00
Dan Willemsen
5baaba771c Remove trailing newline from TARGET_C_INCLUDES
In preparation for comparing with the Soong variable.

Change-Id: I159507757ed7678a33a3c94e6d01d170485e251a
2016-05-18 15:38:04 -07:00
Dan Willemsen
8308f506ce Remove (TARGET|HOST)_NO_UNDEFINED_LDFLAGS
We never use it for host modules, and all the target configurations use
the same linker argument. This matches Soong.

Change-Id: Ibcba9a4ce340c7a12306d1fee620a04027c0e292
2016-05-18 12:50:53 -07:00
Dan Willemsen
4863dafcb1 Remove make variables exported from Soong
These have all been strictly checked by Soong, so the values currently
match. Just remove them so that the make variables exported by Soong
will take over.

This also removes some of the GCC reconfiguration, since we haven't
implemented that in Soong. If it becomes useful in the future, we'll
implement it there.

Some things like TARGET_TOOCHAIN_ROOT can nearly be removed, but are
used before the Soong-exported make_vars.mk is loaded. In that case,
added to the clang cflags, so it can be removed once the cflags are
removed.

Others, like LLVM_PREBUILTS_VERSION are loaded even earlier -- in
envsetup.sh before we've even configured Soong. So for now, keep the
Make definition, and continue ensuring it's the same as the Soong
version.

Change-Id: I554b27062ac43610828a8c06d640d919a2dc21ca
2016-05-16 20:39:58 -07:00
Dan Willemsen
db16dd2384 Remove TARGET_LIBGCC/LIBATOMIC/LIBGCOV
Instead, use the libgcc/libatomic/libgcov from the static libraries dir,
which is provided by Soong. Copy the libraries using the Soong script if
Soong is disabled - this can be removed once USE_SOONG is removed.

Change-Id: Iad2ad20ad5c3cfc48bf1e46e594a482609098d7a
2016-05-16 17:26:54 -07:00
Dan Willemsen
19b7692496 Merge "Add a 32-bit x86_64 arch variant" 2016-05-11 00:35:59 +00:00
Dan Willemsen
9826900aea Do not apply -Wl,--fix-cortex-a8 to Cortex-A9
Change-Id: I11d380163423cb4aa0fee60ecbaa1e38fa5143a1
2016-05-10 15:36:58 -07:00
Dan Willemsen
04aa521eca Add a 32-bit x86_64 arch variant
The current 32-bit configuration for generic x86_64 targets inherits some
variables (SSE4 support) from the 64-bit configuration, and overrides
the make variables used for other configurations (SSSE3). Ideally, these
would be using different variables, but until then, unify the
configuration for x86_64 targets so that everything is consistent.

Bug: 28694691
Change-Id: I47e67299d4c632e7491d7e73dc0fc6480ef08006
2016-05-10 14:15:41 -07:00
Dan Willemsen
db14f793bc Remove arm-specific -Wno-psabi
This flag was added to stop a GCC 4.4 specific warning. Since we've
upgraded, this flag is no longer necessary. It's already stripped for
clang builds, and I found no instances in the logs after removing it.

Change-Id: If5316d2eb8066dc43d7af7aebc7e4920b4ada192
2016-05-06 17:08:24 -07:00
Elliott Hughes
1598df4c7d libm's headers have moved to live with their libc cousins.
(To reduce the need for this kind of thing in the various build systems.)

Change-Id: I4430a76a749262b0234c194434b331f7294da009
2016-04-04 12:58:50 -07:00
Ying Wang
858657366f Remove support of disabling Jack.
We removed code and variables related to running dx on classes.jar in
this change. Also removed target emma rules (but kept the emma rules for
host java libraries), for it's now done by Jack.
We still support to build classes.jar (and javalib.jar for static Java
libraries) using javac, because tools like javadoc need class files as
input.
Removed the obsolete install-dex-debug.

Bug: 27400061
Change-Id: If0bcdfe62cb181a98754fb0dbe1c12c92e38d3e8
2016-03-30 14:03:12 -07:00
Dan Willemsen
6a54a9f10a Darwin: Use the same ar as Soong
Soong uses the copy of `ar` in the OSX SDK instead of the wrapper in
/usr/bin/ar. /usr/bin/ar appears to be a thin wrapper that looks up the
current SDK and passes execution to it. Soong does this so that it can
actually set up a dependency on the tool.

Change-Id: Ia4e4fbe3287539933fa98a1354c3ccee91f4d552
2016-03-29 16:21:32 -07:00
Dan Willemsen
ee4a6fa59e OSX: Use the oldest SDK, but always set our target to 10.8
Build binaries usable on older machines even if older SDKs are not
installed. Older SDKs can no longer be installed on newer Xcode
versions.

Change-Id: I0c9f2534466a127a19107820879c2856bfac0076
2016-03-09 10:52:59 -08:00
Dan Willemsen
441d646c6f Fix C++ on Darwin
We've been including the system libc++ headers even if we're building
against our version of libc++. Stop doing that, and only add the headers
to our path if we're using the system libraries.

If nothing is specified, on recent OSX versions, libc++ is the default
c++ library instead of libstdc++. We've been explicitly including the
libc++ headers on all versions, but that breaks old versions. Force us
over to libc++, since the system libstdc++ does not support C++11, and
libc++ is still supported on our oldest version (10.8).

Change-Id: I1fccee8da0f425e10ccc9d3247ed40664eb6ada0
2016-03-08 20:15:21 -08:00
Dan Willemsen
2a24bad8cc Remove support for /Developer
/Developer was removed in Xcode 4.3. Our minimum SDK version is 10.8,
which implies at least Xcode 4.4, and our documentation requires
Xcode 4.5.2.

Change-Id: Ib343df6ded6e98222d8ee2e542e1f3fadd2b1397
2016-03-08 13:53:15 -08:00
Dan Willemsen
fcefd5f6d8 Remove support for Darwin 10.6 SDK
Our minimum version is 10.8

Change-Id: I2f1984c2227861a3c784f2a5070853c2d1b250d6
2016-03-08 13:22:36 -08:00
Olof Johansson
b044f082e6 Merge "sandybridge setup: no AES_NI, AVX, MOVBE" 2016-02-29 23:27:04 +00:00
Alex Light
bdfeb3e760 Mark the cortex-{a7,a53,a53.57} chips as supporting LPAE
Bug: 27340895
Bug: 27324856

Change-Id: Id3994c6d334c8bb673fc3849550f591136a8dd6a
2016-02-24 13:54:11 -08:00
Olof Johansson
593eb7b8d7 sandybridge setup: no AES_NI, AVX, MOVBE
Sandy Bridge actually doesn't have all of these options. For example AVX is only
available on the higher-end SKUs (not on Celeron G550).

Change-Id: Ib595a9a6b464626d0c88525c6aaa4d69176645cc
2016-02-23 20:42:42 -08:00
Chih-Hung Hsieh
765c1ea6d7 Use newest clang static analyzers.
* When WITH_STATIC_ANALYZER is set and non-zero, and clang compiler is used,
  call new clang ccc-analyzer or c++-analyzer.
* Otherwise, if WITH_SYNTAX_CHECK is set and non-zero,
  call compiler with -fsyntax-only.
* Replace "--sysroot=path" with "--sysroot path", to work with ccc-analyzer.
* ccc-analyzer executes the original compilation command to generate
  object files before calling clang with --analyze to do static analysis.
* When clang is called with --analyze, macro __clang_analyzer__ is defined.

BUG: 13287788

Change-Id: I5edb25b52998d871385dd000778db2ce83224078
2016-02-11 16:43:51 -08:00
Neil Fuller
dcd446e1e9 Merge "Allow java targets to support 1.8 source / target" 2016-02-09 23:01:40 +00:00
Dan Willemsen
9ecbf83259 Add 64-bit windows cross-compiles
This is mostly the same as the existing 2ND_HOST / HOST_CROSS support.

The interesting thing I did here was make x86 the 'first' architecture,
and x86_64 the second. This way LOCAL_MULTILIB := first defaults to
32-bit windows modules.

  windows-x86/bin   <- defaults to 32-bit executables
  windows-x86/lib   <- 32-bit libraries, like before
  windows-x86/lib64 <- 64-bit libraries
  windows-x86/obj   <- 32-bit intermediates
  windows-x86/obj64 <- 64-bit intermediates

Then modules are registered with the names:

  host_cross_liblog    <- 32-bit, like before
  host_cross_liblog_64 <- 64-bit

Bug: 26957718
Change-Id: I9f119411acb43e973ec1e6bca3c1dc291c91556c
2016-02-05 16:33:18 -08:00
Neil Fuller
2428bfeb88 Allow java targets to support 1.8 source / target
This change enables build rules to specify:

LOCAL_JAVA_LANGUAGE_VERSION := 1.8

to enable -source 1.8 -target 1.8 for javac and
equivalent flags for Jack.

Bug: 26753820
(cherry-picked from commit cdfbe4a852)

Change-Id: I361c99dd599e7b4a041f02c9562e461da2b0502e
2016-02-03 17:08:39 +00:00
Stephen Hines
625e7159ff Switch to Vista instead of Win2K.
Bug: http://b/26524325
Bug: http://b/25282907

The latest Clang/LLVM requires Vista APIs in order to execute, so we
need to bump the minimum required Windows version for our host tools.

Change-Id: Ic1a760bc240060f5de39ce3a68484886021ff3d9
2016-01-12 17:56:47 -08:00
Elliott Hughes
03b7effb8d Merge "Enable -fstack-protector-strong for arm64." 2015-12-18 21:36:49 +00:00
Elliott Hughes
7fca8a373f Merge "Enable -fstack-protector-strong for arm." 2015-12-18 21:36:27 +00:00
Than McIntosh
2c3b926ab3 Re-enable gold linker for aarch64.
Turn back on ld.gold and W-l,--icf=safe for
aarch64, now that the prebuilt ld.gold has been updated
with support for reloc 311/312 (fixed upstream, see
https://sourceware.org/bugzilla/show_bug.cgi?id=19042)

Bug: 25642296
Bug: 26153840

Change-Id: Idceb357a48d9da4eec38ab8f2103245d500622ae
2015-12-15 09:27:19 -05:00
Elliott Hughes
09ba4c870d Turn on stack protector for mips64.
Go straight to -fstack-protector-strong, since it works to boot the emulator.

Change-Id: I2b65a0ab4426856ae05f66c1e294951e45bd72b6
2015-12-14 14:46:38 -08:00
Elliott Hughes
b9b89e9385 Turn on stack protector for mips.
Go straight to -fstack-protector-strong, since it works to boot the emulator.

Change-Id: Ie44abd869355d2163dec7d9e2635b26b45255df6
2015-12-14 14:15:12 -08:00
Elliott Hughes
02191c97ef Merge "Enable -fstack-protector-strong for x86-64." 2015-12-14 21:45:40 +00:00
Elliott Hughes
505e4ec646 Be smarter about stack-protector on the host.
Some projects are still built with our host GCC 4.8, which doesn't
support -fstack-protector-strong. The combo .mk files are used by
GCC and clang, so it's not safe to turn on -fstack-protector-strong
there. Instead, do it in the clang-specific .mk for now.

We can clean this up when elfutils (the last code built for the host
with GCC that I'm aware of) is built by clang. We'll be able to
remove the host GCC prebuilts too!

Change-Id: I314b9eab071c132a8e2cb8cc779a75ae8abb12e2
2015-12-14 13:20:59 -08:00
Elliott Hughes
7abad39b78 Merge "Enable -fstack-protector-strong for x86." 2015-12-14 21:05:21 +00:00
Elliott Hughes
2747fa8f87 Enable -fstack-protector-strong for arm64.
This results in nearly all functions with the possibility of stack
corruption getting stack canaries, because it applies to any function
taking a reference to the frame or with a local array rather than just
the functions with arrays larger than 8 bytes. It was developed for use
in Chrome (and Chrome OS) and has also been adopted by various other
distributions (Arch, Fedora, Ubuntu, etc).

The code size increase ranges from ~1.5% to ~2.5%, compared to ~0.3% to
~0.7% with the more conservative switch. The increase in the performance
loss is usually minimal. The overall size increase once everything other
than C and C++ code is taken into account is minimal, and it greatly
improves the mitigation of stack buffer overflow vulnerabilities.

https://lwn.net/Articles/584225/

Change-Id: I2fb7f0bfccbfa5d22ca8858309a133469edbc7b6
2015-12-14 11:18:24 -08:00
Elliott Hughes
c8cc919db5 Enable -fstack-protector-strong for arm.
This results in nearly all functions with the possibility of stack
corruption getting stack canaries, because it applies to any function
taking a reference to the frame or with a local array rather than just
the functions with arrays larger than 8 bytes. It was developed for use
in Chrome (and Chrome OS) and has also been adopted by various other
distributions (Arch, Fedora, Ubuntu, etc).

The code size increase ranges from ~1.5% to ~2.5%, compared to ~0.3% to
~0.7% with the more conservative switch. The increase in the performance
loss is usually minimal. The overall size increase once everything other
than C and C++ code is taken into account is minimal, and it greatly
improves the mitigation of stack buffer overflow vulnerabilities.

https://lwn.net/Articles/584225/

Change-Id: Iccc20852db8a5e4dd9792f9da6d5e325fc59b0a5
2015-12-14 11:17:08 -08:00
Elliott Hughes
5324c3c19f Enable -fstack-protector-strong for x86-64.
This results in nearly all functions with the possibility of stack
corruption getting stack canaries, because it applies to any function
taking a reference to the frame or with a local array rather than just
the functions with arrays larger than 8 bytes. It was developed for use
in Chrome (and Chrome OS) and has also been adopted by various other
distributions (Arch, Fedora, Ubuntu, etc).

The code size increase ranges from ~1.5% to ~2.5%, compared to ~0.3% to
~0.7% with the more conservative switch. The increase in the performance
loss is usually minimal. The overall size increase once everything other
than C and C++ code is taken into account is minimal, and it greatly
improves the mitigation of stack buffer overflow vulnerabilities.

https://lwn.net/Articles/584225/

Change-Id: I3ce7a73c5cf36eba5c74df37367f3d3475b0a4ed
2015-12-14 11:16:20 -08:00
Elliott Hughes
8ebc4d6aab Enable -fstack-protector-strong for x86.
This results in nearly all functions with the possibility of stack
corruption getting stack canaries, because it applies to any function
taking a reference to the frame or with a local array rather than just
the functions with arrays larger than 8 bytes. It was developed for use
in Chrome (and Chrome OS) and has also been adopted by various other
distributions (Arch, Fedora, Ubuntu, etc).

The code size increase ranges from ~1.5% to ~2.5%, compared to ~0.3% to
~0.7% with the more conservative switch. The increase in the performance
loss is usually minimal. The overall size increase once everything other
than C and C++ code is taken into account is minimal, and it greatly
improves the mitigation of stack buffer overflow vulnerabilities.

https://lwn.net/Articles/584225/

Change-Id: I55a9fdbf5777ccdeed9f2e9a23c73bb94ad7b646
2015-12-14 11:15:15 -08:00
Elliott Hughes
ae316d2d59 Enable -fstack-protector-strong for the host.
This results in nearly all functions with the possibility of stack
corruption getting stack canaries, because it applies to any function
taking a reference to the frame or with a local array rather than just
the functions with arrays larger than 8 bytes. It was developed for use
in Chrome (and Chrome OS) and has also been adopted by various other
distributions (Arch, Fedora, Ubuntu, etc).

The code size increase ranges from ~1.5% to ~2.5%, compared to ~0.3% to
~0.7% with the more conservative switch. The increase in the performance
loss is usually minimal. The overall size increase once everything other
than C and C++ code is taken into account is minimal, and it greatly
improves the mitigation of stack buffer overflow vulnerabilities.

https://lwn.net/Articles/584225/

Change-Id: I97a2187cebac64e3b9f22b691d4676b6da083ebd
2015-12-14 11:14:21 -08:00
Dan Willemsen
da9c00da5f Enforce linker version-scripts are valid
Currently, if a version script is passed to the linker (using
-Wl,--version-script,...), it is used to limit symbol visibility and
assign symbol versions. But if a symbol is listed in the version script
but is not present in the binary, no error or warning is given.

Pass -Wl,--no-undefined-version to the linker so that it verifies all
(non-wildcard, C) entries in the version script match symbols in the
binary.

Change-Id: I65878931ab61124ae75e2c738cc733adfb107afc
2015-12-02 19:19:04 -08:00
Elliott Hughes
cf1c15c975 Set WINVER as well as _WIN32_WINNT.
Change-Id: I6ace26d6c25549cf42755423340af07e96e05779
2015-11-12 13:33:20 -08:00
Chih-hung Hsieh
98c27a83da Merge "Revert "Enable gold linker for aarch64."" 2015-11-12 01:04:06 +00:00
Chih-hung Hsieh
65c7b5c6d6 Revert "Enable gold linker for aarch64."
This reverts commit a7f68ee9ea.

Change-Id: I8c15df8ce81859f1b950dbac0a47d7d24c0f4cc2
BUG: 25642296
2015-11-11 23:07:01 +00:00
Than McIntosh
838ad09b17 Merge "Enable gold linker for aarch64." 2015-11-05 11:49:56 +00:00
Than McIntosh
a7f68ee9ea Enable gold linker for aarch64.
[Second attempt, this time with updated mac prebuilt]

Switches default linker from -fuse-ld-bfd to
-fuse-ld=gold, and enables -Wl,--icf=safe. This
changes reduces /system/lib64/*.so text size
by about 2% for N9.

Change-Id: I587075aae9d70cb6b16e55dc9cd1052580ac2626
2015-11-04 19:34:50 -05:00
Shinichiro Hamaji
0e7587a9ea Use .KATI_RESTAT to reduce unnecessary rebuilds of binaries
When a shared object is rebuilt, all dependent libraries and
executables are rebuilt. Such rebuild is unnecessary when there
is no interface change. With this patch, .toc files will be
generated for all .so files. The rule which generates .toc files
has ninja's restat=1 and .toc files are not changed ninja won't
rebuild dependent targets.

Performance:

$ m && touch bionic/libc/stdio/stdio.c && time m
Before: 1m03s (2563 targets)
After: 21s (90 targets)

Bug: 24597504
Change-Id: Ia5dd950273d143f4e99eee8bef7478f1a94cd138
2015-11-04 15:23:59 +09:00
Dan Albert
e4256f5759 Revert "Enable gold linker for aarch64."
Causes build failures on Darwin.

prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin/ld.gold: warning: cannot scan executable section 5 of out/target/product/flounder/obj/SHARED_LIBRARIES/libdl_intermediates/libdl.o for Cortex-A53 erratum because it has no mapping symbols.

prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin/ld.gold: warning: cannot scan executable section 8 of out/target/product/flounder/obj/SHARED_LIBRARIES/libdl_intermediates/libdl.o for Cortex-A53 erratum because it has no mapping symbols.

prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin/ld.gold: warning: cannot scan executable section 11 of out/target/product/flounder/obj/SHARED_LIBRARIES/libdl_intermediates/libdl.o for Cortex-A53 erratum because it has no mapping symbols.

prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin/ld.gold: error: treating warnings as errors

This reverts commit 127d110172.

Change-Id: I1d3de90f5ae777b66a8f94fbcc9ccde8a9e3001c
2015-10-27 18:18:46 +00:00
Than McIntosh
127d110172 Enable gold linker for aarch64.
Switches default linker from -fuse-ld-bfd to
-fuse-ld=gold, and enables -Wl,--icf=safe. This
changes reduces /system/lib64/*.so text size
by about 2% for N9.

Change-Id: I0ef2483e1c47c34e63292dad6f6bf532359b733e
2015-10-22 09:44:48 -04:00
Ying Wang
16b1b0576c Allow to build against Mac OS X SDK 10.11.
Bug: 24739158
Change-Id: I7c57e141dd02a0d2de5a7a1ccbc72ffe422a8d6f
2015-10-13 18:00:45 -07:00
Colin Cross
d98fe91a75 am 6b02b76a: Merge "Fix gcc color diagnostics"
* commit '6b02b76ab9ebb5c21743abc5616379d19bc1c304':
  Fix gcc color diagnostics
2015-10-03 00:43:23 +00:00
Colin Cross
12adaf5cb9 Fix gcc color diagnostics
gcc color diagnostics stopped working when the flag was moved to
TARGET_GLOBAL_CFLAGS, as that gets overwritten by combo/select.mk.  Put
it back in COMMON_GLOBAL_CFLAGS, and then let the windows build filter
it out, similar to the way clang deals with unknown flags.

Change-Id: I2db221edb893d81f199494e7515d1b9282c12fae
2015-10-02 16:42:10 -07:00
Christopher Ferris
9937e7b2a3 am 76ec0c4c: Merge "Set mcpu targets based on cpu variant."
* commit '76ec0c4c53aab6fca7af1badab882518962a9755':
  Set mcpu targets based on cpu variant.
2015-09-25 16:35:56 +00:00
Christopher Ferris
76ec0c4c53 Merge "Set mcpu targets based on cpu variant." 2015-09-25 16:29:33 +00:00
Christopher Ferris
561b4c1995 Set mcpu targets based on cpu variant.
Make cortex-a53 and cortex-a53.a57 use cortex-a7.

Change-Id: I89d5b3f044c867ec99aae319eafc33f2edf1f9f2
2015-09-24 13:59:33 -07:00
Dan Willemsen
04df655192 am b6a3ede5: Merge "Remove trailing / for HOST_TOOLCHAIN_FOR_CLANG"
* commit 'b6a3ede5506bec89618519bf4a8adb635e570e89':
  Remove trailing / for HOST_TOOLCHAIN_FOR_CLANG
2015-09-24 02:20:38 +00:00
Dan Willemsen
c339398581 Remove trailing / for HOST_TOOLCHAIN_FOR_CLANG
The darwin version doesn't have a trailing slash. The common case is to
append a path to it:

  $(HOST_TOOLCHAIN_FOR_CLANG)/lib/...

Which means we end up with two slashes.

Change-Id: I74e88924ecfd092c5f7871e188ede0aab29cf65b
2015-09-23 23:46:44 +00:00
Christopher Ferris
2649e750b6 am 9bc462c1: Merge "Add the common directory back to kernel headers."
* commit '9bc462c12a5c4519b00e988b738c029c688c12d5':
  Add the common directory back to kernel headers.
2015-09-19 19:52:16 +00:00
Christopher Ferris
6a2f28514c Add the common directory back to kernel headers.
There will only be a very small set of non-uapi headers. This is
mostly being done for the scsi headers since the kernel has not
made uapi versions of all of them.

Change-Id: I44904b07ff96de918dc5fcab4e5f117a34cb2a87
2015-09-17 21:20:03 -07:00
Dan Willemsen
749e07c648 am c8db47a0: Merge "Don\'t build windows modules with clang, fix flags"
* commit 'c8db47a0213aa5c204c140cb9268389b4175ae06':
  Don't build windows modules with clang, fix flags
2015-09-09 23:25:11 +00:00
Dan Willemsen
7728817ab9 Don't build windows modules with clang, fix flags
shamu checkbuilds set USE_CLANG_PLATFORM_BUILD, which shouldn't apply to
modules built for windows. Also fix some flags that were being set
improperly.

Bug: 23566667
Change-Id: Id4c5b7cc59966328483d90f2b7be3f35e439ecee
2015-09-09 16:10:50 -07:00
Dan Willemsen
c98d9a9d0f am f1c09d7f: Merge "Add HOST_CROSS_OS"
* commit 'f1c09d7fbd92a08cc51950a7d35fb5f7fc564a20':
  Add HOST_CROSS_OS
2015-09-09 18:19:13 +00:00
Dan Willemsen
057aaea54a Add HOST_CROSS_OS
Instead of using recursive make to change the HOST_OS when building the
windows SDK under linux, add the concept of cross-building to another
host os.

Bug: 23566667
Change-Id: I6dc525b601b6251d458d197c30bf4660d7485502
2015-09-09 18:12:29 +00:00
Ying Wang
119cec9a4a am 4e2f1903: Merge "Clean up Javac a little bit."
* commit '4e2f190315759b4270ab414b9ff1e24a19521521':
  Clean up Javac a little bit.
2015-09-02 21:18:38 +00:00
Ying Wang
447d69678e Clean up Javac a little bit.
- Added GLOBAL_JAVAC_DEBUG_FLAGS and merge it to
  PRIVATE_JAVACFLAGS/PRIVATE_JACK_FLAGS to get rid of
  PRIVATE_JAVAC_DEBUG_FLAGS/PRIVATE_JACK_DEBUG_FLAGS.
- With Java rules out of base_rules.mk we can get rid
  of java_alternative_checked_module now.

Change-Id: I1a14716c785e3d49330a75044107662ce96a9307
2015-09-02 10:04:18 -07:00
Elliott Hughes
f04f391b5f am 4548e7f4: Merge "Remove AndroidConfig.h."
* commit '4548e7f49dbec05c8b8187b0ea9e746fc47ec5d3':
  Remove AndroidConfig.h.
2015-08-28 19:59:18 +00:00
Elliott Hughes
43146118aa Remove AndroidConfig.h.
This change leaves soong references.

Change-Id: Iee32b6b97ad9711f69e999c9d01f01d71562b63f
2015-08-28 10:31:28 -07:00
Elliott Hughes
dc289ce17c am 344c3394: am 6f534125: Merge "Fix Linux host checkbuilds."
* commit '344c33949b48ec5f3d27bff36f145f157156cf19':
  Fix Linux host checkbuilds.
2015-08-21 00:11:53 +00:00
Elliott Hughes
6f5341259c Merge "Fix Linux host checkbuilds." 2015-08-20 23:56:07 +00:00
Elliott Hughes
ac9eea9463 Fix Linux host checkbuilds.
Turns out that thanks to 9d59f41776 we actually
build *all* the host libraries both 32- and 64-bit. Rather than fix the
libraries (or fixing things so we don't build stuff we don't need) right now,
let's just put _FILE_OFFSET_BITS and _LARGEFILE_SOURCE back.

Change-Id: I6c2d6a6919d1518f775e0d6c050e2c774994c5bd
2015-08-20 16:52:47 -07:00
Elliott Hughes
158800c9ed am 30a18bca: am a3fa59b1: Merge "Kill host Linux AndroidConfig.h."
* commit '30a18bca6222065d15e1b18d71a29a8fb921d4a8':
  Kill host Linux AndroidConfig.h.
2015-08-20 23:20:21 +00:00
Elliott Hughes
a3fa59b12b Merge "Kill host Linux AndroidConfig.h." 2015-08-20 23:10:05 +00:00
Elliott Hughes
b4ec57c016 am 00da9ced: am ded991b4: Merge "Revert "Fix Windows SDK build.""
* commit '00da9cede0b4199d3b6dea73b61afa8610b5c339':
  Revert "Fix Windows SDK build."
2015-08-20 21:54:58 +00:00
Elliott Hughes
7f45f953ad am 0049aecf: am a6065996: Merge "Stop defining WIN32."
* commit '0049aecf1763ea939cdf91e4e70fda67eb2efbee':
  Stop defining WIN32.
2015-08-20 21:54:57 +00:00
Elliott Hughes
73042ea0c7 Revert "Fix Windows SDK build."
This reverts commit b8dd176441.

This wasn't the problem, and mingw doesn't even use _LARGEFILE_SOURCE. The real problem (using WIN32 instead of _WIN32 in external/llvm) is fixed now.

Change-Id: I2b708a006b530cb18d03b1425cd65edda35ee17e
2015-08-20 21:22:19 +00:00
Elliott Hughes
f0c04c7b2e Stop defining WIN32.
Change-Id: Iac0b4745579e6de55bea02571617ae561308e1a9
2015-08-20 14:04:18 -07:00
Elliott Hughes
59b3bd27a0 am 896d0ee2: am 999fd4ea: Merge "Also -DWIN32 to keep llvm building."
* commit '896d0ee2cf123f045af859d7291dba65a0b7d789':
  Also -DWIN32 to keep llvm building.
2015-08-20 19:32:39 +00:00
Elliott Hughes
29e8a32972 am 9f9d2aed: am 79b199b8: Merge "Fix Windows SDK build."
* commit '9f9d2aedf4e28f0dec1568347ac6a052cdca12b9':
  Fix Windows SDK build.
2015-08-20 19:32:34 +00:00
Elliott Hughes
a65473b0e7 am 896b9c60: am 57069e59: Merge "Remove Windows AndroidConfig.h."
* commit '896b9c603938220ea40f75a07aef8ec1a0664f37':
  Remove Windows AndroidConfig.h.
2015-08-20 19:32:30 +00:00
Elliott Hughes
e31dfe965f Kill host Linux AndroidConfig.h.
We only build 64-bit now anyway.

Change-Id: I4bc9487522d215234509510bee66e4f210d86765
2015-08-20 11:14:23 -07:00
Elliott Hughes
0823ad3300 Also -DWIN32 to keep llvm building.
Change-Id: Ic8e70f35dda23226d60010a38cf5633840772310
2015-08-20 11:10:22 -07:00
Elliott Hughes
b8dd176441 Fix Windows SDK build.
I forgot that removing a file doesn't cause a rebuild in our lame build
system, so I hadn't actually tested my previous change.

Change-Id: Ida19d4a8fd40e37029031eac4b4ca5f0cc5c895b
2015-08-20 10:19:26 -07:00
Elliott Hughes
f8241b41d5 Remove Windows AndroidConfig.h.
The only things left that we're using are the Windows target version
and _FILE_OFFSET_BITS=64, and they can go in the combo .mk.

Also fix the unused Windows 64 .mk.

Change-Id: I5f2458d67c0a8201196a339573f861bbf18b7eb8
2015-08-20 09:56:52 -07:00
Elliott Hughes
33a1439796 am 088849e2: am b3c585d7: Merge "Stop defining HAVE_MS_C_RUNTIME."
* commit '088849e24da28e398179cd915f142ca4224e6888':
  Stop defining HAVE_MS_C_RUNTIME.
2015-08-19 22:31:13 +00:00
Elliott Hughes
19fa8413ed Stop defining HAVE_MS_C_RUNTIME.
Change-Id: Ie491547552ba64d60d669b74115da96a0fcced18
2015-08-19 14:22:59 -07:00
Dan Willemsen
1b14846717 am 48d95e75: am 05d97fe7: Merge "Remove legacy windows platform build support"
* commit '48d95e752536dc7a81c141e435e8a90b7929cf02':
  Remove legacy windows platform build support
2015-08-18 04:43:04 +00:00
Dan Willemsen
145ae32069 Remove legacy windows platform build support
We still support HOST_OS=windows for the SDK host tools cross-builds, but
that's only when USE_MINGW is set when running under linux.

Change-Id: I37da87dc9fbbd69ba10ce4d7f2668ab3f6482d92
2015-08-17 12:35:04 -07:00