[Mips] Implement definition of the DT_MIPS_RLD_MAP_REL dynamic tag

llvm-svn: 243835
This commit is contained in:
Simon Atanasyan 2015-08-01 14:53:49 +00:00
parent 3644ee4aa8
commit 7a400d9af4
6 changed files with 21 additions and 9 deletions

View File

@ -31,8 +31,10 @@ public:
this->addEntry(DT_MIPS_RLD_VERSION, 1);
// The .rld_map section address.
if (this->_ctx.isDynamic() && this->_ctx.getOutputELFType() == ET_EXEC)
if (this->_ctx.getOutputELFType() == ET_EXEC) {
_dt_rldmap = this->addEntry(DT_MIPS_RLD_MAP, 0);
_dt_rldmaprel = this->addEntry(DT_MIPS_RLD_MAP_REL, 0);
}
// MIPS flags.
this->addEntry(DT_MIPS_FLAGS, RHF_NOTPOT);
@ -83,8 +85,13 @@ public:
if (const auto *sec = _targetLayout.findOutputSection(".MIPS.options"))
this->_entries[_dt_options].d_un.d_ptr = sec->virtualAddr();
if (const auto *sec = _targetLayout.findOutputSection(".rld_map"))
if (const auto *sec = _targetLayout.findOutputSection(".rld_map")) {
this->_entries[_dt_rldmap].d_un.d_ptr = sec->virtualAddr();
this->_entries[_dt_rldmaprel].d_un.d_ptr =
sec->virtualAddr() -
(this->virtualAddr() +
_dt_rldmaprel * sizeof(typename DynamicTable<ELFT>::Elf_Dyn));
}
}
int64_t getGotPltTag() override { return DT_MIPS_PLTGOT; }
@ -107,6 +114,7 @@ private:
std::size_t _dt_baseaddr;
std::size_t _dt_options;
std::size_t _dt_rldmap;
std::size_t _dt_rldmaprel;
MipsTargetLayout<ELFT> &_targetLayout;
};

View File

@ -5,7 +5,7 @@
# RUN: lld -flavor gnu -target mips64el --noinhibit-exec -o %t.exe %t.o
# RUN: llvm-readobj -dynamic-table -program-headers %t.exe | FileCheck %s
# CHECK: DynamicSection [ (14 entries)
# CHECK: DynamicSection [ (15 entries)
# CHECK: Tag Type Name/Value
# CHECK-NEXT: 0x0000000000000004 HASH 0x{{[0-9A-F]+}}
# CHECK-NEXT: 0x0000000000000005 STRTAB 0x{{[0-9A-F]+}}
@ -14,6 +14,7 @@
# CHECK-NEXT: 0x000000000000000B SYMENT 24 (bytes)
# CHECK-NEXT: 0x0000000070000001 MIPS_RLD_VERSION 1
# CHECK-NEXT: 0x0000000070000016 MIPS_RLD_MAP 0x120002000
# CHECK-NEXT: 0x0000000070000035 MIPS_RLD_MAP_REL 0x1DB8
# CHECK-NEXT: 0x0000000070000005 MIPS_FLAGS NOTPOT
# CHECK-NEXT: 0x0000000070000006 MIPS_BASE_ADDRESS 0x120000000
# CHECK-NEXT: 0x000000007000000A MIPS_LOCAL_GOTNO 2

View File

@ -5,8 +5,8 @@
# RUN: lld -flavor gnu -target mipsel --noinhibit-exec -o %t.exe %t.o
# RUN: llvm-readobj -dynamic-table -program-headers %t.exe | FileCheck %s
# CHECK: DynamicSection [ (14 entries)
# CHECK: Tag Type Name/Value
# CHECK: DynamicSection [ (15 entries)
# CHECK: Tag Type Name/Value
# CHECK-NEXT: 0x00000004 HASH 0x{{[0-9A-F]+}}
# CHECK-NEXT: 0x00000005 STRTAB 0x{{[0-9A-F]+}}
# CHECK-NEXT: 0x00000006 SYMTAB 0x{{[0-9A-F]+}}
@ -14,6 +14,7 @@
# CHECK-NEXT: 0x0000000B SYMENT 16 (bytes)
# CHECK-NEXT: 0x70000001 MIPS_RLD_VERSION 1
# CHECK-NEXT: 0x70000016 MIPS_RLD_MAP 0x402000
# CHECK-NEXT: 0x70000035 MIPS_RLD_MAP_REL 0x1E9C
# CHECK-NEXT: 0x70000005 MIPS_FLAGS NOTPOT
# CHECK-NEXT: 0x70000006 MIPS_BASE_ADDRESS 0x400000
# CHECK-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 2

View File

@ -16,7 +16,7 @@
# EXE: Sections:
# EXE: Idx Name Size Address Type
# EXE: 6 .dynamic 00000070 00000000[[ADDR:[0-9a-f]+]]
# EXE: 6 .dynamic 00000078 00000000[[ADDR:[0-9a-f]+]]
# EXE: SYMBOL TABLE:
# EXE: [[ADDR]] g .dynamic 00000000 _DYNAMIC

View File

@ -13,7 +13,7 @@
# CHECK: Arch: mipsel
# CHECK: AddressSize: 32bit
# CHECK: LoadName:
# CHECK: DynamicSection [ (19 entries)
# CHECK: DynamicSection [ (20 entries)
# CHECK: Tag Type Name/Value
# CHECK-NEXT: 0x00000004 HASH 0x{{[0-9A-F]+}}
# CHECK-NEXT: 0x00000005 STRTAB 0x{{[0-9A-F]+}}
@ -26,6 +26,7 @@
# CHECK-NEXT: 0x00000017 JMPREL 0x{{[0-9A-F]+}}
# CHECK-NEXT: 0x70000001 MIPS_RLD_VERSION 1
# CHECK-NEXT: 0x70000016 MIPS_RLD_MAP 0x40200C
# CHECK-NEXT: 0x70000035 MIPS_RLD_MAP_REL 0x1E0C
# CHECK-NEXT: 0x70000005 MIPS_FLAGS NOTPOT
# CHECK-NEXT: 0x70000006 MIPS_BASE_ADDRESS 0x400000
# CHECK-NEXT: 0x7000000A MIPS_LOCAL_GOTNO 2

View File

@ -1,6 +1,6 @@
# REQUIRES: mips
# Check definition of DT_MIPS_RLD_MAP dynamic tag,
# Check definition of DT_MIPS_RLD_MAP and DT_MIPS_RLD_MAP_REL dynamic tags,
# .rld_map section, and __RLD_MAP symbol.
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
@ -25,7 +25,8 @@
# EXE-DYN-NEXT: Binding: Global
# EXE-DYN-NEXT: Type: Object
#
# EXE-DYN: 0x70000016 MIPS_RLD_MAP 0x402000
# EXE-DYN: 0x70000016 MIPS_RLD_MAP 0x[[ADDR]]
# EXE-DYN: 0x70000035 MIPS_RLD_MAP_REL 0x1E48
# RUN: lld -flavor gnu -target mips -static %t.o -o %t.exe
# RUN: llvm-nm -just-symbol-name %t.exe | FileCheck -check-prefix=EXE-STATIC %s