Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
incompatible_remove_legacy_whole_archive: Remove --legacy_whole_archive while setting default to false #7362
The docs of this flag say:
What this means is that all library archives (and library object groups, as defined by --start-lib/--end-lib) are added to the link command wrapped in -whole-archive, -no-whole-archive, which instructs the linker to always include the entire library. Even with dead code elimination, this can be pernicious if the library defines some global initializer, as that will cause all of the code dependencies of those initializers to be kept.
"Legacy" whole-archive behavior is a poor default, but it is difficult to change.
Care must be taken to flip the default--libraries which export symbols must be tagged as
It is a difficult thing to test: unexported symbols are only noticed at runtime, which means that 100% test coverage would have to exist for a depot-wide mass cleanup.
Bazel now has a mechanism to configure individual
This is the migration plan we will follow at Google:
I think this breaks Android. On Android, to build an
Example commands I'm seeing: