[PATCH] D152921: [lld] Synthesize metadata for MTE globals

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 10:44:52 PDT 2023


MaskRay accepted this revision.
MaskRay added a comment.

LGTM again. Feel free to file a request to merge this into https://github.com/llvm/llvm-project/tree/release/17.x if you prefer.



================
Comment at: lld/ELF/SyntheticSections.h:1272
+  bool isNeeded() const override {
+    return !config->isStatic && !symbols.empty();
+  }
----------------
hctim wrote:
> hctim wrote:
> > MaskRay wrote:
> > > Why is the `!config->isStatic &&` condition?
> > > 
> > > `isConfig` can be toggled by `-Bstatic`/`-static` and `-Bdynamic`. 
> > > `-Bstatic` can be used with a dynamically linked executable as well.
> > MTE globals are not supported for fully static executables, there needs to be a dynamic loader that processes relocations.
> > 
> > Is there a better way to describe this in code? Maybe pulling `needsInterpSection` out of Writer.cpp?
> @MaskRay - any suggestions here?
Yes, moving `needsInterpSection` to `Writer.h` and exposing it here looks good to me.

You will need to move `isNeeded` to `SyntheticSections.cpp` as we cannot make SyntheticSections.h include Writer.h.

Ideally SyntheticSections.cpp does not use more functions from Writer.h, so SyntheticSections.cpp defining `needsInterpSection` is also fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152921



More information about the llvm-commits mailing list