[PATCH] D96838: Add GNU attribute 'retain'

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 24 09:28:20 PST 2021


MaskRay added a comment.

We have two implementation choices.

1. Lift the source language restriction (it is currently discouraged) on llvm.compiler.used, let llvm.used use `SHF_GNU_RETAIN` on ELF, and change `__attribute__((used))` to use llvm.compiler.used on ELF.
2. Don't touch the backend semantics of llvm.used or llvm.compiler.used. Add a metadata `!retain` and let `__attribute__((retain))` use that. This is what has been implemented in D96837 <https://reviews.llvm.org/D96837> and this patch.

I posted https://lists.llvm.org/pipermail/llvm-dev/2021-February/148760.html (llvm-dev & cfe-dev) (my first message mentions that I lean to 1. I actually lean to 2.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96838



More information about the cfe-commits mailing list