[PATCH] D150631: [LLD] Emit DT_PPC64_OPT into the dynamic section

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 12:47:30 PDT 2023


MaskRay added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:1534
 
+  // There may be multiple TOCs due to emitting thunks for some NOTOC relocs.
+  if (config->emachine == EM_PPC64)
----------------
This comment is incomplete and repeats what's said elsewhere. I'd just remove this comment. Users know to find `dynamicSectionOptFlags`.


================
Comment at: lld/ELF/SyntheticSections.cpp:1535
+  // There may be multiple TOCs due to emitting thunks for some NOTOC relocs.
+  if (config->emachine == EM_PPC64)
+    addInt(DT_PPC64_OPT, getPPC64TargetInfo()->dynamicSectionOptFlags);
----------------
Does GNU ld emit this dynamic tag when it is 0? An alternative is to omit this entry if 0.


================
Comment at: lld/ELF/Target.h:147
+  // is functionally equivalent.
+  int dynamicSectionOptFlags = -1;
+
----------------
You can initialize this to 0 and omit the assignment in PPC64. Other targets don't use this.

You can name this `ppc64DynamicSectionOpt`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150631



More information about the llvm-commits mailing list