[Mips] Assign .MIPS.options section to the PT_LOAD segment

llvm-svn: 235488
This commit is contained in:
Simon Atanasyan 2015-04-22 08:09:38 +00:00
parent 5606dac67e
commit 6668eb3c40
4 changed files with 10 additions and 6 deletions

View File

@ -76,7 +76,7 @@ public:
const MipsReginfo &reginfo)
: Section<ELFT>(ctx, ".MIPS.options", "MipsOptions"),
_targetLayout(targetLayout) {
this->setOrder(MipsTargetLayout<ELFT>::ORDER_RO_NOTE);
this->setOrder(MipsTargetLayout<ELFT>::ORDER_MIPS_OPTIONS);
this->_entSize = 1;
this->_alignment = 8;
this->_fsize = llvm::RoundUpToAlignment(
@ -98,6 +98,8 @@ public:
_reginfo.ri_cprmask[3] = reginfo._cpRegMask[3];
}
bool hasOutputSegment() const override { return true; }
void write(ELFWriter *writer, TargetLayout<ELFT> &layout,
llvm::FileOutputBuffer &buffer) override {
uint8_t *dest = buffer.getBufferStart() + this->fileOffset();

View File

@ -21,7 +21,8 @@ class MipsLinkingContext;
template <class ELFT> class MipsTargetLayout final : public TargetLayout<ELFT> {
public:
enum MipsSectionOrder {
ORDER_MIPS_REGINFO = TargetLayout<ELFT>::ORDER_RO_NOTE + 1
ORDER_MIPS_REGINFO = TargetLayout<ELFT>::ORDER_RO_NOTE + 1,
ORDER_MIPS_OPTIONS
};
MipsTargetLayout(MipsLinkingContext &ctx)
@ -48,6 +49,8 @@ public:
switch (section->order()) {
case ORDER_MIPS_REGINFO:
return llvm::ELF::PT_MIPS_REGINFO;
case ORDER_MIPS_OPTIONS:
return llvm::ELF::PT_LOAD;
default:
return TargetLayout<ELFT>::getSegmentType(section);
}

View File

@ -39,7 +39,6 @@
# PHDR: Type: PT_LOAD
# PHDR-NOT: Type: PT_LOAD
# PHDR: Type: PT_DYNAMIC
# PHDR: Type: PT_NOTE
# t1.o
---

View File

@ -6,7 +6,7 @@
# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=SEC %s
# SYM: Name: L1
# SYM-NEXT: Value: 0x194
# SYM-NEXT: Value: 0x15C
# SYM-NEXT: Size: 4
# SYM-NEXT: Binding: Local (0x0)
# SYM-NEXT: Type: Function (0x2)
@ -21,9 +21,9 @@
# SYM-NEXT: Other: 0
# SYM-NEXT: Section: Absolute (0xFFF1)
# 0xffff81a4 == 0x0 (addend) + 0x0194 (L1) + 0x1000 (GP0) - 0x8ff0 (_gp)
# 0xffff816c == 0x0 (addend) + 0x015C (L1) + 0x1000 (GP0) - 0x8ff0 (_gp)
# SEC: Contents of section .rodata:
# SEC-NEXT: {{[0-9a-f]+}} a481ffff 00000000 00000000 00000000
# SEC-NEXT: {{[0-9a-f]+}} 6c81ffff 00000000 00000000 00000000
!ELF
FileHeader: