summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikola Veljkovic <Nikola.Veljkovic@imgtec.com>2014-12-25 20:08:00 (GMT)
committerRaghu Gandham <raghu.gandham@imgtec.com>2014-12-25 20:08:00 (GMT)
commit51d71fd2cc99f309cb792cc48ae910baeb92b2a0 (patch)
treeb7dfbc2409753a9cc06784ca0940697a05d347ce
parentb3e9a4171187f64c03d1858c2c840113df6b02de (diff)
downloadtoolchain_binutils-51d71fd2cc99f309cb792cc48ae910baeb92b2a0.zip
toolchain_binutils-51d71fd2cc99f309cb792cc48ae910baeb92b2a0.tar.gz
toolchain_binutils-51d71fd2cc99f309cb792cc48ae910baeb92b2a0.tar.bz2
Add support for the new tag DT_MIPS_RLD_MAP2.
DT_MIPS_RLD_MAP2 is used by the loader to communicate shared library information of a PIE to the GDB. Signed-off-by: Raghu Gandham <raghu.gandham@imgtec.com>
-rw-r--r--binutils-2.25/bfd/elfxx-mips.c33
-rw-r--r--binutils-2.25/binutils/readelf.c1
-rw-r--r--binutils-2.25/include/elf/mips.h3
3 files changed, 34 insertions, 3 deletions
diff --git a/binutils-2.25/bfd/elfxx-mips.c b/binutils-2.25/bfd/elfxx-mips.c
index 2bd45d2..200dae8 100644
--- a/binutils-2.25/bfd/elfxx-mips.c
+++ b/binutils-2.25/bfd/elfxx-mips.c
@@ -7622,7 +7622,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
htab->sstubs = s;
if (!mips_elf_hash_table (info)->use_rld_obj_head
- && !info->shared
+ && info->executable
&& bfd_get_linker_section (abfd, ".rld_map") == NULL)
{
s = bfd_make_section_anyway_with_flags (abfd, ".rld_map",
@@ -7686,7 +7686,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
(void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
}
- if (!info->shared)
+ if (info->executable)
{
const char *name;
@@ -9727,7 +9727,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
info->combreloc = 0;
}
}
- else if (! info->shared
+ else if (info->executable
&& ! mips_elf_hash_table (info)->use_rld_obj_head
&& CONST_STRNEQ (name, ".rld_map"))
{
@@ -9790,6 +9790,10 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
return FALSE;
+ if (info->executable
+ && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP2, 0))
+ return FALSE;
+
/* The DT_DEBUG entry may be filled in by the dynamic linker and
used by the debugger. */
if (info->executable
@@ -11501,6 +11505,27 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
}
break;
+ case DT_MIPS_RLD_MAP2:
+ {
+ struct elf_link_hash_entry *h;
+ bfd_vma dt_addr, rld_addr;
+ h = mips_elf_hash_table (info)->rld_symbol;
+ if (!h)
+ {
+ dyn_to_skip = MIPS_ELF_DYN_SIZE (dynobj);
+ swap_out_p = FALSE;
+ break;
+ }
+ s = h->root.u.def.section;
+
+ dt_addr = (sdyn->output_section->vma + sdyn->output_offset
+ + b - sdyn->contents);
+ rld_addr = (s->output_section->vma + s->output_offset
+ + h->root.u.def.value);
+ dyn.d_un.d_ptr = rld_addr - dt_addr;
+ }
+ break;
+
case DT_MIPS_OPTIONS:
s = (bfd_get_section_by_name
(output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd)));
@@ -15418,6 +15443,8 @@ _bfd_mips_elf_get_target_dtag (bfd_vma dtag)
return "MIPS_HIPAGENO";
case DT_MIPS_RLD_MAP:
return "MIPS_RLD_MAP";
+ case DT_MIPS_RLD_MAP2:
+ return "MIPS_RLD_MAP2";
case DT_MIPS_DELTA_CLASS:
return "MIPS_DELTA_CLASS";
case DT_MIPS_DELTA_CLASS_NO:
diff --git a/binutils-2.25/binutils/readelf.c b/binutils-2.25/binutils/readelf.c
index 997b463..d630684 100644
--- a/binutils-2.25/binutils/readelf.c
+++ b/binutils-2.25/binutils/readelf.c
@@ -1618,6 +1618,7 @@ get_mips_dynamic_type (unsigned long type)
case DT_MIPS_GOTSYM: return "MIPS_GOTSYM";
case DT_MIPS_HIPAGENO: return "MIPS_HIPAGENO";
case DT_MIPS_RLD_MAP: return "MIPS_RLD_MAP";
+ case DT_MIPS_RLD_MAP2: return "MIPS_RLD_MAP2";
case DT_MIPS_DELTA_CLASS: return "MIPS_DELTA_CLASS";
case DT_MIPS_DELTA_CLASS_NO: return "MIPS_DELTA_CLASS_NO";
case DT_MIPS_DELTA_INSTANCE: return "MIPS_DELTA_INSTANCE";
diff --git a/binutils-2.25/include/elf/mips.h b/binutils-2.25/include/elf/mips.h
index a76dae7..f3589ff 100644
--- a/binutils-2.25/include/elf/mips.h
+++ b/binutils-2.25/include/elf/mips.h
@@ -748,6 +748,9 @@ extern void bfd_mips_elf32_swap_reginfo_out
/* Points to the base of a writable PLT. */
#define DT_MIPS_RWPLT 0x70000034
+
+/* Address of run time loader map, used for debugging. */
+#define DT_MIPS_RLD_MAP2 0x70000035
/* Flags which may appear in a DT_MIPS_FLAGS entry. */