[lld] r235488 - [Mips] Assign .MIPS.options section to the PT_LOAD segment
Simon Atanasyan
simon at atanasyan.com
Wed Apr 22 01:09:39 PDT 2015
Author: atanasyan
Date: Wed Apr 22 03:09:38 2015
New Revision: 235488
URL: http://llvm.org/viewvc/llvm-project?rev=235488&view=rev
Log:
[Mips] Assign .MIPS.options section to the PT_LOAD segment
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h
lld/trunk/test/elf/Mips/mips-options-02.test
lld/trunk/test/elf/Mips/mips-options-gp0.test
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h?rev=235488&r1=235487&r2=235488&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h Wed Apr 22 03:09:38 2015
@@ -76,7 +76,7 @@ public:
const MipsReginfo ®info)
: 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();
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h?rev=235488&r1=235487&r2=235488&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h Wed Apr 22 03:09:38 2015
@@ -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);
}
Modified: lld/trunk/test/elf/Mips/mips-options-02.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/mips-options-02.test?rev=235488&r1=235487&r2=235488&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/mips-options-02.test (original)
+++ lld/trunk/test/elf/Mips/mips-options-02.test Wed Apr 22 03:09:38 2015
@@ -39,7 +39,6 @@
# PHDR: Type: PT_LOAD
# PHDR-NOT: Type: PT_LOAD
# PHDR: Type: PT_DYNAMIC
-# PHDR: Type: PT_NOTE
# t1.o
---
Modified: lld/trunk/test/elf/Mips/mips-options-gp0.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/mips-options-gp0.test?rev=235488&r1=235487&r2=235488&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/mips-options-gp0.test (original)
+++ lld/trunk/test/elf/Mips/mips-options-gp0.test Wed Apr 22 03:09:38 2015
@@ -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:
More information about the llvm-commits
mailing list