- Remove the kernel VDSO workaround (`no loadable ...') (kernel BZ 312011).

This commit is contained in:
Jan Kratochvil 2008-04-27 20:28:26 +00:00
parent c499105421
commit 17a4f25e9f
3 changed files with 3 additions and 92 deletions

View File

@ -1,80 +0,0 @@
2007-09-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New variables
X_SHDR_SHSTRTAB and I_SHDR_SHSTRTAB. Fixed the CONTENTS_SIZE trimming
check for its aligned size between the last segment and still before
the section header end. Added variables check to cover also the
section header string table.
--- ./bfd/elfcode.h 14 Aug 2007 08:04:47 -0000 1.86
+++ ./bfd/elfcode.h 23 Sep 2007 14:24:39 -0000
@@ -1628,6 +1628,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
Elf_External_Phdr *x_phdrs;
Elf_Internal_Phdr *i_phdrs, *last_phdr;
+ Elf_External_Shdr *x_shdr_shstrtab;
+ Elf_Internal_Shdr *i_shdr_shstrtab;
bfd *nbfd;
struct bfd_in_memory *bim;
int contents_size;
@@ -1746,19 +1748,49 @@ NAME(_bfd_elf,bfd_from_remote_memory)
/* Trim the last segment so we don't bother with zeros in the last page
that are off the end of the file. However, if the extra bit in that
- page includes the section headers, keep them. */
- if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz
- && (bfd_vma) contents_size >= (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
- {
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
- contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
- }
- else
+ page includes the section headers os the section header string table,
+ keep them. */
+ if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz)
contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+ if ((bfd_vma) contents_size < i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize)
+ contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
+
+ /* Section header string table is usually before the section headers
+ so this check is here has usually no effect. */
+ if (i_ehdr.e_shstrndx < i_ehdr.e_shnum)
+ {
+ x_shdr_shstrtab = bfd_malloc (sizeof *x_shdr_shstrtab
+ + sizeof *i_shdr_shstrtab);
+ if (x_shdr_shstrtab == NULL)
+ {
+ free (x_phdrs);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+ err = target_read_memory (ehdr_vma + i_ehdr.e_shoff
+ + i_ehdr.e_shstrndx * sizeof *x_shdr_shstrtab,
+ (bfd_byte *) x_shdr_shstrtab,
+ sizeof *x_shdr_shstrtab);
+ if (err)
+ {
+ free (x_shdr_shstrtab);
+ free (x_phdrs);
+ bfd_set_error (bfd_error_system_call);
+ errno = err;
+ return NULL;
+ }
+ i_shdr_shstrtab = (Elf_Internal_Shdr *) &x_shdr_shstrtab[1];
+ elf_swap_shdr_in (templ, x_shdr_shstrtab, i_shdr_shstrtab);
+
+ if ((bfd_vma) contents_size < i_shdr_shstrtab->sh_offset
+ + i_shdr_shstrtab->sh_size)
+ contents_size = i_shdr_shstrtab->sh_offset + i_shdr_shstrtab->sh_size;
+
+ free (x_shdr_shstrtab);
+ }
+
/* Now we know the size of the whole image we want read in. */
contents = bfd_zmalloc (contents_size);
if (contents == NULL)

View File

@ -112,11 +112,3 @@ Index: gdb-6.7/gdb/symfile.c
}
}
@@ -1174,7 +1196,6 @@ symbol_file_add_from_bfd (bfd *abfd, int
mainline, flags);
}
-
/* Process a symbol file, as either the main file or as a dynamically
loaded file. See symbol_file_add_with_addrs_or_offsets's comments
for details. */

View File

@ -288,9 +288,6 @@ Patch266: gdb-6.6-bz247354-leader-exit-test.patch
# New locating of the matching binaries from the pure core file (build-id).
Patch274: gdb-6.6-buildid-locate.patch
# Fixed the kernel 8KB VDSO loading (producing `no loadable sections found').
Patch276: gdb-6.6-bfd-vdso8k.patch
# Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section in').
Patch277: gdb-6.6-vdso-i386-on-amd64-warning.patch
@ -504,7 +501,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch266 -p1
%patch274 -p1
%patch275 -p1
%patch276 -p1
%patch277 -p1
%patch280 -p1
%patch282 -p1
@ -768,6 +764,9 @@ fi
%{_mandir}/*/gdbserver.1*
%changelog
* Sun Apr 27 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-5
- Remove the kernel VDSO workaround (`no loadable ...') (kernel BZ 312011).
* Wed Apr 23 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-4
- Backport fix on various forms of threads tracking across exec() (BZ 442765).
- Testsuite: Include more biarch libraries on %%{multilib_64_archs}.