libstdc++: make hardening assertions configurable from GN args

The current implementation for enabling libstdc++ hardening
assertions is done using build_overrides.gni. This is problematic
as it breaks other dependencies using //build/ as they will require
also an specific argument for that purpose.

Replace it with a GN arg, use_safe_libcxx, that uses same heuristic
(Linux without custom libc++), but can be set from command line. This
is because we cannot accurately know if libstdc++ is used, so we want
to still allow to enable the assertions.

Bug: 328287875
Change-Id: I27cf09a13af638cfc5e82bce5e3fa7391512c59c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5348001
Reviewed-by: Philipp Wollermann <philwo@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1274804}
NOKEYCHECK=True
GitOrigin-RevId: d1579bf7a849c3b2d99e268a4a84ff0ae8068fa5
1 file changed
tree: 25f0bd8991a035eedd089002ebeb4191bc24fe27
  1. angle.gni
  2. build.gni
  3. dawn.gni
  4. glslang.gni
  5. gtest.gni
  6. ipcz.gni
  7. OWNERS
  8. partition_alloc.gni
  9. pdfium.gni
  10. README.md
  11. spirv_tools.gni
  12. swiftshader.gni
  13. tint.gni
  14. vulkan_common.gni
  15. vulkan_headers.gni
  16. vulkan_loader.gni
  17. vulkan_tools.gni
  18. vulkan_utility_libraries.gni
  19. vulkan_validation_layers.gni
  20. wayland.gni
README.md

Build overrides in GN

This directory is used to allow different products to customize settings for repos that are DEPS'ed in or shared.

For example: V8 could be built on its own (in a “standalone” configuration), and it could be built as part of Chromium. V8 might define a top-level target, //v8:d8 (a simple executable), that should only be built in the standalone configuration. To figure out whether or not it should be in a standalone configuration, v8 can create a file, build_overrides/v8.gni, that contains a variable, build_standalone_d8 = true. and import it (as import(“//build_overrides/v8.gni”) from its top-level BUILD.gn file.

Chromium, on the other hand, might not need to build d8, and so it would create its own build_overrides/v8.gni file, and in it set build_standalone_d8 = false.

The two files should define the same set of variables, but the values can vary as appropriate to the needs of the two different builds.

The build.gni file provides a way for projects to override defaults for variables used in //build itself (which we want to be shareable between projects).

TODO(crbug.com/588513): Ideally //build_overrides and, in particular, //build_overrides/build.gni should go away completely in favor of some mechanism that can re-use other required files like //.gn, so that we don't have to keep requiring projects to create a bunch of different files to use GN.