[PATCH] D97976: [MC] Change ELFOSABI_NONE to ELFOSABI_GNU for SHF_GNU_RETAIN

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 5 06:56:14 PST 2021


peter.smith added a comment.

No objections.

Just thinking how to avoid lifting markGnuAbi into the generic MCObjectWriter. The only immediate thing I can think of is casting the result of Asm.getWriter in

  if (SectionELF->getFlags() & ELF::SHF_GNU_RETAIN)
      Asm.getWriter().markGnuAbi();

To MCELFObjectTargetWriter. I think this should be possible as I think it is the only choice from within MCELFStreamer, and I guess we could check with a dyn_cast before doing so if we were paranoid. That would allow either markGnuAbi to be put there, or with some more modifications something like setOsABI().



================
Comment at: llvm/include/llvm/MC/MCObjectWriter.h:88
 
+  virtual void markGnuAbi() {}
+
----------------
Will be worth a comment marking as ELF only.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97976



More information about the llvm-commits mailing list