[PATCH] D137819: [XCOFF] support the overflow section (only relocation overflow is handled).

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 10:19:05 PST 2022


DiggerLin added inline comments.


================
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);
----------------
Esme wrote:
> DiggerLin wrote:
> > Esme wrote:
> > > DiggerLin wrote:
> > > > 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
> > > As my previous comments, there's no need to identify whether it's a relocation overflow section or line number overflow section.
> > > Since the line number is not supported, set the Virtual Address, which specifies the number of line-number entries actually required, to 0.
> > assume you need to implement  line number overflow in next patch, where you want to put the actually line number in SectionEntry of overflow section?(you put the relocation number in the Sec->Address in current patch.) 
> ```
> struct SectionEntry {
>   char Name[XCOFF::NameSize];
>   // The physical/virtual address of the section. For an object file
>   // these values are equivalent.
>   uint64_t Address;
>   uint64_t Size;
>   uint64_t FileOffsetToData;
>   uint64_t FileOffsetToRelocations;
>   uint32_t RelocationCount;
>   int32_t Flags;
> 
>   int16_t Index;
> ...
> }
> ```
> To implement the line number, we have to add some members to SectionEntry, like `FileOffsetToLineNum` and `LineNumCount`,  and I think we can distinguish the Address here into PhysicalAddress and VirtualAddress, which will be used to record the actual line number when the section is an overflow section.
> I think we can distinguish the Address here into PhysicalAddress and VirtualAddress, which will be used to record the actual line number when the section is an overflow section.

you want to add a new flag to distinguish the Address here into PhysicalAddress and VirtualAddress later when you implement  the line number overflow patch? that is what I ask for.  please add the flag now or add some comment on it.  


================
Comment at: llvm/test/CodeGen/PowerPC/aix-xcoff-huge-relocs.ll:8
+; RUN:   sed > %t.overflow.ll 's/SIZE/65535/;s/MACRO/#/;s/#/################/g;s/#/################/g;s/#/################/g;s/#/################/g;s/#/#_/g;s/_#_\([^#]\)/\1/;s/_/, /g;s/#/ptr @c/g;'
+; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff \
+; RUN:     -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.overflow.o %t.overflow.ll
----------------
since 64bit do not have overflow section. I think we also need 64bits test case.


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