Commit graph

1297 commits

Author SHA1 Message Date
Treehugger Robot
acf23fe098 Merge "Revert "Enable sizeof-array-div warning"" 2022-11-30 01:50:46 +00:00
Yabin Cui
4a06eea3cf Merge "Update clang version to clang-r475365" 2022-11-30 00:46:00 +00:00
Krzysztof Kosiński
6be24baec4 Revert "Enable sizeof-array-div warning"
This reverts commit 5a06f330ed.

Reason for revert: Breaks aosp_bramble-userdebug
https://android-build.googleplex.com/builds/submitted/9348502/aosp_bramble-userdebug/latest/view/logs/build_error.log

Change-Id: I4e360638dee2c2d620c814ccb1c752cef47c0d21
2022-11-29 23:19:34 +00:00
Chih-Hung Hsieh
5a06f330ed Enable sizeof-array-div warning
Except third-party external/vendor projects.

Bug: 148815709
Test: presubmit; make tidy-soong_subset
Change-Id: I84cf63d1b9e244acb3ff3bc913ee9c2f1eae0e5a
2022-11-29 00:13:01 +00:00
Chih-Hung Hsieh
823e0b7e12 Enable array-parameter warning
Except third-party external/vendor projects.

Bug: 241941550
Test: presubmit; make tidy-soong_subset
Change-Id: Ia74af9155d7d1aca0e6cecf1103f4d0de4345291
2022-11-29 00:12:07 +00:00
Yabin Cui
7a53b71f3b Update clang version to clang-r475365
Bug: 253033919
Test: build
Change-Id: I3c0d133d57cc389ee62502dd6aa36ee019e624d6
2022-11-28 13:40:14 -08:00
Yabin Cui
df3168f60d Merge "Allow deprecated flags when building with LLVM_NEXT." 2022-11-18 00:40:57 +00:00
Yabin Cui
758dfa1c28 Allow deprecated flags when building with LLVM_NEXT.
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
is deprecated in the next compiler. So add -Wno-unused-command-line-argument
to skip it.

Bug: 253033919
Bug: 259559364
Test: run test_compiler.py
Change-Id: I9133a36700afd3ef411092fd8133a7fe1c2c7343
2022-11-17 13:00:40 -08:00
Sam Delmerico
d87f61ba18 Merge "export clang-tidy extraArgFlags to Bazel" 2022-11-16 14:17:43 +00:00
Elliott Hughes
9f0c951862 Remove a flag from riscv64 that was copied from arm64.
This causes us to align the text section to 4KiB, not just the data
section. From the bug that added this for arm64, there was an admission
that it costs 17MiB across the tree, and a not entirely convincing claim
of a performance improvement (undermined by the fact that "some stuff
was faster, some stuff was slower"). See http://b/150506341 for that.

Anyway, let's assume we don't want this for riscv64 for now.

Test: `mm -j` in bionic and readelf on the resulting libtest_empty.so
Change-Id: I0ed592a97ef705175191d9c66271a599af4eb18f
2022-11-15 00:56:04 +00:00
Sam Delmerico
ee030d237c export clang-tidy extraArgFlags to Bazel
We want to keep these flags in sync between Soong and Bazel, so we need
to export it to a variable that Bazel can read.

Test: CI
Bug: 255750565
Change-Id: Idf019fa6a85d2d6bb2341b6cb989a48e9ef27d2e
2022-11-10 14:35:23 -05:00
Wei Li
0643c4ebb5 Fix the git_master_bazel mixed build breakage.
There is no cflags defined for cortex-a9 CPU variant, set it to ArmGenericCflags to fix the mixed build breakage for now.

Bug: 258397103
Test: m com.android.build --bazel-mode-staging
Change-Id: I79a9877846ced6334c09a4f5caf115c436f600e6
2022-11-09 22:43:53 -08:00
Mitch Phillips
bbebe7f5a4 Remove deprecated experimental-new-pass-manager flag.
https://reviews.llvm.org/D136789 removed this flag, it's been a no-op
since 15.0.0. The current Android compiler is 15.0.3, but upcoming
compilers will error on the fact that this flag doesn't exist any more.

Change-Id: I54666175b521ed5cdd76c53ed700ad4ddf6931da
Test: make
Bug: N/A
2022-11-03 18:04:21 +00:00
Treehugger Robot
95a3752ab1 Merge "cc_fuzz targets depend on fuzz_interceptors for HWASan builds" 2022-11-02 21:57:20 +00:00
Kris Alder
d406da104b cc_fuzz targets depend on fuzz_interceptors for HWASan builds
This allows us fuzzers to get coverage feedback and mutate more
intelligently based on feedback from strcmp, memcpy, and similar
functions.

Bug: 208297094
Test: make and run 'example_fuzzer', build 'haiku'
Change-Id: Ic51c207f8644cda885fb3f453cc583e2ee1e8c1d
2022-11-02 11:25:59 -07:00
Sam Delmerico
8604df6fb1 Merge "export clang-tidy variables to soong_injection" 2022-10-31 17:23:19 +00:00
Yabin Cui
0ebe7c8eb3 Prepare to build clang-r475365
Allow single-bit-bitfield-constant-conversion warnings to pass
with r475365.

Bug: 253033919
Test: run test_compiler.py
Change-Id: Icc1f1c6c013418f1e5bb839ef70ebe8498b9cedc
2022-10-27 15:55:03 -07:00
Sam Delmerico
b9b6c6773e export clang-tidy variables to soong_injection
Change-Id: If6470c35f5ee8f4867177d641640cdc2806de574
2022-10-25 15:55:17 -04:00
Treehugger Robot
2238c73723 Merge "Export all constants for linux_bionic" 2022-10-24 20:06:48 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
c4d11bc470 Export all constants for linux_bionic
They need to be referenced in adding a `linux_bionic` Bazel cc_toolchain

Test: CI
Bug: 205771732
Change-Id: I5469eac5559cdf76e02fdeccaf496e5ffcc1b08e
2022-10-24 18:08:56 +00:00
Krzysztof Kosiński
e0774afdd0 Merge "Globally enable -Wdefaulted-function-deleted." 2022-10-21 04:29:12 +00:00
Treehugger Robot
26e62c8d74 Merge "Set -fno-emulated-tls for riscv64" 2022-10-21 03:31:38 +00:00
Colin Cross
2c435a00ff Set -fno-emulated-tls for riscv64
Building for riscv64 fails with link errors on __thread variables.
Set -fno-emulated-tls to fix it.

Bug: 254713216
Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true ndk_sysroot
Change-Id: I3dca81dfd277d681b6c868a5e8385e3a37335a5f
2022-10-20 14:31:24 -07:00
Yi Kong
a9e1df1522 Enable ICF=safe for host binaries as well
We regressed binary size when we switch Darwin to use LLD, because
Darwin LD64 does ICF by default. Turn on ICF for host binaries to regain
the binary size savings (saves some space for Linux as well).

Test: presubmit
Bug: 236924555
Change-Id: I433062c3d263d69e431c1552faf1f18b13c5da42
2022-10-20 14:45:52 +09:00
Chih-Hung Hsieh
ff2efae9b0 Disable external/grpc-grpc even with TIDY_EXTERNAL_VENDOR=1
Some projects do not allow or fix tidy warnings to
avoid warnings-as-errors. They should not run
clang-tidy even with TIDY_EXTERNAL_VENDOR=1.

Bug: 244631413
Test: presubmit; TIDY_EXTERNAL_VENDOR=1 make tidy-external_subset
Change-Id: Id86a55c222fdad813c1c3434245c86bb97d0cad6
2022-10-18 18:58:50 -07:00
Chih-Hung Hsieh
d21c46a5f8 Allow default clang-tidy checks
This will avoid suppressing all checks in user defined
.clang-tidy config files.

Bug: 252877310
Test: TIDY_EXTERNAL_VENDOR=1 make tidy-soong_subset
Change-Id: I99032300542e9b83cba60b00f8d328c63b5728e2
2022-10-18 21:12:19 +00:00
Stephen Hines
6186318b72 Update clang version to clang-r468909b
Bug: http://b/241011085
Bug: http://b/235405318
Test: Builds
Change-Id: Ib415277284fc69f5a6b59b6998f6cdbcaefdd13e
2022-10-07 00:33:59 -07:00
Chih-Hung Hsieh
a4724a0c4e Remove flags rejected by RBE input processor
* This is a temporary work around until the RBE input processor
  can handle those flags.
* It's okay to remove some cflags in clang-tidy command
  if they do not affect tidy check results.

Bug: 248371171
Test: enable RBE; RBE_CLANG_TIDY_EXEC_STRATEGY=remote; make tidy-soong_subset
Change-Id: If499bd7e1f0f89ccc3b7f7df7d67cfc64dc67028
2022-10-04 16:52:36 -07:00
Colin Cross
f05b0d35d2 Add riscv64-linux-android support
Add barebones riscv64-linux-android support.  This should be enough
to add riscv64-specific entries to Android.bp files, but can't
actually compile anything until there are riscv64 toolchains.

Test: arch_test.go
Change-Id: I0dcc7e797d9352dd38243be908a7f19004ff3db1
2022-10-03 08:43:13 -07:00
Colin Cross
4fa894d366 Removed unused GCC references
Remove Toolchain.GccRoot, Toolchain.GccVersion, and Toolchain.GccTriple
that were only used by an unused function.  This removes most of the
references to GCC, although there are still some left in the host
toolchains.

Test: No change to build.ninja for aosp_cf_x86_64_phone-userdebug or aosp_raven-userdebug
Change-Id: I72b8af1f9aa83e6e15c9e00ed1e817b6cc3a031a
2022-09-30 19:32:48 -07:00
Chih-hung Hsieh
5c40a92d33 Reland "Update clang version to clang-r468909"
This reverts commit fc21a0e55b.
Reason for revert: broken builds/tests were fixed

Bug: 241011085
Change-Id: Ifba0bb05e690c8204e3ef34f59d7bf7ef57638ed
2022-09-27 17:18:21 +00:00
Stephen Hines
fc21a0e55b Revert "Update clang version to clang-r468909"
This reverts commit 395e50544f.

Bug: 241941550
Bug: 241601211
Bug: 241011085
Test: Builds

Change-Id: Ic2bb5d5dc52db743435defd129b5c2d0dc794d58
2022-09-22 18:59:01 -07:00
Chih-hung Hsieh
b472d457e0 Merge "Update clang version to clang-r468909" 2022-09-22 23:12:41 +00:00
Colin Cross
5555726311 Merge "Revert^2 "Drop dependency on musl_linker_script"" 2022-09-19 23:18:50 +00:00
Chih-Hung Hsieh
395e50544f Update clang version to clang-r468909
* Allow/show clang deprecated* and array-parameter warnings.

Upstream commit date: 2022-07-25

Test: presubmit
Bug: 241941550
Bug: 241601211
Bug: 241011085
Change-Id: I5c152823500dde656e1306afcb6f45e824b50102
2022-09-19 19:26:18 +00:00
Colin Cross
3699f83c6e Revert^2 "Drop dependency on musl_linker_script"
89a7ba8e38

Change-Id: I6210c46b3f26e86c2531ed254e341c845fd8acbb
2022-09-16 17:26:24 +00:00
Alyssa Ketpreechasawat
89a7ba8e38 Revert "Drop dependency on musl_linker_script"
Revert submission 2216822

Reason for revert: DroidMonitor: Potential culprit for Bug 247028852
Reverted Changes:
I086bb0d14:Copy cc_object output files to a name that matches...
I868cb8b5b:Drop dependency on musl_linker_script
Ib9b5530d3:Run __libc_start_main directly
I1a197dc5c:Move replacement program headers into bss
If59613374:Support missing PT_PHDR
Icb7d8d3e0:Remove note from relinterp
I05cdee7a4:Remove ldso_trampoline_debugger.c

Change-Id: I7eb89766881fb7d76288267ed3b052348b0a9bca
2022-09-16 08:40:25 +00:00
Florian Mayer
a43630f0a1 [cleanup] remove unused variable.
Change-Id: I6788a8ec1db51c0c72ec64d4df5269622934e857
2022-09-15 17:00:39 -07:00
Colin Cross
aca530020e Drop dependency on musl_linker_script
musl_linker_script is no longer required as the entry point is now
_start.

Bug: 242601708
Test: m USE_HOST_MUSL=true bzip2
Change-Id: I868cb8b5bf5ace02a39aeab78ac9e07dfae974b1
2022-09-09 15:14:28 -07:00
Chih-Hung Hsieh
ec450d9113 Prepare to build clang-r468909
* Allow/show clang deprecated* and array-parameter warnings
  to pass build.py with r468909.

Test: presubmit
Bug: 241941550
Bug: 241601211
Change-Id: I46bc1138861371ece24e88fad2d64fdf38ca605d
2022-09-08 10:11:57 -07:00
Krzysztof Kosiński
bcdb000caa Globally enable -Wdefaulted-function-deleted.
Bug: 241680050
Test: presubmit
Change-Id: Ic144a20bc2c7e3fa604bd7cc37b676e26c2fb5ee
2022-09-07 21:58:40 +00:00
Chih-Hung Hsieh
1a46753cbf No clang-tidy by default for external and vendor
* Most tidy-external-* and tidy-vendor-* rules
  are no longer generated. But external/bcc,
  external/android-clat, and some vendor/...
  projects still have tidy- rules because they
  have explicitly set tidy:true in .bp files.
* Some hardware/* directories are third-party
  projects and also disabled by default.

Bug: 244631413
Test: presubmit; make tidy-soong_subset
Change-Id: I17f625e6270de81a111d9cd382fbc39f34edf924
2022-09-06 13:59:33 -07:00
Colin Cross
fc3b064c9a Make toolchain more compose-y
Remove many of the overridden methods from toolchainBase in favor
of having smaller composable types.  toolchainNoCrt, toolchain32Bit
and toolchain64Bit now only provide a few methods and can be mixed
in to any toolchain type.  toolchainLinux, toolchainBionic,
toolchainWindows and toolchainDarwin now embed toolchainBase to provide
the default flags methods for when they don't override them.

This avoids the need for disambiguation methods required when a
type embeds two types that implement the same method.

Test: cc_test.go
Change-Id: I641da2a47aba597c517f693efedb65cf41273c82
2022-09-01 14:21:36 -07:00
Chih-Hung Hsieh
8b5ecb8455 Fix broken aosp-master-plus-llvm builds
* New flags cannot be added before llvm_android
  has a new version.

Bug: 241941550
Bug: 241601211
Test: presubmit
Change-Id: Ibab8cfa9129eac824a3d5fb9c3124ba807ba4245
2022-08-15 14:36:02 -07:00
Chih-Hung Hsieh
3b93ac6784 Disable/allow some clang-tidy and clang warnings
* Disable bugprone-unchecked-optional-access because it
  crashed with some Android files.
* Allow misc-const-correctness and bugprone-assignment-in-if-condition
  as warnings, not to stop build as errors.
  Disable them in the global default check list.
* Allow/show clang deprecated* and array-parameter warnings for the NEXT version.

Bug: 241125373
Bug: 241819232
Bug: 241941550
Bug: 241601211
Bug: 241997913
Test: presubmit
Change-Id: Ifdc7a63c4e349b1ace4880bd002d14dc41054dcf
2022-08-12 15:02:10 -07:00
Krzysztof Kosiński
6934b0ee64 Globally force -Wdeprecated-declarations to be a warning.
Some code compiles with -Werror, which makes it very hard to mark
anything as deprecated without breaking the build. This option
will ensure that we can still mark things as deprecated without
breaking such code. Among other things, this will allow us to
undo a local change to protobuf which disables deprecation
warnings.

Bug: 203713560
Test: presubmit
Change-Id: I718de31c3ff685dba4104f3c9e7bd5d169d89f7e
2022-08-07 07:00:41 +00:00
Yi Kong
f7f69e4992 Add option to allow unknown warning options
Some build targets pulls cflags from build/soong but has its own choice
of compiler version. This causes errors for due to unknown warning
options. This allows them to suppress such checks.

Test: presubmit
Change-Id: Ia89508d6b92481fb1ed0c90f1fdb4d8e54566349
2022-07-21 15:49:05 +08:00
Yi Kong
eb8d04e589 Update clang version to clang-r458507
Test: presubmit
Bug: 236798112
Change-Id: Iff8df2b5c7faf359d0554994586bbc984b7a1856
2022-07-21 06:43:09 +00:00
Elliott Hughes
f08a664127 Enable -Wmisleading-indentation for 1p projects
Bug: http://b/232926688
Test: treehugger
Change-Id: I7e3458f23e9b2e7a229a4a3eada5d98bdf4731d0
2022-07-19 11:51:59 +00:00
Yi Kong
b79fc584c7 Add extra cflags for LLVM_NEXT
The staging compiler update sometimes needs additional cflags to build, but those flags may not be recognised by the current compiler. Add a
new `llvmNextExtraCommonGlobalCflags` section and only append those
flags when LLVM_NEXT is set.

Test: LLVM_NEXT=true m
Bug: 236798112
Change-Id: Icc4687950acd44798b2cf09131a425ddfd919214
2022-07-13 07:47:56 +00:00