[Openmp-commits] [PATCH] D117211: [openmp] Mark used variables as retain as well

Fangrui Song via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jan 13 14:01:13 PST 2022


MaskRay added a comment.

In D117211#3241759 <https://reviews.llvm.org/D117211#3241759>, @JonChesterfield wrote:

> The section discard behaviour is opt-in though, so any program that wrote 'used' to retain the variable and then used gc-sections, discovered it didn't work, and worked around that. Probably by compromising on gc.
>
> So we aren't going from a state of broken to better, we're going from a system that worked reliably for years (provided the linker wasn't told to deadstrip sections and the compiler wasn't told to put the global in it's own section) to one that silently discards symbols.
>
> If the idea is llvm.used and llvm.compiler.used shall now have the same semantics, we can kill a long tail of bugs by deleting one of them.

I am afraid that you may still have misunderstanding.

The patch series D97446 <https://reviews.llvm.org/D97446> has moved ELF from a state of broken to better. It matches GCC. It is just different from traditional Mach-O Clang behavior.

The issue that some optimization passes may have problems is not an argument for not doing D97446 <https://reviews.llvm.org/D97446>.

I have mentioned on D97446 <https://reviews.llvm.org/D97446> how the split of llvm.used and llvm.compiler.used is useful. I managed to 10+ object size decrease for some instrumentations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117211



More information about the Openmp-commits mailing list