Commit graph

234 commits

Author SHA1 Message Date
Chih-hung Hsieh
4d9d191ee7 Merge "Simplify DEFAULT_LOCAL_TIDY_CHECKS." 2016-08-08 23:22:13 +00:00
Chih-Hung Hsieh
fac1926481 Simplify DEFAULT_LOCAL_TIDY_CHECKS.
* Now each local directory path is matched against multiple
  patterns and only the last matched one will be used,
  or the DEFAULT_GLOBAL_TIDY_CHECKS is used.

Bug: http://b/27779618
Change-Id: I786e6cacd8a680a034b4bc09f561f658177d9b17
Test: build with WITH_TIDY=1.
2016-08-08 15:01:59 -07:00
Chih-Hung Hsieh
2ee4c1abbf Make it an error when LOCAL_CLANG is false.
Only projects in LOCAL_CLANG_EXCEPTION_PROJECTS can set LOCAL_CLANG to false.
Add external/gentoo/integration to this white list.

Bug: 30575506
Change-Id: Icd508686bc2eb8b9d400200166df80115af20da1
Test: build and find new warning in build.log
2016-08-05 11:21:20 -07:00
Chih-Hung Hsieh
3ea1e51ebe Allow late binding of LOCAL_CLANG_EXCEPTION_PROJECTS.
* INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS is defined later in other config.mk.
Bug: 30575506
Test: build and find new warning in build.log

Change-Id: If5341a856d1792add38c80a15b8deae39f156138
2016-08-03 11:57:30 -07:00
Chih-Hung Hsieh
82c78c5445 Allow some bionic tests to compile with gcc.
bionic/tests has some test cases compiled with both gcc and clang.

Bug: 30575506
Change-Id: I68576a931021089ecc6b9c9d14ef0b3e3cf05e2d
Test: build and find new warning in build.log
2016-08-03 10:42:10 -07:00
Chih-Hung Hsieh
d9cd1fafb5 Issue warning on projects with LOCAL_CLANG set to false.
* LOCAL_CLANG_EXCEPTION_PROJECTS is the list of project prefixes.
* New warning message is detected by warn.py as high severity.

Bug: 30575506
Change-Id: I87a38b2ba6bab1d2e5e7a9d5ec9557f0e609727c
Test: build and find new warning in build.log
2016-08-02 16:10:49 -07:00
Chih-Hung Hsieh
c868293abc Add performance* to default global tidy checks.
* This enables 5 performance related checks:
    performance-faster-string-find
    performance-for-range-copy
    performance-implicit-cast-in-loop
    performance-unnecessary-copy-initialization
    performance-unnecessary-value-param
* Recognize these new warnings in warn.py.

Bug: http://b/27779618
Change-Id: I7af3fdc262dd44db90d3b62eb37c5eac5a2eaa01
Test: build with WITH_TIDY=1 and run warn.py with build.log
2016-07-26 14:36:54 -07:00
Chih-Hung Hsieh
c21ddbdcce Recognize new clang and clang-tidy warnings.
* Count new clang-tidy warnings:
    google-runtime-references
    google-runtime-operator
* Count new clang warnings:
    -Wconst-conversion similar to -Wliteral-conversion
    -Wundefined-var-template
* Modified static analyzer warning message about
    "Null passed to a callee that requires a non-null ..."
* Disable google-runtime-references by default and
  disable misc-macro-parentheses in vendor projects;
  too many old C/C++ code have this warning.

Change-Id: Ib35e0af85875aada17c92b0237b76cd5ae3bfcc8
Test: build with clang-tidy.
2016-07-20 14:45:01 -07:00
Pirama Arumuga Nainar
d1c2ff4f06 Switch to prebuilt clang-3016494
Test: Tested build, boot and common usage for Arm, Arm64, x86, x86_64,
Mips images in AOSP and internal branch.

Bug: http://b/29823425
Change-Id: I97299c8b41ff9d3ac7019a349aa569609a099233
2016-07-19 20:32:21 +00:00
Dan Willemsen
6e22c756fc Drop CLANG and CLANG_CXX in the environment
We'll explicitly pass these variables to the static analyzer builds in
binary.mk

Bug: 29071982
Change-Id: Ifc7633d36f5785fe16b63f54b885396c2cab542a
2016-06-06 13:13:50 -07: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
02268f01df Move to a single clang unknown flags list
Soong is using a single list of unknown clang flags for all
architectures, instead of the per-architecture list here. Collapse this
down to a single list as well so that it can be verified against the
Soong list, and eventually replaced by the Soong version.

Change-Id: If43cd892105da5155907c05965a74b835920a369
2016-05-19 15:33:54 -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
30b57cd7d5 Merge "Remove make variables exported from Soong" 2016-05-18 00:36:46 +00:00
Dan Willemsen
7701eaa5b2 Remove redundant clang cppflags
Cppflags always get added to cflags, so we don't need to duplicate clang
cppflags extras that are already in the clang cflags extras

Change-Id: Ic099f565f20fd993fc0713c033fbc5154373c98f
2016-05-17 00:42:41 -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
Chih-Hung Hsieh
e1ea9434c1 Add misc-macro-parentheses to default tidy checks.
* Disable this check in external projects.

Bug: 28705665
Change-Id: Ia44a15765fd637dae36b5e0f2b59ee4280b139c9
2016-05-11 13:43:11 -07:00
Treehugger Robot
f948dddfe0 Merge "Remove -mcpu=cortex-a15 when adding -mcpu=krait" 2016-05-09 22:43:09 +00:00
Dan Willemsen
aeadf41e69 Remove -mcpu=cortex-a15 when adding -mcpu=krait
This is not necessary, since the later -mcpu=krait will override the
earlier -mcpu=cortex-a15, but is cleaner (and matches Soong).

Change-Id: I18301faf8a5cb5364617b3008bc8af461b7884f8
2016-05-09 14:55:10 -07:00
Dan Willemsen
593e670602 Revert "[MIPS] Temporarily disable Mips shared-textrel errors"
This reverts commit 3dfd20aea4 - the clang
version we are using has the mentioned permanent fix. The new build
system (Soong) uses a single list of unknown clang flags for all
architectures, so workarounds like this no longer work.

Change-Id: I64a83f3b52a9ca1d11a76df5a060a36f42e27e4b
2016-05-09 13:10:05 -07:00
Alistair Strachan
5ff9c81b6c Avoid accidentally using the host's native 'as' command.
When invoking clang for the host to assemble .S files, the -B flag
would not be provided, which allowed the host prebuilt clang to
use an 'as' from the native environment. Most of the time this
"just works", but some newer 'as' versions cause problems with
the older prebuilt toolchain, for example by generating
unsupported relocation types.

To avoid this problem, simply use the -B flag to tell clang to
invoke the assembler from the correct prebuilt gcc prefix.

Change-Id: I18ea4f37ae637b652cfd7321c41929f8be075342
Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
2016-05-05 16:29:08 -07:00
Pirama Arumuga Nainar
fa4ff9defd Merge "Update RS to use latest Clang-2812033 prebuilts as well." 2016-05-04 21:00:07 +00:00
Stephen Hines
348b81a404 Update RS to use latest Clang-2812033 prebuilts as well.
Change-Id: I62e294e2b8c882c235a6ac7518fa352acd46e055
2016-04-29 16:50:48 -07:00
Chih-Hung Hsieh
30f86e4ab8 Suppress google-* checks in vendor modules.
Too many warnings in vendor code that we cannot fix yet.

Bug: http://b/27779618
Change-Id: I8b65b1fd55c4e4d0dadf0617ab25962809237309
2016-04-29 15:16:59 -07:00
Stephen Hines
fb737e9002 Merge "Switch to clang-2812033." 2016-04-27 22:33:05 +00:00
Stephen Hines
e8b87607c8 Switch to clang-2812033.
Bug: http://b/25291096
Change-Id: I630b7e8a682e3c3b82ad9837b664c1155497618f
2016-04-26 14:34:24 -07:00
Chih-Hung Hsieh
460171a3e4 Add tidy.mk to set up global default checks.
* Default checks include only google* minus google-readability*.
* Some google-* checks are disabled for external projects.
* Each project can add more or disable checks through LOCAL_TIDY_CHECKS.

Bug: http://b/27779618
Change-Id: I83eed73bd2bddaace565a6dde532fb2036b4fac4
2016-04-25 12:17:03 -07:00
Stephen Hines
a58cefb683 Merge "Enable asan/ubsan for mips" 2016-04-20 04:44:39 +00:00
Dan Willemsen
1c4f8e0026 Remove extraneous /
This matches the line we use in Soong, and behaves no differently.

Change-Id: I4487f7f5555edd08dc67a22d547f8218d46ccd8f
2016-03-30 13:36:01 -07:00
Pirama Arumuga Nainar
6721b1d185 Merge changes from topic 'rebase_r256229'
* changes:
  Switch to clang-2690385
  Update RenderScript build rules for rebase to LLVM r256229
2016-03-18 21:54:51 +00:00
Pirama Arumuga Nainar
760aec5fdf Switch to clang-2690385
http://b/26987366

Change-Id: I1226f24b50319e321ea538362b2f26fcd227ca39
2016-03-17 13:30:22 -07:00
Pirama Arumuga Nainar
41f4b242e3 Update RenderScript build rules for rebase to LLVM r256229
http://b/26987366

- Use clang-2690385 to build RenderScript toolchain.
- Use armv7-linux-androideabi as the triple used to build RenderScript
  runtime libraries.

Change-Id: I582e8b25bbc38b101a2e765028ed61edbce7bdc2
2016-03-17 13:30:02 -07:00
Chih-Hung Hsieh
ad741e6d66 Link in ASAN library if my_global_santitize is set.
* When my_global_santitize is set and requires ASAN,
  link with ASAN library even when local module is not
  instrumented with ASAN, unless the local module is
  the ASAN library itself.
* Add -Wl,--as-needed to my_ldflags for shared libraries
  so that unneeded ASAN library would not become
  a dependent of the built .so file.
* Change shared file and executable file link argument order
  so that -Wl flags will have effect on linked-in libraries.
* Remove unused ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES.

BUG: 27614834

Change-Id: I4eda6003f1f24e498cba91c043dbe1fabe522686
2016-03-15 16:53:46 -07:00
Stephen Hines
c503d8ef58 Switch to clang-2658975.
Bug: http://b/27482631

This fixes an issue where krait compiles were not passing the proper
flags to the assembler when -no-integrated-as is used. This was
preventing ART from switching to clang in some cases.

Change-Id: I24966bf1ff84305df3586ab01d1aae7d5922aa11
2016-03-04 14:40:56 -08:00
Duane Sand
cc1a0fdde1 Enable asan/ubsan for mips
Change-Id: I1f3c89d6ca08d109e7d2a6d32448ff248a98daac
2016-02-29 15:42:38 -08:00
Stephen Hines
352bccb65e Update to use the latest clang-2629532.
Bug: http://b/25642296
Change-Id: Ib6c94bc57f7145c1cc9b14338126132fc4648509
2016-02-23 21:58:06 -08:00
Elliott Hughes
eb295fccb4 clang now supports -fdebug-prefix-map=.
Change-Id: Id0569831f09845871d8e6990c310516bea5a2510
2016-02-19 13:34:57 -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
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
Stephen Hines
cdb52b5186 Fix LLVM_RTLIB_PATH for new prebuilts.
This moved from lib/ to lib64/, but wasn't noticed because no one builds
with the profiler on by default.

Change-Id: I0155263b4a50437ea0864338fb34baefc3df59d2
2016-02-04 11:43:41 -08:00
Stephen Hines
6ef329eb4d Switch to clang-2577113.
Bug: http://b/25282907

This is actually based on clang/LLVM upstream revision r256229.

Change-Id: I335be68f196e5b55ac2816fa854e97b841b54240
2016-02-01 23:37:14 -08:00
Colin Cross
41fed8c082 Merge "Don't force color diagnostics outside of ninja" 2016-02-01 18:57:50 +00:00
Stephen Hines
49b695375c Add an RS_CLANG variable as well for RenderScript.
Change-Id: I33a73c4c2b19aa17bc18a64c92a86565111de3d0
2016-01-22 15:11:58 -08:00
Stephen Hines
96d2a8c5e4 Add clang rules for RS_LLVM_* tools.
This change adds new variables for RS_LLVM_* tools, which correspond
to the version of LLVM checked in currently to external/, instead of
mapping to the latest host prebuilts. This will help prevent version
differences for newer IR generated by the updated host prebuilts, which
then might not be readable with the on-device LLVM bits we build from
external/.

Change-Id: I6c7b0fa9082e9c8244cc508cb23960569a057740
2016-01-21 23:50:53 -08:00
Colin Cross
dbd43849fb Don't force color diagnostics outside of ninja
Building with USE_NINJA=false and piping build output to a file will
result in ANSI color codes in the build output.  Only force ANSI codes
on when building with ninja, which strips the ANSI codes when writing
build output to a non-TTY.

Change-Id: Ifd2fb53799fd99c23b7ad91cdb84d943bf707db0
2016-01-13 14:05:54 -08:00
Dan Willemsen
d1baa0f001 Remove -Wa,noexecstack from unsupported arm clang flags
This was marked as unsupported only on arm[64], even though it works.
For soong, we want to keep a single list of unsupported clang flags
for all architectures.

Change-Id: I9c4ae0f255c549d2346ba7abae57e22c86ddcc61
2016-01-12 15:54:57 -08:00
Evgenii Stepanov
18733b9b0c Merge "Remove RPATH for AddressSanitizer." 2015-12-21 18:32:36 +00:00
Evgenii Stepanov
bbd944a25d Remove RPATH for AddressSanitizer.
RPATH was used in order for ASan executables to prefer ASan libraries
under /data. Now ASan executables use a special loader (linker_asan),
which implements this logic. RPATH is no longer needed.

Change-Id: Ic7a39b022267b80bd0ce3e95a2e822eb308a1fba
2015-12-21 10:29:54 -08: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
Stephen Hines
af9e29d040 Merge "Rename AArch64 ASan target runtime library to match upstream convention." 2015-11-19 16:14:08 +00:00