aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/command.go
AgeCommit message (Collapse)Author
2019-10-17compiler_wrapper: remove WITH_TIDY support for android.Tobias Bosch
Also consolidates most of the android specific logic into one place so it's clear which flags are used and which ones are not. Also detects wrapping of clang-tidy for future special casing. BUG=chromium:773875 TEST=unit tests, golden tests TEST=android's test_compiler.py --with-tidy Change-Id: Ic83340ba63ec3ea4c3c174069d3dc017ecbcdd72 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1866603 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-10-11Android wrapper: Support wrapping clang-tidyTobias Bosch
Android uses the wrapper also for clang-tidy. TEST=golden tests BUG=chromium:773875 Change-Id: I17534b44b1bc7e6b60002f2660966f27d70301ad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1854899 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-09-17Allow to pass in argv0 from ld.so via an env variable.Tobias Bosch
This is needed for the standalone toolchain that creates wrappers for all dynamically linked binaries that calls the binaries via `ld.so`. As `ld.so` does not support forwarding argv0, we are using this env variable in the wrapper script as workaround. See also https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1790440 BUG=chromium:1003841 TEST=verified manually that the standalone toolchain works with the TEST=new wrapper. Change-Id: I7b4cc056286c2da8a9c34d1cb79720b424fc2f25 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1801198 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-09-13Allow to remove env variables.Tobias Bosch
Previously, we only supported setting env variables to empty, but not to remove it. This lead to the case that we never removed the CCACHE_DISABLE env variable, which kept the ccache disabled, and caused a performance regression compared to the old wrapper as the new wrapper didn't use the ccache in this case. This cl also adds tests for the real exec and run commands to prevent regressions in these cases. BUG=chromium:773875 TEST=new unit tests TEST=performance analysis for TEST=emerge-veyron_jerry --nodeps chromeos-kernel-4_19 Change-Id: I5ca88ba8d7b05c3e12e292465fcd4ff9925b0344 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1802159 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-08-21Support "gcc", "clang" as compiler namesTobias Bosch
BUG=chromium:773875 TEST=golden tests, emerge-lakitu sys-kernel/linux-headers Change-Id: I205059a9f61484caaf69ed340fd42a47531e00f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1762344 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-08-20Correctly parse eabi compiler names.Tobias Bosch
BUG=chromium:773875 TEST=unit tests, compile cross-armv7m-cros-eabi/newlib Change-Id: Ia98442a69b01cff87c52b6ac84dc39c47d5e998e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1760465 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-08-16Resolve wrapper path against path envTobias Bosch
BUG=chromium:773875 TEST=unit test Change-Id: I150eb18a5d765d43ee7a2341767ff41f6641c6ac Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1757222 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-07-22Support clang host wrapper.Tobias Bosch
This change adds support for the clang host wrapper. The implementation is verified via comparing to the old clang host wrapper in the golden tests. BUG=chromium:773875 TEST=unit test Change-Id: I48284736014ab4b66bfd7e31e88ffd23956007bb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1708750 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-07-22Add license headers to all go files.Tobias Bosch
Required as of https://chromium.git.corp.google.com/chromiumos/repohooks/+/9732e38a5551e4bbcd222d2bbb89ee0fc5c95dee BUG=chromium:773875 TEST=unit test Change-Id: I8dfed85b0fbd528084ff2e585bbf3624ac358135 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1710404 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-07-18Add json mapping for command and commandResult.Tobias Bosch
Also exports the fields on these structs so that json can read/write them. BUG=chromium:773875 TEST=unit test Change-Id: I0efead41693dd35548738a0b3a3e5c71c97c319c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1706790 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-07-13Add -print-cmdline and -print-configTobias Bosch
BUG=chromium:773875 TEST=unit test Change-Id: Ib25e582257694f3a3457795873a249735e3aaf82 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1697931 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-07-09Support -clang-syntax flag in the compiler wrapper.Tobias Bosch
BUG=chromium:773875 TEST=unit test Change-Id: Iea4a3c395c09b2a97d8a9975cf642f985f2dbec7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1691113 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-06-28Introduce infrastructure for calling and testing nestedTobias Bosch
commands, error messages and exit codes. Also: - implements the -Xclang-path= flag as use case of calling a nested command. - adds tests for forwarding errors, comparing against the old wrapper, and exit codes. - captures the source locations of errors in error messages. - compares exit codes of new wrapper and old wrapper. BUG=chromium:773875 TEST=unit test Change-Id: I919e58091d093d68939809f676f799a68ec7a34e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1676833 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-06-25Allow to pass in the use_ccache via go build.Tobias Bosch
Removes usage of go build tags in favor of passing in configuration via -ldflags -X ... BUG=chromium:773875 TEST=unit test Change-Id: I4e8a58e1679b2858e9d4620d6b9c7a35ad08a6ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1670987 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-06-20Initial version of a go version of the compiler wrapper.Tobias Bosch
Still calls the old wrapper if one of the following flags is given: - Xclang-path - clang-syntax - env WITH_TIDY - env FORCE_DISABLE_WERROR - env GETRUSAGE - env BISECT_STAGE BUG=chromium:773875 TEST=Unit tests that also verify the produced command against the TEST=existing compiler wrapper. Change-Id: I1e0a720ce9f485d8015deefb2682f2cb760d82e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1652057 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>