[PATCH] D125847: LTO: Enable opaque pointers by default.

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 11:27:57 PDT 2022


MatzeB added a comment.

While trying to implement things I noticed that `-Xclang` options are only meant for the LLVM codegeneration part (aka CC1) of clang, they are not meant for the linker/LTO (which would be -Xlinker or -Wl) and consequently there is no easy way in the code to query `-Xclang` options and pass them on to the linker (nor would it be a good idea I think).

The usual approach seems to be that codegen options are recorded in the IR as much as possible so we can reconstruct the settings from that during LTO. This is however awkward in this case, as we have to make the decision between opaque/typed pointer types before reading the first bitcode file and cannot really go back and undo it...

I think what I'm gonna do is:

- Add an LTOConfig option for opaque pointers, disabled by default
- Add `-opaque-pointer`, `-no-opaque-pointer` options to gold-plugin and lld/ELF, disabled by default
- Have clang pass a `-opaque-pointer` option to lld if `CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL` was enabled during the build and the user didn't pass any other `-opaque-pointer`/`-no-opaque-pointer` option via `-Wl` / `-Xlinker`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125847/new/

https://reviews.llvm.org/D125847



More information about the llvm-commits mailing list