[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 13:35:17 PST 2022


MaskRay added a comment.

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

> See D97446 <https://reviews.llvm.org/D97446>. Used no longer means "used by something so don't delete it".
>
> I don't know why we had no multiply defined symbol errors with the old version, should have done. Maybe lucky interleaving of the breaking change to the attribute with the changes to the driver.
>
> Tests in trunk don't use the environment variable, so didn't notice it missing / containing zero. In this case it was 'used' being turned into compiler.used then internalised, so not quite the same as symbol visibility. Similar sort of thing though

I am afraid there is a confusion.

`__attribute__((used))` did lower to `llvm.used` on ELF, but GNU ld/gold/ld.lld were always free to discard the section. Mach-O ld64 retains the section, though.

`__attribute__((used))` lowers to `llvm.compiler.used` now, which has the same behavior as the old ELF `llvm.used`.

It is possible that some optimization passes do not respect `llvm.compiler.used` as Clang previously did not often emit `llvm.compiler.used`.


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