Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable overriding the tool used by link actions in cc_configure #8777

Closed
nlopezgi opened this issue Jul 2, 2019 · 8 comments
Closed

Enable overriding the tool used by link actions in cc_configure #8777

nlopezgi opened this issue Jul 2, 2019 · 8 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: feature request

Comments

@nlopezgi
Copy link
Contributor

nlopezgi commented Jul 2, 2019

Description of the problem / feature request:

Enable overriding the tool used by link actions in cc_configure.

Feature requests: what underlying problem are you trying to solve with this feature?

We want to support ubsan builds with Bazel / RBE without the need for a custom toolchain configuration. Currently, the only thing that our toolchain configuration defines is the tool used for link actions (e.g., https://github.com/bazelbuild/bazel-toolchains/blob/master/configs/experimental/ubuntu16_04_clang/1.2/bazel_0.23.0/ubsan/cc_toolchain_config.bzl#L116).
Every other sanitizer (asan, msan, tsan) currently works out of the box both with the Bazel container and with Bazel + RBE, except for ubsan. We spend too much effort currently to manually upgrade our ubsan custom toolchain with new Bazel versions.

We think it should be plausible to have cc_configure read a BAZEL_LINKTOOL env variable or something of the sort and produce the corresponding toolchain config that only has the relevant action configs overridden.

@keith
Copy link
Member

keith commented Jul 2, 2019

Related #7883

@hlopko
Copy link
Member

hlopko commented Jul 3, 2019

Can you link issues/discussions about ubsan needed clang++? Sounds weird that it does..

@hlopko
Copy link
Member

hlopko commented Jul 3, 2019

And to be sure, you don't care about specifying the linker (e.g. specifying FOO when passing -fuse-ld=FOO to CC), you only want to specify the tool that will be used in linking related action configs.

I think the former is requested more often..

@hlopko hlopko added P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: feature request labels Jul 3, 2019
@hlopko
Copy link
Member

hlopko commented Jul 3, 2019

Alternative that comes to mind is to use clang++ for CC - setting clang++ to be the compiler driver for everything. Did you consider that? What were the problems?

@nlopezgi
Copy link
Contributor Author

nlopezgi commented Jul 3, 2019

Hi Marcel, thanks for your response.
I have tried using clang++ for CC and that does not work for ubsan, it has to only be the tool used for link actions.
Why clang++?
I used clang++ following advice from:
google/oss-fuzz#383 and
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#usage which states clang++ should be used as linker

@hlopko
Copy link
Member

hlopko commented Jul 8, 2019

Thanks Nick, give me a few days to see if we can get away with using clang, I hope it will be possible.

@nlopezgi
Copy link
Contributor Author

nlopezgi commented Jul 8, 2019

sure thing! I would love to find a simpler way to get ubsan to work.

@hlopko
Copy link
Member

hlopko commented Dec 6, 2019

Closing since it seems there are ways to make upsan work with current APIs.

@hlopko hlopko closed this as completed Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants