[PATCH] D128382: [LLD] Two tweaks to symbol ordering scheme

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 16:39:41 PDT 2022


MaskRay added inline comments.


================
Comment at: lld/ELF/Writer.cpp:1323
   for (InputSection *isec : isd->sections) {
+    if (executableOutputSection)
+      totalSize += isec->getSize();
----------------
Delete `if (executableOutputSection)`


================
Comment at: lld/ELF/Writer.cpp:1368
+  if (executableOutputSection && target->getThunkSectionSpacing() &&
+      !orderedSections.empty() &&
+      totalSize >= target->getThunkSectionSpacing()) {
----------------
it's more natural to place two `target->getThunkSectionSpacing()` together.


================
Comment at: lld/test/ELF/arm-symbol-ordering-file.s:15
+# RUN: rm -f %t.*.o %t2.*.out
+
+# SMALL: ordered
----------------
We need a test that readonly sections on'y trigger the logic.

You can use `llvm-objcopy --set-section-flags .foo=alloc,readonly %t.small.o` to drop SHF_EXECINSTR.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128382



More information about the llvm-commits mailing list