Hello all,
This may be a common question, but I was unable to turn up anything modern with a simple search.
I want to specify explicitly the architecture of my processor in a -march flag (-march=knl) and an optimization flag (-Ofast), and enable LTO + profiling. From what I've researched thus far:
-
- To set CFLAGS, modify "cflags" GN variable
- To modify a GN variable, have to edit a BUILD.gn
- To add to cflags, have to trace what happens from root BUILD.gn
- Root BUILD.gn invokes /build/config/compiler/BUILD.gn
- compiler's BUILD.gn contains recipes for "optimize_max" which looks like a good place to start tweaking
- compiler BUILD.gn states: # You can override the optimization level on a per-target basis by removing the
# default config and then adding the named one you want:
#
# configs -= [ "//build/config/compiler:default_optimization" ]
# configs += [ "//build/config/compiler:optimize_max" ]
- I try to uncomment the lines: error. I realize "configs" is not in this scope.
- Each config block is an object that must have a target (apparently can be an "executable" according to the example in the docs) -- no mention which executable is global/controlling/the one to set for a chromium build
- Docs say I can also specify config via commandline -- no mention what commandline (I only see "gn args out/Default") or how to add "configs -= [ "//build/config/compiler:default_optimization" ]" to such commandline
- Finally stumped after this wild goose chase -- I can't figure out what to do to add these simple CFLAGS.
If Chromium already has a way to do profiled optimization (I see there's some stuff in the optimization configs for bootstrapping and LTO), it's not clear how to apply it instead of manually appending the CFLAGS. Apparently nobody is compiling Chromium with anything but the default settings on standard machines nowadays because it's an information wasteland out there -- or I'm just a bad scourer.
Thanks for any help,
Gabe