aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2007-08-14 08:04:47 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2007-08-14 08:04:47 +0000
commit3fec76aafa7293906969f7b6c96e8bcecc88f9d0 (patch)
tree49db76a661dac41eab268d67a539ae2043fa54f7 /bfd
parentac3eeb49116dbc3d917cf431b31816aab7aa129b (diff)
downloadgdb-3fec76aafa7293906969f7b6c96e8bcecc88f9d0.zip
gdb-3fec76aafa7293906969f7b6c96e8bcecc88f9d0.tar.gz
gdb-3fec76aafa7293906969f7b6c96e8bcecc88f9d0.tar.bz2
2007-08-14 Jan Kratochvil <jan.kratochvil@redhat.com>
* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): LOADBASE is now initialized only on the first PT_LOAD. New variable LOADBASE_SET. Removed PF_R checking for IA-64 vDSOs as redundant now. Code advisory: Roland McGrath
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elfcode.h22
2 files changed, 19 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index da56f36..33e7871 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2007-08-14 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): LOADBASE is now
+ initialized only on the first PT_LOAD. New variable LOADBASE_SET.
+ Removed PF_R checking for IA-64 vDSOs as redundant now.
+ Code advisory: Roland McGrath
+
2007-08-13 Richard Sandiford <richard@codesourcery.com>
* elfxx-mips.c (mips_elf_link_hash_table): Add computed_got_sizes.
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index e16f579..e1f5801 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1635,6 +1635,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
int err;
unsigned int i;
bfd_vma loadbase;
+ bfd_boolean loadbase_set;
/* Read in the ELF header in external format. */
err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr, sizeof x_ehdr);
@@ -1711,13 +1712,11 @@ NAME(_bfd_elf,bfd_from_remote_memory)
contents_size = 0;
last_phdr = NULL;
loadbase = ehdr_vma;
+ loadbase_set = FALSE;
for (i = 0; i < i_ehdr.e_phnum; ++i)
{
elf_swap_phdr_in (templ, &x_phdrs[i], &i_phdrs[i]);
- /* IA-64 vDSO may have two mappings for one segment, where one mapping
- is executable only, and one is read only. We must not use the
- executable one. */
- if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R))
+ if (i_phdrs[i].p_type == PT_LOAD)
{
bfd_vma segment_end;
segment_end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
@@ -1725,8 +1724,14 @@ NAME(_bfd_elf,bfd_from_remote_memory)
if (segment_end > (bfd_vma) contents_size)
contents_size = segment_end;
- if ((i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0)
- loadbase = ehdr_vma - (i_phdrs[i].p_vaddr & -i_phdrs[i].p_align);
+ /* LOADADDR is the `Base address' from the gELF specification:
+ `lowest p_vaddr value for a PT_LOAD segment' is P_VADDR from the
+ first PT_LOAD as PT_LOADs are ordered by P_VADDR. */
+ if (!loadbase_set && (i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0)
+ {
+ loadbase = ehdr_vma - (i_phdrs[i].p_vaddr & -i_phdrs[i].p_align);
+ loadbase_set = TRUE;
+ }
last_phdr = &i_phdrs[i];
}
@@ -1764,10 +1769,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
}
for (i = 0; i < i_ehdr.e_phnum; ++i)
- /* IA-64 vDSO may have two mappings for one segment, where one mapping
- is executable only, and one is read only. We must not use the
- executable one. */
- if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R))
+ if (i_phdrs[i].p_type == PT_LOAD)
{
bfd_vma start = i_phdrs[i].p_offset & -i_phdrs[i].p_align;
bfd_vma end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz