Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Issue 1158643002: GN: Build with a custom libc++ when using ASAN, TSAN or MSAN. (Closed)

Created:
5 years, 7 months ago by Sam McNally
Modified:
5 years, 6 months ago
CC:
chromium-reviews, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@gn-instrumented-libraries-prebuilt
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

GN: Build with a custom libc++ when using ASAN, TSAN or MSAN. Committed: https://crrev.com/296900634b5d646d19dbd5415183788a6f005633 Cr-Commit-Position: refs/heads/master@{#331937}

Patch Set 1 : #

Total comments: 9

Patch Set 2 : #

Total comments: 2

Patch Set 3 : #

Patch Set 4 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -5 lines) Patch
M build/config/compiler/BUILD.gn View 1 2 3 2 chunks +10 lines, -1 line 0 comments Download
M build/config/sanitizers/BUILD.gn View 1 2 3 1 chunk +8 lines, -4 lines 0 comments Download
A build/config/sanitizers/sanitizers.gni View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (9 generated)
Sam McNally
This depends on https://codereview.chromium.org/1145333004/.
5 years, 7 months ago (2015-05-25 08:25:12 UTC) #3
Alexander Potapenko
https://codereview.chromium.org/1158643002/diff/20001/build/config/sanitizers/sanitizers.gni File build/config/sanitizers/sanitizers.gni (right): https://codereview.chromium.org/1158643002/diff/20001/build/config/sanitizers/sanitizers.gni#newcode19 build/config/sanitizers/sanitizers.gni:19: use_custom_libcxx = (is_asan && is_desktop_linux) || is_tsan || is_msan ...
5 years, 7 months ago (2015-05-25 08:27:18 UTC) #5
Sam McNally
https://codereview.chromium.org/1158643002/diff/20001/build/config/sanitizers/sanitizers.gni File build/config/sanitizers/sanitizers.gni (right): https://codereview.chromium.org/1158643002/diff/20001/build/config/sanitizers/sanitizers.gni#newcode19 build/config/sanitizers/sanitizers.gni:19: use_custom_libcxx = (is_asan && is_desktop_linux) || is_tsan || is_msan ...
5 years, 7 months ago (2015-05-25 08:31:22 UTC) #6
earthdok
The GYP config makes it possible to enable custom libc++ without any of the sanitizers. ...
5 years, 7 months ago (2015-05-25 15:28:00 UTC) #8
earthdok
(actually adding Nico)
5 years, 7 months ago (2015-05-25 15:28:24 UTC) #10
Nico
On 2015/05/25 15:28:00, earthdok wrote: > The GYP config makes it possible to enable custom ...
5 years, 7 months ago (2015-05-25 19:30:39 UTC) #11
Dirk Pranke
https://codereview.chromium.org/1158643002/diff/20001/build/config/sanitizers/BUILD.gn File build/config/sanitizers/BUILD.gn (right): https://codereview.chromium.org/1158643002/diff/20001/build/config/sanitizers/BUILD.gn#newcode18 build/config/sanitizers/BUILD.gn:18: if (use_custom_libcxx) { On 2015/05/25 15:27:59, earthdok wrote: > ...
5 years, 7 months ago (2015-05-25 22:26:43 UTC) #12
Sam McNally
On 2015/05/25 15:28:00, earthdok wrote: > The GYP config makes it possible to enable custom ...
5 years, 7 months ago (2015-05-26 01:15:00 UTC) #13
earthdok
https://codereview.chromium.org/1158643002/diff/20001/build/config/sanitizers/BUILD.gn File build/config/sanitizers/BUILD.gn (right): https://codereview.chromium.org/1158643002/diff/20001/build/config/sanitizers/BUILD.gn#newcode18 build/config/sanitizers/BUILD.gn:18: if (use_custom_libcxx) { On 2015/05/25 22:26:43, Dirk Pranke wrote: ...
5 years, 7 months ago (2015-05-26 16:43:49 UTC) #15
Sam McNally
https://codereview.chromium.org/1158643002/diff/60001/build/config/sanitizers/BUILD.gn File build/config/sanitizers/BUILD.gn (left): https://codereview.chromium.org/1158643002/diff/60001/build/config/sanitizers/BUILD.gn#oldcode7 build/config/sanitizers/BUILD.gn:7: # |is_asan|, |is_lsan|, |is_tsan| and |is_msan| are false. On ...
5 years, 7 months ago (2015-05-27 00:08:15 UTC) #16
earthdok
lgtm, thanks On 2015/05/27 00:08:15, Sam McNally wrote: > Executables and shared libraries should have ...
5 years, 7 months ago (2015-05-27 16:21:56 UTC) #17
Dirk Pranke
lgtm
5 years, 7 months ago (2015-05-27 19:37:07 UTC) #18
Sam McNally
On 2015/05/27 16:21:56, earthdok wrote: > Could you point me to where this dep is ...
5 years, 6 months ago (2015-05-29 08:27:16 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1158643002/120001
5 years, 6 months ago (2015-05-29 08:27:31 UTC) #23
commit-bot: I haz the power
Committed patchset #4 (id:120001)
5 years, 6 months ago (2015-05-29 08:30:42 UTC) #24
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/296900634b5d646d19dbd5415183788a6f005633 Cr-Commit-Position: refs/heads/master@{#331937}
5 years, 6 months ago (2015-05-29 08:31:40 UTC) #25
earthdok
5 years, 6 months ago (2015-05-29 17:18:36 UTC) #26
Message was sent while issue was closed.
On 2015/05/29 08:27:16, Sam McNally wrote:
> On 2015/05/27 16:21:56, earthdok wrote:
> > Could you point me to where this dep is added to the chrome executable in a
> > non-component build? I must be missing something.
> 
> I think the chrome executable target is currently missing that dep.

On 2015/05/29 08:27:16, Sam McNally wrote:
> On 2015/05/27 16:21:56, earthdok wrote:
> > Could you point me to where this dep is added to the chrome executable in a
> > non-component build? I must be missing something.
> 
> I think the chrome executable target is currently missing that dep.

I think you're right.

My concern is with what happens if a developer forgets to add this dep to their
target. The effect should be some sort of error message; we should not silently
disable ASan or silently ignore sanitizer_options.

This more or less works as of now, because this dep is also responsible for
passing ldflags=-fsanitize=... If is_asan=true is set, every target will get
cflags=-fsanitize=address (through build/config/compiler), but only those
targets that have this dep will get the linker flag. Those that don't will fail
linking if they're executables (every executable needs to link in the ASan
runtime), but link successfully if they're shared libraries.

This is not perfect though:
- some targets might want ASan without default options, so we'll have to
decouple ldflags from default options at some point (I know nacl defines its own
default options somewhere, for instance),
- it's not correct to not pass ldflags=-fsanitize=... to a shared library target
even if it links without errors. Even though we don't need to link shared
libraries against the ASan runtime, that flag may have other side effects.
- (minor issue) if the linker flag is omitted, linking a big executable takes a
lot of time because of all the symbol resolution errors. If you try building
non-component Chrome with ASan and goma, it appears as if the linking step hangs
forever, because goma swallows all the error messages. So this is not a very
good diagnostic.

Can we somehow force every target that ever receives the ASan cflags to depend
on either //build/config/sanitizers:deps or
//build/config/sanitizers:no_default_options (or somesuch)?

(I won't be around to continue this discussion, but glider@ will.)

Powered by Google App Engine
This is Rietveld 408576698