SHA256
1
0
forked from pool/binutils
OBS User unknown 2008-11-17 15:35:11 +00:00 committed by Git OBS Bridge
parent b79434a3e2
commit 1b9db9d036
35 changed files with 301 additions and 49 deletions

View File

@ -1,48 +1,181 @@
2008-11-11 Alan Modra <amodra@bigpond.net.au>
* elf.c (assign_file_positions_for_non_load_sections): Consolidate
PT_GNU_RELRO handling.
2008-11-07 Andreas Schwab <schwab@suse.de>
PR 7011
* elf.c (assign_file_positions_for_non_load_sections): Handle
PT_GNU_RELRO that covers only a part of a single section.
PT_GNU_RELRO specially.
--- bfd/elf.c.~1.466.~ 2008-10-09 11:07:35.000000000 +0200
+++ bfd/elf.c 2008-11-07 11:32:56.000000000 +0100
@@ -4631,7 +4631,9 @@ assign_file_positions_for_non_load_secti
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.466
retrieving revision 1.468
diff -u -a -p -u -p -a -r1.466 -r1.468
--- bfd/elf.c 8 Oct 2008 08:30:27 -0000 1.466
+++ bfd/elf.c 11 Nov 2008 04:26:13 -0000 1.468
@@ -4631,7 +4631,61 @@ assign_file_positions_for_non_load_secti
m != NULL;
m = m->next, p++)
{
- if (m->count != 0)
+ if (m->count != 0
+ /* Always handle PT_GNU_RELRO here if not linking. */
+ || (p->p_type == PT_GNU_RELRO && link_info == NULL))
+ if (p->p_type == PT_GNU_RELRO)
+ {
+ const Elf_Internal_Phdr *lp;
+
+ BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs);
+
+ if (link_info != NULL)
+ {
+ /* During linking the range of the RELRO segment is passed
+ in link_info. */
+ for (lp = phdrs; lp < phdrs + count; ++lp)
+ {
+ if (lp->p_type == PT_LOAD
+ && lp->p_vaddr >= link_info->relro_start
+ && lp->p_vaddr < link_info->relro_end
+ && lp->p_vaddr + lp->p_filesz >= link_info->relro_end)
+ break;
+ }
+ }
+ else
+ {
+ /* Otherwise we are copying an executable or shared
+ library, but we need to use the same linker logic. */
+ for (lp = phdrs; lp < phdrs + count; ++lp)
+ {
+ if (lp->p_type == PT_LOAD
+ && lp->p_paddr == p->p_paddr)
+ break;
+ }
+ }
+
+ if (lp < phdrs + count)
+ {
+ p->p_vaddr = lp->p_vaddr;
+ p->p_paddr = lp->p_paddr;
+ p->p_offset = lp->p_offset;
+ if (link_info != NULL)
+ p->p_filesz = link_info->relro_end - lp->p_vaddr;
+ else if (m->p_size_valid)
+ p->p_filesz = m->p_size;
+ else
+ abort ();
+ p->p_memsz = p->p_filesz;
+ p->p_align = 1;
+ p->p_flags = (lp->p_flags & ~PF_W);
+ }
+ else if (link_info != NULL)
+ {
+ memset (p, 0, sizeof *p);
+ p->p_type = PT_NULL;
+ }
+ else
+ abort ();
+ }
+ else if (m->count != 0)
{
if (p->p_type != PT_LOAD
&& (p->p_type != PT_NOTE
@@ -4642,12 +4644,6 @@ assign_file_positions_for_non_load_secti
BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs);
- sect = m->sections[m->count - 1];
- hdr = &elf_section_data (sect)->this_hdr;
- p->p_filesz = sect->filepos - m->sections[0]->filepos;
- if (hdr->sh_type != SHT_NOBITS)
- p->p_filesz += hdr->sh_size;
@@ -4647,87 +4701,20 @@ assign_file_positions_for_non_load_secti
p->p_filesz = sect->filepos - m->sections[0]->filepos;
if (hdr->sh_type != SHT_NOBITS)
p->p_filesz += hdr->sh_size;
-
if (p->p_type == PT_GNU_RELRO)
{
/* When we get here, we are copying executable
@@ -4680,7 +4676,14 @@ assign_file_positions_for_non_load_secti
abort ();
}
else
- if (p->p_type == PT_GNU_RELRO)
- {
- /* When we get here, we are copying executable
- or shared library. But we need to use the same
- linker logic. */
- Elf_Internal_Phdr *lp;
-
- for (lp = phdrs; lp < phdrs + count; ++lp)
- {
- if (lp->p_type == PT_LOAD
- && lp->p_paddr == p->p_paddr)
- break;
- }
-
- if (lp < phdrs + count)
- {
- /* We should use p_size if it is valid since it
- may contain the first few bytes of the next
- SEC_ALLOC section. */
- if (m->p_size_valid)
- p->p_filesz = m->p_size;
- else
- abort ();
- p->p_vaddr = lp->p_vaddr;
- p->p_offset = lp->p_offset;
- p->p_memsz = p->p_filesz;
- p->p_align = 1;
- }
- else
- abort ();
- }
- else
- p->p_offset = m->sections[0]->filepos;
+ {
+ sect = m->sections[m->count - 1];
+ hdr = &elf_section_data (sect)->this_hdr;
+ p->p_filesz = sect->filepos - m->sections[0]->filepos;
+ if (hdr->sh_type != SHT_NOBITS)
+ p->p_filesz += hdr->sh_size;
+ p->p_offset = m->sections[0]->filepos;
+ }
+ p->p_offset = m->sections[0]->filepos;
}
}
else
- else
+ else if (m->includes_filehdr)
{
- if (m->includes_filehdr)
- {
- p->p_vaddr = filehdr_vaddr;
- if (! m->p_paddr_valid)
- p->p_paddr = filehdr_paddr;
- }
- else if (m->includes_phdrs)
- {
- p->p_vaddr = phdrs_vaddr;
- if (! m->p_paddr_valid)
- p->p_paddr = phdrs_paddr;
- }
- else if (p->p_type == PT_GNU_RELRO)
- {
- Elf_Internal_Phdr *lp;
-
- for (lp = phdrs; lp < phdrs + count; ++lp)
- {
- if (lp->p_type == PT_LOAD
- && lp->p_vaddr <= link_info->relro_end
- && lp->p_vaddr >= link_info->relro_start
- && (lp->p_vaddr + lp->p_filesz
- >= link_info->relro_end))
- break;
- }
-
- if (lp < phdrs + count
- && link_info->relro_end > lp->p_vaddr)
- {
- p->p_vaddr = lp->p_vaddr;
- p->p_paddr = lp->p_paddr;
- p->p_offset = lp->p_offset;
- p->p_filesz = link_info->relro_end - lp->p_vaddr;
- p->p_memsz = p->p_filesz;
- p->p_align = 1;
- p->p_flags = (lp->p_flags & ~PF_W);
- }
- else
- {
- memset (p, 0, sizeof *p);
- p->p_type = PT_NULL;
- }
- }
+ p->p_vaddr = filehdr_vaddr;
+ if (! m->p_paddr_valid)
+ p->p_paddr = filehdr_paddr;
+ }
+ else if (m->includes_phdrs)
+ {
+ p->p_vaddr = phdrs_vaddr;
+ if (! m->p_paddr_valid)
+ p->p_paddr = phdrs_paddr;
}
}

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -466,6 +466,8 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/lib*.a
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-alpha-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-arm-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-avr-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-hppa-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-hppa64-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-i386-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-ia64-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-mips-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-ppc-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-ppc64-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-s390-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-s390x-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-sh4-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -393,6 +393,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-sparc-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-spu-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 10 15:29:56 CET 2008 - schwab@suse.de
- Update last change.
-------------------------------------------------------------------
Fri Nov 7 11:41:37 CET 2008 - schwab@suse.de

View File

@ -20,7 +20,7 @@
Name: cross-x86_64-binutils
BuildRequires: bison dejagnu flex gcc-c++ zlib-devel
Version: 2.19
Release: 3
Release: 4
#
# RUN_TESTS
%define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
@ -394,6 +394,8 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Mon Nov 10 2008 schwab@suse.de
- Update last change.
* Fri Nov 07 2008 schwab@suse.de
- Fix crash in strip.
* Thu Nov 06 2008 rguenther@suse.de