const MipsReginfo ®info)
: Section<ELFT>(ctx, ".reginfo", "MipsReginfo"),
_targetLayout(targetLayout) {
- this->setOrder(MipsTargetLayout<ELFT>::ORDER_RO_NOTE);
+ this->setOrder(MipsTargetLayout<ELFT>::ORDER_MIPS_REGINFO);
this->_entSize = sizeof(Elf_RegInfo);
this->_fsize = sizeof(Elf_RegInfo);
this->_msize = sizeof(Elf_RegInfo);
_reginfo.ri_cprmask[3] = reginfo._cpRegMask[3];
}
+ StringRef segmentKindToStr() const override { return "REGINFO"; }
+
+ bool hasOutputSegment() const override { return true; }
+
void write(ELFWriter *writer, TargetLayout<ELFT> &layout,
llvm::FileOutputBuffer &buffer) override {
uint8_t *dest = buffer.getBufferStart() + this->fileOffset();
/// \brief TargetLayout for Mips
template <class ELFT> class MipsTargetLayout final : public TargetLayout<ELFT> {
public:
+ enum MipsSectionOrder {
+ ORDER_MIPS_REGINFO = TargetLayout<ELFT>::ORDER_RO_NOTE + 1
+ };
+
MipsTargetLayout(MipsLinkingContext &ctx)
: TargetLayout<ELFT>(ctx),
_gotSection(new (this->_allocator) MipsGOTSection<ELFT>(ctx)),
return TargetLayout<ELFT>::createSection(name, type, permissions, order);
}
+ typename TargetLayout<ELFT>::SegmentType
+ getSegmentType(Section<ELFT> *section) const override {
+ switch (section->order()) {
+ case ORDER_MIPS_REGINFO:
+ return llvm::ELF::PT_MIPS_REGINFO;
+ default:
+ return TargetLayout<ELFT>::getSegmentType(section);
+ }
+ }
+
/// \brief GP offset relative to .got section.
uint64_t getGPOffset() const { return 0x7FF0; }
/// \brief convert the segment type to a String for diagnostics and printing
/// purposes
- StringRef segmentKindToStr() const;
+ virtual StringRef segmentKindToStr() const;
/// \brief Records the segmentType, that this section belongs to
void
# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o
# RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t1.o %t2.o
-# RUN: llvm-readobj -s %t.so | FileCheck -check-prefix=SEC %s
+# RUN: llvm-readobj -program-headers -s %t.so | FileCheck -check-prefix=SEC %s
# RUN: llvm-objdump -s -t %t.so | FileCheck -check-prefix=RAW %s
# SEC: Index: 1
# SEC-NEXT: AddressAlignment: 4
# SEC-NEXT: EntrySize: 24
+# SEC: ProgramHeader {
+# SEC: Type: PT_MIPS_REGINFO (0x70000000)
+# SEC-NEXT: Offset: 0x{{[0-9A-F]+}}
+# SEC-NEXT: VirtualAddress: 0x{{[0-9A-F]+}}
+# SEC-NEXT: PhysicalAddress: 0x{{[0-9A-F]+}}
+# SEC-NEXT: FileSize: 24
+# SEC-NEXT: MemSize: 24
+# SEC-NEXT: Flags [ (0x4)
+# SEC-NEXT: PF_R (0x4)
+# SEC-NEXT: ]
+# SEC-NEXT: Alignment: 4
+# SEC-NEXT: }
+
# RAW: Contents of section .reginfo:
# RAW-NEXT: {{[0-9a-f]+}} f0000001 e0000002 d0000003 c0000004
# RAW-NEXT: {{[0-9a-f]+}} b0000005 f08f0000