summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2015-04-22 08:09:38 +0000
committerSimon Atanasyan <simon@atanasyan.com>2015-04-22 08:09:38 +0000
commit6668eb3c40b267b4fd58e1fa7bfe88d8da25ea8f (patch)
tree3b512c7fd0246ae1df596ef5ec26302d5542a9dc
parent5606dac67e0efe54957cb09e0383047d25c321e5 (diff)
downloadbcm5719-llvm-6668eb3c40b267b4fd58e1fa7bfe88d8da25ea8f.tar.gz
bcm5719-llvm-6668eb3c40b267b4fd58e1fa7bfe88d8da25ea8f.zip
[Mips] Assign .MIPS.options section to the PT_LOAD segment
llvm-svn: 235488
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h4
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h5
-rw-r--r--lld/test/elf/Mips/mips-options-02.test1
-rw-r--r--lld/test/elf/Mips/mips-options-gp0.test6
4 files changed, 10 insertions, 6 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h b/lld/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
index 9d3040701f7..3b5134511ef 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
@@ -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();
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h
index 36e74c246bc..735b98f1210 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h
@@ -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);
}
diff --git a/lld/test/elf/Mips/mips-options-02.test b/lld/test/elf/Mips/mips-options-02.test
index 8aa6e6e9169..bb01952dccc 100644
--- a/lld/test/elf/Mips/mips-options-02.test
+++ b/lld/test/elf/Mips/mips-options-02.test
@@ -39,7 +39,6 @@
# PHDR: Type: PT_LOAD
# PHDR-NOT: Type: PT_LOAD
# PHDR: Type: PT_DYNAMIC
-# PHDR: Type: PT_NOTE
# t1.o
---
diff --git a/lld/test/elf/Mips/mips-options-gp0.test b/lld/test/elf/Mips/mips-options-gp0.test
index c51239378f9..905b1847e65 100644
--- a/lld/test/elf/Mips/mips-options-gp0.test
+++ b/lld/test/elf/Mips/mips-options-gp0.test
@@ -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:
OpenPOWER on IntegriCloud