[PATCH] D92430: [lld-macho] Add isCodeSection()

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 14:54:02 PST 2020


smeenai added inline comments.


================
Comment at: lld/MachO/InputSection.cpp:67
+  uint32_t attr = isec->flags & MachO::SECTION_ATTRIBUTES_USR;
+  if (attr == S_ATTR_PURE_INSTRUCTIONS)
+    return true;
----------------
smeenai wrote:
> int3 wrote:
> > clayborg wrote:
> > > BTW there is also a S_ATTR_SOME_INSTRUCTIONS attribute we might be able to use and improve.
> > hmm I don't think ld64 uses S_ATTR_SOME_INSTRUCTIONS to identify code sections. (Though it does ensure that every code section it emits has both S_ATTR_SOME_INSTRUCTIONS and S_ATTR_PURE_INSTRUCTIONS set.)
> Out of curiosity, how does S_ATTR_PURE_INSTRUCTIONS interact with LC_DATA_IN_CODE? For example, if Clang ends up emitting an ARM constant pool into the text section (so it's not technically pure instructions), is the section still marked as pure instructions?
To answer my own question, I'm having a hard time getting clang to produce a constant pool for arm64, but at least for armv7, it marks `__TEXT,__text` as pure instructions despite the constant pool: https://godbolt.org/z/MaT9E1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92430



More information about the llvm-commits mailing list