aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper
AgeCommit message (Collapse)Author
2021-02-05compiler_wrapper: make a loop c89-compatibleGeorge Burgess IV
building this on the CQ is failing because this loop uses the c99 feature declaring something in the first clause of a for loop. BUG=None TEST=CQ Change-Id: I92729d30bd392c46e2b1183b92874212bdc59d6f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2676930 Tested-by: George Burgess <gbiv@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
2021-02-04compiler_wrapper: add go.modGeorge Burgess IV
In order to build this outside of the chroot, we apparently now need a go.mod file. This is autogenerated by the `go` tool. BUG=None TEST=Built inside and outside of the chroot Change-Id: I185cb9b626c8b3655ce5cc72524ef2511c7f575e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2676607 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2021-02-04compiler_wrapper: add a script to restore us to a working wrapperGeorge Burgess IV
Sometimes, I'm guilty of using ./install_compiler_wrapper.sh on broken sources. Restoring the world to a working state requires knowing/remembering a command. Seems better to provide that knowledge in executable form. BUG=None TEST=Ran the script Change-Id: I772b19a0b8bebdf6af78b822b710ce6e880c7388 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2676601 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2021-02-01compiler_wrapper: Remove "-m32/movbe" from i686 handlingManoj Gupta
Clang handles "-i686" tuple fine linking i386 libraries if needed. "-mnomovbe" is also understood by current clang. BUG=None TEST=go test Change-Id: I0d5058ebe3cadca297af1c01030480cc25194955 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2665028 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org>
2021-01-29compiler_wrapper: work around gcc failing due to a kernel bugGeorge Burgess IV
Very rarely on old GCCs, we'll complaints about GCC itself being handed ERESTARTSYS. Retry the compilation in those cases. Similarly, we'll sometimes see `run()` give us random errors with things like `waitid()`, so handle those. BUG=chromium:1166017 TEST=CQ Change-Id: If9b6fdc523f60719608739da0eefa94c82164ae7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2648090 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2021-01-29compiler_wrapper: disable force-disable-werror with GCCGeorge Burgess IV
Enabling this functionality with GCC is pointless -- we don't roll it, so we don't want to catch new -Werrors with it. We're having some GCC-specific functionality coming in soon; disabling this simplifies things some. BUG=chromium:1166017 TEST=CQ Change-Id: I3f73a8124ea85a2f14fd5c909a9bbed2b46f28f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2648431 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2021-01-29compiler_wrapper: loop in exec on ERESTARTSYSGeorge Burgess IV
Very rarely on old GCCs, we'll see an ERESTARTSYS that fails builders. Kernel documentation indicates that users should never see ERESTARTSYS, but it's unclear how to fix this, so try to work around it for now. BUG=chromium:1166017 TEST=CQ Change-Id: I5a1ca6ce722f929523feb45aeafffcc30dfda05a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2647869 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2021-01-29compiler_wrapper: fix a bug where we won't log rusage on compilationGeorge Burgess IV
env.exec, outside of tests and "print command" configurations, never returns if it executed successfully (since it turns into an actual call to execve()). Since we want to write rusage logs after the compiler is finished, we need to not exec in that case. BUG=None TEST=CQ Change-Id: If19ffb5c590868bc03431301514de875d60f7af5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2648089 Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2021-01-29compiler_wrapper: Fix gcc host wrapper configManoj Gupta
GCC host wrapper was not calling the code to add common flags for no clear reason. Add it so that "-fcommon" is now passed to GCC host compiler invocations. BUG=chromium:1171833 TEST=go test Change-Id: Id354b65ff0a08d0b25f895bb95cd4e99412b856b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2657585 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org>
2021-01-28compiler_wrapper: Add "-fcommon" to GCCManoj Gupta
pass "-fcommon" to GCC to match clang. This is needed since GCC 10 defaults to "-fno-common". BUG=chromium:1171833 TEST=go test Change-Id: Iceac503c8cc14afc1837c6952100189f45d2b567 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2657043 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org>
2021-01-22compiler_wrapper: refactor rusage_flagRyan Beltran
Refactors rusage_flag and its usage in compiler_wrapper to support the use of TOOLCHAIN_RUSAGE_OUTPUT with either FORCE_DISABLE_WERROR. BUG=chromium:1167958 TEST=Modified and ran unit tests Change-Id: I9a643ceabbbeca3bf3a94270d4f4b4d814812f93 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2635451 Tested-by: Ryan Beltran <ryanbeltran@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
2021-01-20compiler_wrapper: add working dir to rusage logsRyan Beltran
Adds current working directory as a new field in rusage logs. This is useful for determining what package was being compiled. BUG=chromium:1156314 TEST=Modified and ran unit tests Change-Id: I58d7040c90fbd7d9b81532d0114862cbf4b23f88 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2636450 Tested-by: Ryan Beltran <ryanbeltran@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
2020-12-29compiler_wrapper: remove "-pass-exit-codes" in wrapperManoj Gupta
Handling(ignoring) of "-pass-exit-codes" flag is no longer needed in compiler wrapper. BUG=chromium:979911 TEST=CL:2597389 passed CQ/SDK tests Change-Id: I0114b745eed6d5dbcba10e2ecfb13d1882df32bf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2597141 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
2020-12-17compiler_wrapper: Fix rusage_flag permission errorRyan Beltran
Seeing permission errors in builder bots that create rusage_flags. We need to set the Umask to 0 during creation of the directory. BUG=chromium:1156314 TEST=None Change-Id: I667d922762c2cb090adbb3abac2d4782bc48b87d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2597478 Reviewed-by: George Burgess <gbiv@chromium.org> Reviewed-by: Tiancong Wang <tcwang@google.com> Tested-by: Ryan Beltran <ryanbeltran@chromium.org> Commit-Queue: Ryan Beltran <ryanbeltran@chromium.org>
2020-12-16compiler_wrapper: rename GETRUSAGE flagRyan Beltran
GETRUSAGE has been renamed TOOLCHAIN_RUSAGE_OUTPUT for clarity. BUG=chromium:1156314 TEST=Reran unit tests for package main Change-Id: I4588b4138f0dd4e4938762250e5caa6b4026e3f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2594261 Reviewed-by: George Burgess <gbiv@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Ryan Beltran <ryanbeltran@chromium.org> Commit-Queue: Ryan Beltran <ryanbeltran@chromium.org>
2020-12-14compiler_wrapper: make rusage logs jsonRyan Beltran
Modified rusage logs generated by GETRUSAGE flag. Output from each entry is now in json format. BUG=chromium:1156314 TEST=Modified and ran unit tests Change-Id: Ia2cac4af201854de6d4a2c57e6cd8a4585f0931f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2585911 Tested-by: Ryan Beltran <ryanbeltran@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
2020-11-26compiler_wrapper: move llvm-next options to clang optionsinglorion
The new Clang version has a number of new warnings which we disable. This CL makes those apply to llvm (current) as well as llvm-next. BUG=None TEST=go test Change-Id: I1f4929580953003d21676e7e72af4577592fb217 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2561725 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
2020-10-23compiler_wrapper: report parent processes' info in warnings tarballsGeorge Burgess IV
The bug I'm chasing down right now depends on environment variables, and could be due to a `make` invocation in one of N places. Having this context available to me is useful. It seriously pollutes the JSON we dump, but use of `jq` that I've put in the doc about this makes that a non-issue. BUG=None TEST=Ran on stress-ng. parent process info was dumped. Change-Id: Ib4d3b6c9887b4cf2a38472ef299c81af27e9a617 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2481829 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-10-21Handle clangPostFlags for AndroidPirama Arumuga Nainar
BUG=None TEST=None Change-Id: I55bf76106eb1635c0bb4b936eaf3b96eef1dbb44 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2490653 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-10-13Revert "compiler_wrapper: enable -mharden-sls=all on aarch64"Jian Cai
This reverts commit fb8fd5be362ec7a52dc3be33859d31b0553c1038. Enabling the option caused 4.4 based arm64 devices failed to boot. Disable this option until the issue is fixed. BUG=chromium:1096302 TEST=Verified locally. Change-Id: I02d5a72423f3cf0097edff7ace85b23caf3ff554 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2469305 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Jian Cai <jiancai@google.com>
2020-10-05toolchain-utils: Sync compiler wrapper changes with llvm changes.Caroline Tice
This updates the compiler wrapper flags to match recent updates to compiler wrapper in sys-devel/llvm (for llvm-next). BUG=chromium:1133468 TEST=None Change-Id: Ibab9f0e1d0e35db3ba838e70a812efe2d5137a0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2448871 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Caroline Tice <cmtice@chromium.org> Tested-by: Caroline Tice <cmtice@chromium.org>
2020-10-02compiler_wrapper: enable -mharden-sls=all on aarch64Jian Cai
Migrate straight-line speculation vulnerability. Link: http://lists.llvm.org/pipermail/llvm-dev/2020-June/142109.html BUG=chromium:1096302 TEST=https://docs.google.com/spreadsheets/d/1EZbTYUdq2Y6Jpgy5PrCACB3GrInFy0ahI40IPexBZDM/edit#gid=336625829 Change-Id: I35e8f3cce53b86159f1705429774ceb803264f7d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2436936 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Jian Cai <jiancai@google.com>
2020-09-22toolchain-utils: Update compiler wrapper to disable warning.Caroline Tice
This CL updates toolchain-utils to match recent compiler wrapper changes in sys-devel/llvm/files. It's purpose is to disable the new warning -Wcompound-token-split-by-space. Also update golden tests appropriately. BUG=chromium:1130080 TEST=Previous CL already tessted/committed. Change-Id: I261250dc7ed6f1be7c3aa4652d793c924e1dc18d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2423619 Commit-Queue: Caroline Tice <cmtice@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: Caroline Tice <cmtice@chromium.org> Auto-Submit: Caroline Tice <cmtice@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
2020-09-18compiler_wrapper: search compiler executable in $PATHJian Cai
Search the compiler executable in the directories named by PATH environment variable and add its parent directory as PYTHONPATH to locate bisect_driver.py BUG=chromium:1121018 TEST=verified locally Change-Id: If1c397bedfc03b929d73ae490c1bb8f11b4edea5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2415130 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Jian Cai <jiancai@google.com>
2020-08-13compiler_wrapper: remove some flags from unsupport clang flagsJian Cai
LLVM implemented some flags that used to not be supported. Remove these flags from unsupported flags in the wrapper. BUG=chromium:1112929 TEST=tested locally. Change-Id: If91df0d35ac3db926067d3e0c5e213f6c5e3f390 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2346956 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Jian Cai <jiancai@google.com>
2020-08-10compiler_wrapper: use crashArtifactsDir to apply clang optsGeorge Burgess IV
Since we now have crashArtifactsDir as a more abstract concept, it seems good to apply '-fcrash-diagnostics-dir=' based on that, rather than having it as an explicit clang flag. BUG=chromium:1113442 TEST=FIXME Change-Id: I147779d7cf8806b3bc712c2998446158e87ec967 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2343975 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-08-10compiler_wrapper: dump tricium clang-tidy crash informationGeorge Burgess IV
This CL has us dump extra info when we observe a crash while using `WITH_TIDY=tricium`. In particular: - We'll now try to generate a -E'ed source file, and stash that in a subdirectory of our general crash_diagnostics directory. - Our JSON object that represents clang-tidy output has metadata about the aforementioned crash file, if it was generated. BUG=chromium:1113442 TEST=`go test`; ran locally with a crashy clang-tidy Change-Id: I577e5ec8e990af3b7cf1d8a9fea347582d5b227b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2343974 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-07-30compiler_wrapper: add -fexperimental-new-pass-managerJian Cai
LLVM is currently build with DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=ON on Chrome OS. This is however not reflected in clang crash diagnoses. Adding -fexperimental-new-pass-manager to help with reproducibility on 4c. BUG=chromium:1111103 TEST=CQ tests. Change-Id: Ie01431dff397e982469e29c9132e21374354762d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2327414 Reviewed-by: George Burgess <gbiv@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Jian Cai <jiancai@google.com>
2020-07-24compiler_wrapper: Updated instructions for updating the wrapperinglorion
This change adds some more details on how to test and commit changes to the compiler wrapper. BUG=None TEST=Followed the steps locally to verify that they work. Change-Id: I5a3d644e92fd94ed3792a59a30f39db08053390d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2305371 Commit-Queue: Bob Haarman <inglorion@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org> Reviewed-by: Jian Cai <jiancai@google.com>
2020-07-22compiler_wrapper: add -clang-tidy-flag supportGeorge Burgess IV
This CL adds support for specifying compiler flags that're meant to be passed only to clang-tidy. This allows for easier local experimentation with clang-tidy by users. BUG=chromium:982944 TEST=`WITH_TIDY=1 emerge-amd64-generic biod` with custom cflags; cq+1 on crrev.com/c/2308774 Change-Id: I654559d14a78ade4920fe37757fb5b249a997290 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2309152 Reviewed-by: Caroline Tice <cmtice@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-07-18compiler_wrapper: rename update_compiler_wrapper.shJian Cai
Rename the script to install_compiler_wrapper.sh to avoid confusion with chromiumos-overlay/sys-devel/llvm/files/update_compiler_wrapper.sh. BUG=None. Test=None. Change-Id: I39bbc3dc4a63fa480c394f2e92c1723033cdc321 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2304726 Tested-by: Jian Cai <jiancai@google.com> Reviewed-by: Bob Haarman <inglorion@chromium.org>
2020-07-14compiler_wrapper: remove -grecord-gcc-switchesBob Haarman
-grecord-gcc-switches causes the compiler and compiler flags to be stored in the produced debug information. This causes Goma builds to be non-deterministic, because the compiler path differs depending on whether the compiler was run locally or on Goma. This, in turn, causes cache pollution and needless work. Since we are not in fact using the information stored by -grecord-gcc-switches, this change disables it. We can re-enable it when we want to start using the information, provided we come up with another way to avoid the issues described earlier. BUG=chromium:1103065 TEST=Build an object file in chromeos-chrome and check that info is absent Change-Id: Ib8022a3a1baf2e4b5d3d9d1453deb67f539baff4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2290624 Commit-Queue: Bob Haarman <inglorion@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org> Reviewed-by: Tiancong Wang <tcwang@google.com>
2020-06-26compiler_wrapper: redirect clang crash dignosesJian Cai
Redirect all diagnoses of clang crashes to a dedicated directory using fcrash-diagnostics-dir so we can upload these files to the cloud. The flag was added to clangPostFlags to overwite redirection done on package level. BUG=chromium:1056904 TEST=None Change-Id: I78bfc77d7f3af8556b4308f2e71407d627627747 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2251038 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Jian Cai <jiancai@google.com> Tested-by: Jian Cai <jiancai@google.com>
2020-06-24wrapper: add support for Tricium clang-tidyGeorge Burgess IV
This adds a special `WITH_TIDY` mode that's specifically for use with Tricium. Crucially, this has us dump diagnostics as YAML, and stash a fair amount of information about each clang-tidy invocation in the same place where we dump YAML. These bits are intended to be used by the script added in I54ecc88d38faa4bfd502d632d3fd5c74734dabc0. BUG=chromium:1035951 TEST=Ran on all platform2 packages `emerge`able on amd64-generic. Change-Id: I63ef06dc6ddc016ebb6ba0c4a0cea8320fef7415 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2245785 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-06-20wrapper: fork() before exec()ingGeorge Burgess IV
This CL is a wild guess that tries to work around what appears to be an incredibly rare Go runtime bug (https://github.com/golang/go/issues/24484). As mentioned on the chromium bug, apparently execve is taking a while... somehow, and `pthread_create` fails with `EAGAIN` concurrently. So the intent here is to `fork()` + `exec()`. `fork()` will a) dispose of the thread that's trying to `pthread_create` b) isolate the `exec` in its own process, so the parent's runtime can spin up as many threads as it likes in peace. This slows down an 'ideal' kernel build (aka a build where ccache is a 100% hit rate, so the compiler wrapper's overheads are very pronounced) by ~4% in my measurements. BUG=chromium:1095528 TEST=sdk tryjob; CQ Change-Id: I73e1b238738b74c85def4709c09610f586fb04e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2252552 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-06-19wrapper: print android-llvm@ when using the Android wrapper.George Burgess IV
Otherwise, the wrapper might say: ``` Internal error. Please report to chromeos-toolchain@google.com. ``` to Android developers in some cases. BUG=b:159291805 TEST=`go test` Change-Id: I9a96068f02a2c6ce5e251c8754e267dfb1a30db1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2252553 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-06-19wrapper: tweak "toolchain doesn't exist" checks in the updaterGeorge Burgess IV
When stderr is connected to a tty, equery will output things if it fails due to being unable to find a package. When it's not, equery will output nothing on failure. BUG=None TEST=./update_compiler_wrapper.sh Change-Id: I7d16d6a531f1f28fc0157873176d41f6881cd04b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2252550 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-06-15wrapper: allow Android to specify their own llvm-flagsGeorge Burgess IV
Given the discussion on https://android-review.googlesource.com/c/platform/external/toolchain-utils/+/1330695, it sounds like our Android friends want to be able to tweak llvm-next flags without going through chromium-review + having to pull their changes back into Android. This CL allows them to make changes to their llvm-next flags entirely locally, and isolates CrOS' llvm-next flags from Android's. BUG=None TEST=Built the wrapper for CrOS and Android. Change-Id: If1bcfe762a4f368db9816557752651edc877f497 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2247003 Reviewed-by: Pirama Arumuga Nainar <pirama@google.com> Reviewed-by: Tiancong Wang <tcwang@google.com> Tested-by: George Burgess <gbiv@chromium.org>
2020-06-11[android wrapper] Write warning report to stdout on AndroidPirama Arumuga Nainar
Write the warning report to stdout (surrounded by a tag <LLVM_NEXT_ERROR_REPORT>). Currently OUT_DIR only gets passed to local compiles, and so remote compiles can't do the double build. Even if they write to /tmp, RBE or Goma won't know to copy them as part of the output. Packaging the warnings reports is a problem as well since the additional build step needs extra surgery in soong (it's not possible to add a dangling, optional build step in Ninja). Writing the reports to stdout conveniently solves both these issues. We can just scrape the reports with a script. Originall reviewed at https://android-review.googlesource.com/c/platform/external/toolchain-utils/+/1328433/2. BUG=None TEST=build master with r391452 and check progress past new errors. Change-Id: I5f1f71faba002836067a82f6aa4b26d5ba8b7b99 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2239371 Commit-Queue: Pirama Arumuga Nainar <pirama@google.com> Tested-by: Pirama Arumuga Nainar <pirama@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2020-06-11[compiler-wrapper] Handle double build for clang-tidyPirama Arumuga Nainar
For clang-tidy, the equivalent of -Werror is --warnings-as-errors (or -warnings-as-errors). The error message will also have "warnings-as-errors". So, 1. Trigger double-build if "warnings-as-errors" is in *stdout*. Clang-tidy will also fail if clang issues a Werror diagnostic. In this case, we'd get "clang-diagnostic" in stdout. Do a re-build in both these cases. 2. Remove flags containing "-warnings-as-errors" in the rerun. Unlike -Werror/Wno-error, clang-tidy doesn't have a -no-warnings-as-errors to override a prior -warnings-as-errors. Existing double-build processing will disable -Werror flags to Clang. Originally reviewed at https://android-review.googlesource.com/c/platform/external/toolchain-utils/+/1322200. BUG=None TEST=go test Change-Id: I18de245972da81e0ac3600f9098b71cec82e9e96 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2239370 Commit-Queue: Pirama Arumuga Nainar <pirama@google.com> Tested-by: Pirama Arumuga Nainar <pirama@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2020-06-02compiler_wrapper: add a `static` optionGeorge Burgess IV
If this option is specified, we'll build a fully static binary, rather than having it link with libc. If unspecified, our behavior shouldn't differ from what we have today. BUG=chromium:1087435 TEST=CQ Change-Id: If3939336e4e10d0279501f56ffbed8272a5f546c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2219362 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-05-04Revert "wrapper: Temporarily disable -Wmax-tokens"Tiancong Wang
This reverts commit 3b2358092e00ab7904a873b516ac6aac832c2277. According to crrev.com/c/2171058, the fix in chromium could work. Will wait till the patch submitted in chromium and CrOS uprevs to merge the change into CrOS. Reason for revert: The workaround is not needed anymore. Original change's description: > wrapper: Temporarily disable -Wmax-tokens > > As reported in crbug.com/1072209, -Wmax-tokens is causing latest > chrome fail to build. While we are blocked by Chrome uprevs, we > want to update the compiler by disabling the warning, until it's > fixed properly on upstream Chrome. > > BUG=chromium:1072209 > TEST=Local testing in CrOS > > Change-Id: I082dd342a802e80250d0fca7c4b15afb4e972e7e > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2161770 > Commit-Queue: Tiancong Wang <tcwang@google.com> > Tested-by: Tiancong Wang <tcwang@google.com> > Reviewed-by: George Burgess <gbiv@chromium.org> Bug: chromium:1072209 Change-Id: I904fb3c4f7d125579667bef675be654a5465fad9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2173949 Tested-by: Tiancong Wang <tcwang@google.com> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Tiancong Wang <tcwang@google.com>
2020-04-22wrapper: Temporarily disable -Wmax-tokensTiancong Wang
As reported in crbug.com/1072209, -Wmax-tokens is causing latest chrome fail to build. While we are blocked by Chrome uprevs, we want to update the compiler by disabling the warning, until it's fixed properly on upstream Chrome. BUG=chromium:1072209 TEST=Local testing in CrOS Change-Id: I082dd342a802e80250d0fca7c4b15afb4e972e7e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2161770 Commit-Queue: Tiancong Wang <tcwang@google.com> Tested-by: Tiancong Wang <tcwang@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2020-04-08compiler_wrapper: assume /dev/null is a configure testGeorge Burgess IV
Linux does a lot of "is this flag supported" testing by passing /dev/null as an input file. Since this code is pretty heuristic-y anyway, let's see if we can get by with calling that a `configure`-like file. :) BUG=None TEST=emerge-eve chromeos-kernel-4_4; no more fatal warnings Change-Id: Ie1cd80b36e93a9269280345a1df006baa356a9f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2142404 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-04-03compiler_wrapper: make the update script not die on missing packagesGeorge Burgess IV
Fresh chroots might not have all of these GCCs emerged. Just `continue` if that's not the case. This also fixes failing lints. BUG=None TEST=Ran the script Change-Id: I57a2ca72dfbaea324ddb66423294e1b4dd8989e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2080660 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-04-01compiler_wrapper: disable -Wno-error on conftest-y filesGeorge Burgess IV
There are some ebuilds that (unfortunately) run configure steps inside of their regular `make` invocations. Rather than trying to fix those as they pop up, add a heuristic to our -Wno-error bits. This is similar to a heuristic goma added a while back when experimenting with full builds of CrOS using goma. BUG=None TEST=unittests Change-Id: I23efdc8ad5ea29621b105040bc33786896f6e486 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2132722 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-04-01compiler_wrapper: s/strings.Contains/bytes.Contains/George Burgess IV
Rather than turning all of stderr into a string here, we can turn the thing we're searching for into a []byte. Should shave off a few cycles, and is just as readable. BUG=None TEST=unittests Change-Id: Ib4cc916ada11e0d8e286775b15dd93998c8403aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2132721 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-04-01compiler_wrapper: don't write -Werror files on still-failed buildsGeorge Burgess IV
Not `return`ing here was troublesome for our monitoring infra, since it meant that _any_ clang error that mentioned '-Werror', with this support turned on, would turn into a json file. With configure steps and the like, this probably isn't the behavior that we want. BUG=None TEST=unittests Change-Id: I0669c5bd9473b687c34c23f284433a21e8a1d88c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2132233 Commit-Queue: George Burgess <gbiv@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-03-20gcc: Add tigerlake to corei7 mappingEd Baker
GCC 4.9 does not support new architecture flags such as skylake or tigerlake. Bug=b:141363149 TEST=Verify unit tests pass cd ${chromium_os}/src/third_party/toolchain-utils export PYTHONPATH=$(readlink -f .):$PYTHONPATH ./run_tests_for.py ./compiler_wrapper/* Change-Id: I63a74cb8fa6d2b40a9890a1e61f5be7917321975 Signed-off-by: Edward Baker <edward.baker@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1959943 Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
2020-03-13compiler_wrapper: Stop setting CCACHE_BASEDIRManoj Gupta
CCACHE_BASEDIR used to be set to sysroot so that ccache can reuse compilation results across different boards. This is not useful on builders and also less useful for board builds since we set closer to target CFLAGS now. It also breaks use of -fmacro-prefix-map option in clang/gcc. So rip it out and simplify the rest of code. BUG=chromium:983759 TEST=go test Change-Id: Ia99ca994c976ee1137c3d904a78f7e25931c70f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2103170 Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>