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);
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; }
std::size_t _dt_baseaddr;
std::size_t _dt_options;
std::size_t _dt_rldmap;
+ std::size_t _dt_rldmaprel;
MipsTargetLayout<ELFT> &_targetLayout;
};
# 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]+}}
# 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
# 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]+}}
# 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
# 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
# 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]+}}
# 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
# 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
# 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