[PATCH] D137819: [XCOFF] support the overflow section.

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 13:42:56 PST 2022


DiggerLin added a comment.

change the description to 'support the relocation overflow section."



================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:819
+    // the number of line-number entries actually required.
     writeWord(IsDwarf ? 0 : Sec->Address);
+    writeWord((IsDwarf || IsOvrflo) ? 0 : Sec->Address);
----------------
the information of SectionEntry is not enough to identify the the overflow is relocation or line no overflow. I think we need to derived  class from SectionEntry  and have flag in the derived  class to identify the overflow is relocation or line no overflow. 

and if the flag is relocation overflow, the Sec->Address will be write in the s_paddr, otherwise Sec->Address will be writen in the s_vaddr


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:834
       W.write<uint16_t>(Sec->RelocationCount);
-      W.write<uint16_t>(0); // NumberOfLineNumbers. Not supported yet.
+      W.write<uint16_t>(IsOvrflo
+                            ? Sec->RelocationCount
----------------
the IsOvrflo is used to identify overflow section. but for the section which has overflow relocation or line no overflow, the both field of s_nlnno and  s_nlnno should be set to same (both 65535) , it looks you not implement it.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:949
+      SecEntry.Address = RelCount;
+      SecEntry.Index = 3;
+
----------------
why set index to 3 here?


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:1027
+          // primary section header.
+          OvrfloSec.FileOffsetToRelocations = Sec->FileOffsetToRelocations;
+        }
----------------
I can not find "the s_relptr must have the same values as in the corresponding primary section header." in the xcoff document.

s_relptr	Recognized for the .text , .data , .tdata, and STYP_DWARF sections only.
so the field "s_relptr" in the overflow section should be set to zero?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137819



More information about the llvm-commits mailing list