[PATCH] D88737: [AIX] Turn -fdata-sections on by default in Clang
Jason Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 2 07:21:05 PDT 2020
jasonliu added a comment.
Not sure if there is a better way to do this. But I have to admit this approach along with D88493 <https://reviews.llvm.org/D88493> is a bit fragile.
If plug-in writer forgets to set `HasExplicitDataSections` to true, then the final result that TargetMachine give for `getDataSections()` could be false on most platform even when they deliberately set `DataSections` to true.
We have other targets in LLVM that have -fdata-sections by default as well. And they do it differently as well, which makes this a bit more complicate to be consistent.
For example, cloudABI would pass -fdata-sections through the Clang Driver by default. But that approach means if some user just invoke llc directly, they could get the wrong default on llc for that platform.
Wasm would just overwrite the `DataSections` option to true in their TargetMachine. But that means you could not set it to false even if you want to.
I've thought about making the `DataSections` option in TargetOptions an enum instead of boolean value, where you could have `Default`, `On` and `Off` to represent what we actually want for the options. That's not a trivial change, as a lot of consumers for TargetOptions are relying it to be a boolean.
If you think it's a better way to solve this problem and I should explore, let me know.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88737/new/
https://reviews.llvm.org/D88737
More information about the cfe-commits
mailing list