diff options
Diffstat (limited to 'patches/binutils-2.18/generic/gentoo')
18 files changed, 0 insertions, 1503 deletions
diff --git a/patches/binutils-2.18/generic/gentoo/03_all_binutils-2.15.92.0.2-ppc64-pie.patch b/patches/binutils-2.18/generic/gentoo/03_all_binutils-2.15.92.0.2-ppc64-pie.patch deleted file mode 100644 index 03816d2..0000000 --- a/patches/binutils-2.18/generic/gentoo/03_all_binutils-2.15.92.0.2-ppc64-pie.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- - bfd/elf64-ppc.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -Index: binutils-2.18/bfd/elf64-ppc.c -=================================================================== ---- binutils-2.18.orig/bfd/elf64-ppc.c -+++ binutils-2.18/bfd/elf64-ppc.c -@@ -10979,7 +10979,12 @@ ppc64_elf_relocate_section (bfd *output_ - else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf) - && !is_opd - && r_type != R_PPC64_TOC) -- outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type); -+ { -+ outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type); -+ if (h->elf.dynindx == -1 -+ && h->elf.root.type == bfd_link_hash_undefweak) -+ memset (&outrel, 0, sizeof outrel); -+ } - else - { - /* This symbol is local, or marked to become local, diff --git a/patches/binutils-2.18/generic/gentoo/04_all_binutils-2.15.92.0.2-place-orphan.patch b/patches/binutils-2.18/generic/gentoo/04_all_binutils-2.15.92.0.2-place-orphan.patch deleted file mode 100644 index cfc9b05..0000000 --- a/patches/binutils-2.18/generic/gentoo/04_all_binutils-2.15.92.0.2-place-orphan.patch +++ /dev/null @@ -1,22 +0,0 @@ -2003-08-05 Jakub Jelinek <jakub@redhat.com> - - * emulparams/elf64ppc.sh (OTHER_GOT_RELOC_SECTIONS): Add .rela.opd. - ---- - ld/emulparams/elf64ppc.sh | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -Index: binutils-2.18/ld/emulparams/elf64ppc.sh -=================================================================== ---- binutils-2.18.orig/ld/emulparams/elf64ppc.sh -+++ binutils-2.18/ld/emulparams/elf64ppc.sh -@@ -28,7 +28,8 @@ else - .toc 0 : { *(.toc) }" - fi - OTHER_GOT_RELOC_SECTIONS=" -- .rela.toc ${RELOCATING-0} : { *(.rela.toc) }" -+ .rela.toc ${RELOCATING-0} : { *(.rela.toc) } -+ .rela.opd ${RELOCATING-0} : { *(.rela.opd) }" - OTHER_READWRITE_SECTIONS=" - .toc1 ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) } - .opd ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { KEEP (*(.opd)) } diff --git a/patches/binutils-2.18/generic/gentoo/07_all_binutils-2.18-windres.patch b/patches/binutils-2.18/generic/gentoo/07_all_binutils-2.18-windres.patch deleted file mode 100644 index 476aefd..0000000 --- a/patches/binutils-2.18/generic/gentoo/07_all_binutils-2.18-windres.patch +++ /dev/null @@ -1,19 +0,0 @@ -http://sourceware.org/bugzilla/show_bug.cgi?id=4987 - ---- - binutils/resrc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: binutils-2.18/binutils/resrc.c -=================================================================== ---- binutils-2.18.orig/binutils/resrc.c -+++ binutils-2.18/binutils/resrc.c -@@ -437,7 +437,7 @@ read_rc_file (const char *filename, cons - const char *fnquotes = (filename_need_quotes (filename) ? "\"" : ""); - - /* Setup the default resource import path taken from input file. */ -- if (strchr (filename, '/') != NULL || strchr (filename, '\\') != NULL) -+ if (filename != NULL && (strchr (filename, '/') != NULL || strchr (filename, '\\') != NULL)) - { - char *e, *c; - diff --git a/patches/binutils-2.18/generic/gentoo/08_all_binutils-RPATH_ENVVAR-smack.patch b/patches/binutils-2.18/generic/gentoo/08_all_binutils-RPATH_ENVVAR-smack.patch deleted file mode 100644 index 7180b94..0000000 --- a/patches/binutils-2.18/generic/gentoo/08_all_binutils-RPATH_ENVVAR-smack.patch +++ /dev/null @@ -1,19 +0,0 @@ -http://sourceware.org/ml/binutils/2007-07/msg00401.html -http://sourceware.org/bugzilla/show_bug.cgi?id=4970 - ---- - configure | 1 + - 1 file changed, 1 insertion(+) - -Index: binutils-2.18/configure -=================================================================== ---- binutils-2.18.orig/configure -+++ binutils-2.18/configure -@@ -5369,6 +5369,7 @@ case "${host}" in - *-*-darwin* | *-*-rhapsody* ) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;; - *) RPATH_ENVVAR=LD_LIBRARY_PATH ;; - esac -+RPATH_ENVVAR="cant_touch_this_nah_nah_nah" - - # Record target_configdirs and the configure arguments for target and - # build configuration in Makefile. diff --git a/patches/binutils-2.18/generic/gentoo/09_all_binutils-ld-tests-CXXFLAGS.patch b/patches/binutils-2.18/generic/gentoo/09_all_binutils-ld-tests-CXXFLAGS.patch deleted file mode 100644 index 93ce802..0000000 --- a/patches/binutils-2.18/generic/gentoo/09_all_binutils-ld-tests-CXXFLAGS.patch +++ /dev/null @@ -1,75 +0,0 @@ -http://sourceware.org/ml/binutils/2007-08/msg00411.html - -forcing CFLAGS against C++ builds causes false failures - ---- - ld/testsuite/lib/ld-lib.exp | 21 ++++++++++++++++++--- - 1 file changed, 18 insertions(+), 3 deletions(-) - -Index: binutils-2.18/ld/testsuite/lib/ld-lib.exp -=================================================================== ---- binutils-2.18.orig/ld/testsuite/lib/ld-lib.exp -+++ binutils-2.18/ld/testsuite/lib/ld-lib.exp -@@ -206,6 +206,7 @@ proc default_ld_simple_link { ld target - # - proc default_ld_compile { cc source object } { - global CFLAGS -+ global CXXFLAGS - global srcdir - global subdir - global host_triplet -@@ -222,7 +223,11 @@ proc default_ld_compile { cc source obje - - catch "exec rm -f $object" exec_output - -- set flags "-I$srcdir/$subdir $CFLAGS" -+ if {[string match "*.cc" $source]} then { -+ set flags "-I$srcdir/$subdir $CXXFLAGS" -+ } else { -+ set flags "-I$srcdir/$subdir $CFLAGS" -+ } - - # If we are compiling with gcc, we want to add gcc_gas_flag to - # flags. Rather than determine this in some complex way, we guess -@@ -1282,6 +1287,7 @@ proc run_ld_link_exec_tests { targets_to - global CC - global CXX - global CFLAGS -+ global CXXFLAGS - global errcnt - global exec_output - -@@ -1316,7 +1322,11 @@ proc run_ld_link_exec_tests { targets_to - # We ignore warnings since some compilers may generate - # incorrect section attributes and the assembler will warn - # them. -- ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile -+ if { [ string match "c++" $lang ] } { -+ ld_compile "$CXX -c $CXXFLAGS $cflags" $srcdir/$subdir/$src_file $objfile -+ } else { -+ ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile -+ } - - # We have to use $CC to build PIE and shared library. - if { [ string match "c" $lang ] } { -@@ -1408,6 +1418,7 @@ proc run_cc_link_tests { ldtests } { - global CC - global CXX - global CFLAGS -+ global CXXFLAGS - - foreach testitem $ldtests { - set testname [lindex $testitem 0] -@@ -1429,7 +1440,11 @@ proc run_cc_link_tests { ldtests } { - # We ignore warnings since some compilers may generate - # incorrect section attributes and the assembler will warn - # them. -- ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile -+ if { [ string match "c++" $lang ] } { -+ ld_compile "$CXX -c $CXXFLAGS $cflags" $srcdir/$subdir/$src_file $objfile -+ } else { -+ ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile -+ } - } - - # Clear error and warning counts. diff --git a/patches/binutils-2.18/generic/gentoo/12_all_sh-targets.patch b/patches/binutils-2.18/generic/gentoo/12_all_sh-targets.patch deleted file mode 100644 index 21c2e8f..0000000 --- a/patches/binutils-2.18/generic/gentoo/12_all_sh-targets.patch +++ /dev/null @@ -1,56 +0,0 @@ -r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines - -Likewise, binutils has no idea about any of these new targets either, so we -fix that up too.. now we're able to actually build a real toolchain for -sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more -inept targets than that one, really. Go look, I promise). - ---- - configure | 4 ++-- - configure.ac | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -Index: binutils-2.18/configure -=================================================================== ---- binutils-2.18.orig/configure -+++ binutils-2.18/configure -@@ -2206,7 +2206,7 @@ case "${target}" in - am33_2.0-*-linux*) - noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" - ;; -- sh-*-linux*) -+ sh*-*-linux*) - noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" - ;; - sh*-*-pe|mips*-*-pe|*arm-wince-pe) -@@ -2504,7 +2504,7 @@ case "${target}" in - romp-*-*) - noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}" - ;; -- sh-*-* | sh64-*-*) -+ sh*-*-* | sh64-*-*) - case "${host}" in - i[3456789]86-*-vsta) ;; # don't add gprof back in - i[3456789]86-*-go32*) ;; # don't add gprof back in -Index: binutils-2.18/configure.ac -=================================================================== ---- binutils-2.18.orig/configure.ac -+++ binutils-2.18/configure.ac -@@ -484,7 +484,7 @@ case "${target}" in - am33_2.0-*-linux*) - noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" - ;; -- sh-*-linux*) -+ sh*-*-linux*) - noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" - ;; - sh*-*-pe|mips*-*-pe|*arm-wince-pe) -@@ -782,7 +782,7 @@ case "${target}" in - romp-*-*) - noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}" - ;; -- sh-*-* | sh64-*-*) -+ sh*-*-* | sh64-*-*) - case "${host}" in - i[[3456789]]86-*-vsta) ;; # don't add gprof back in - i[[3456789]]86-*-go32*) ;; # don't add gprof back in diff --git a/patches/binutils-2.18/generic/gentoo/18_all_binutils-makeinfo-version.patch b/patches/binutils-2.18/generic/gentoo/18_all_binutils-makeinfo-version.patch deleted file mode 100644 index bdbc340..0000000 --- a/patches/binutils-2.18/generic/gentoo/18_all_binutils-makeinfo-version.patch +++ /dev/null @@ -1,38 +0,0 @@ -http://bugs.gentoo.org/195074 - -2007-09-15 Alan Modra <amodra@bigpond.net.au> - - * configure.ac: Correct makeinfo version check. - * configure: Regenerate. - ---- - configure | 2 +- - configure.ac | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -Index: binutils-2.18/configure.ac -=================================================================== ---- binutils-2.18.orig/configure.ac -+++ binutils-2.18/configure.ac -@@ -2403,7 +2403,7 @@ changequote(,) - # For an installed makeinfo, we require it to be from texinfo 4.4 or - # higher, else we use the "missing" dummy. - if ${MAKEINFO} --version \ -- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then -+ | egrep 'texinfo[^0-9]*(4\.([4-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then - : - else - MAKEINFO="$MISSING makeinfo" -Index: binutils-2.18/configure -=================================================================== ---- binutils-2.18.orig/configure -+++ binutils-2.18/configure -@@ -6129,7 +6129,7 @@ case " $build_configdirs " in - # For an installed makeinfo, we require it to be from texinfo 4.4 or - # higher, else we use the "missing" dummy. - if ${MAKEINFO} --version \ -- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then -+ | egrep 'texinfo[^0-9]*(4\.([4-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then - : - else - MAKEINFO="$MISSING makeinfo" diff --git a/patches/binutils-2.18/generic/gentoo/25_all_binutils-for-build-flags.patch b/patches/binutils-2.18/generic/gentoo/25_all_binutils-for-build-flags.patch deleted file mode 100644 index 8c2cf03..0000000 --- a/patches/binutils-2.18/generic/gentoo/25_all_binutils-for-build-flags.patch +++ /dev/null @@ -1,23 +0,0 @@ -only default CFLAGS_FOR_BUILD to host CFLAGS when build and host are the same - -http://bugs.gentoo.org/192959 - ---- - configure | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -Index: binutils-2.18/configure -=================================================================== ---- binutils-2.18.orig/configure -+++ binutils-2.18/configure -@@ -5778,7 +5778,9 @@ esac - - # Allow the user to override the flags for - # our build compiler if desired. --CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}} -+if test x"${build}" = x"${host}" ; then -+ CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}} -+fi - - # On Canadian crosses, we'll be searching the right directories for - # the previously-installed cross compiler, so don't bother to add diff --git a/patches/binutils-2.18/generic/gentoo/30_all_binutils-multitarget-fixup.patch b/patches/binutils-2.18/generic/gentoo/30_all_binutils-multitarget-fixup.patch deleted file mode 100644 index ff815e1..0000000 --- a/patches/binutils-2.18/generic/gentoo/30_all_binutils-multitarget-fixup.patch +++ /dev/null @@ -1,234 +0,0 @@ -Fix from upstream for --enable-targets=all on an x86_64 multilib system. - -http://sourceware.org/ml/binutils/2007-09/msg00137.html -http://sourceware.org/ml/binutils/2007-09/msg00162.html - -2007-09-14 Alan Modra <amodra@bigpond.net.au> - - * format.c (bfd_check_format_matches): Record matching targets even - when "matching" is NULL to allow bfd_associated_vector matches. - Consolidate error return code. Consolidate ok return code. Always - restore original target and format on error. - ---- - bfd/format.c | 112 ++++++++++++++++++----------------------------------------- - 1 file changed, 35 insertions(+), 77 deletions(-) - -Index: binutils-2.18/bfd/format.c -=================================================================== ---- binutils-2.18.orig/bfd/format.c -+++ binutils-2.18/bfd/format.c -@@ -125,6 +125,9 @@ bfd_check_format_matches (bfd *abfd, bfd - int match_count; - int ar_match_index; - -+ if (matching != NULL) -+ *matching = NULL; -+ - if (!bfd_read_p (abfd) - || (unsigned int) abfd->format >= (unsigned int) bfd_type_end) - { -@@ -141,11 +144,10 @@ bfd_check_format_matches (bfd *abfd, bfd - match_count = 0; - ar_match_index = _bfd_target_vector_entries; - -- if (matching) -+ if (matching != NULL || *bfd_associated_vector != NULL) - { - bfd_size_type amt; - -- *matching = NULL; - amt = sizeof (*matching_vector) * 2 * _bfd_target_vector_entries; - matching_vector = bfd_malloc (amt); - if (!matching_vector) -@@ -162,31 +164,12 @@ bfd_check_format_matches (bfd *abfd, bfd - if (!abfd->target_defaulted) - { - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */ -- { -- if (matching) -- free (matching_vector); -- return FALSE; -- } -+ goto err_ret; - - right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); - - if (right_targ) -- { -- abfd->xvec = right_targ; /* Set the target as returned. */ -- -- if (matching) -- free (matching_vector); -- -- /* If the file was opened for update, then `output_has_begun' -- some time ago when the file was created. Do not recompute -- sections sizes or alignments in _bfd_set_section_contents. -- We can not set this flag until after checking the format, -- because it will interfere with creation of BFD sections. */ -- if (abfd->direction == both_direction) -- abfd->output_has_begun = TRUE; -- -- return TRUE; /* File position has moved, BTW. */ -- } -+ goto ok_ret; - - /* For a long time the code has dropped through to check all - targets if the specified target was wrong. I don't know why, -@@ -201,17 +184,7 @@ bfd_check_format_matches (bfd *abfd, bfd - this sort, I changed this test to check only for the binary - target. */ - if (format == bfd_archive && save_targ == &binary_vec) -- { -- abfd->xvec = save_targ; -- abfd->format = bfd_unknown; -- -- if (matching) -- free (matching_vector); -- -- bfd_set_error (bfd_error_file_not_recognized); -- -- return FALSE; -- } -+ goto err_unrecog; - } - - for (target = bfd_target_vector; *target != NULL; target++) -@@ -227,11 +200,7 @@ bfd_check_format_matches (bfd *abfd, bfd - abfd->xvec = *target; /* Change BFD's target temporarily. */ - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) -- { -- if (matching) -- free (matching_vector); -- return FALSE; -- } -+ goto err_ret; - - /* If _bfd_check_format neglects to set bfd_error, assume - bfd_error_wrong_format. We didn't used to even pay any -@@ -255,9 +224,8 @@ bfd_check_format_matches (bfd *abfd, bfd - break; - } - -- if (matching) -+ if (matching_vector) - matching_vector[match_count] = temp; -- - match_count++; - } - else if ((err = bfd_get_error ()) == bfd_error_wrong_object_format -@@ -268,20 +236,12 @@ bfd_check_format_matches (bfd *abfd, bfd - no better matches. */ - if (ar_right_targ != bfd_default_vector[0]) - ar_right_targ = *target; -- if (matching) -+ if (matching_vector) - matching_vector[ar_match_index] = *target; - ar_match_index++; - } - else if (err != bfd_error_wrong_format) -- { -- abfd->xvec = save_targ; -- abfd->format = bfd_unknown; -- -- if (matching) -- free (matching_vector); -- -- return FALSE; -- } -+ goto err_ret; - } - - if (match_count == 0) -@@ -297,16 +257,14 @@ bfd_check_format_matches (bfd *abfd, bfd - { - match_count = ar_match_index - _bfd_target_vector_entries; - -- if (matching && match_count > 1) -+ if (matching_vector && match_count > 1) - memcpy (matching_vector, - matching_vector + _bfd_target_vector_entries, - sizeof (*matching_vector) * match_count); - } - } - -- if (match_count > 1 -- && bfd_associated_vector != NULL -- && matching) -+ if (match_count > 1) - { - const bfd_target * const *assoc = bfd_associated_vector; - -@@ -328,11 +286,9 @@ bfd_check_format_matches (bfd *abfd, bfd - - if (match_count == 1) - { -+ ok_ret: - abfd->xvec = right_targ; /* Change BFD's target permanently. */ - -- if (matching) -- free (matching_vector); -- - /* If the file was opened for update, then `output_has_begun' - some time ago when the file was created. Do not recompute - sections sizes or alignments in _bfd_set_section_contents. -@@ -341,37 +297,39 @@ bfd_check_format_matches (bfd *abfd, bfd - if (abfd->direction == both_direction) - abfd->output_has_begun = TRUE; - -+ if (matching_vector) -+ free (matching_vector); - return TRUE; /* File position has moved, BTW. */ - } - -- abfd->xvec = save_targ; /* Restore original target type. */ -- abfd->format = bfd_unknown; /* Restore original format. */ -- - if (match_count == 0) - { -+ err_unrecog: - bfd_set_error (bfd_error_file_not_recognized); -- -- if (matching) -+ err_ret: -+ abfd->xvec = save_targ; -+ abfd->format = bfd_unknown; -+ if (matching_vector) - free (matching_vector); -+ return FALSE; - } -- else -- { -- bfd_set_error (bfd_error_file_ambiguously_recognized); - -- if (matching) -+ abfd->xvec = save_targ; /* Restore original target type. */ -+ abfd->format = bfd_unknown; /* Restore original format. */ -+ bfd_set_error (bfd_error_file_ambiguously_recognized); -+ -+ if (matching) -+ { -+ *matching = (char **) matching_vector; -+ matching_vector[match_count] = NULL; -+ /* Return target names. This is a little nasty. Maybe we -+ should do another bfd_malloc? */ -+ while (--match_count >= 0) - { -- *matching = (char **) matching_vector; -- matching_vector[match_count] = NULL; -- /* Return target names. This is a little nasty. Maybe we -- should do another bfd_malloc? */ -- while (--match_count >= 0) -- { -- const char *name = matching_vector[match_count]->name; -- *(const char **) &matching_vector[match_count] = name; -- } -+ const char *name = matching_vector[match_count]->name; -+ *(const char **) &matching_vector[match_count] = name; - } - } -- - return FALSE; - } - diff --git a/patches/binutils-2.18/generic/gentoo/33_all_binutils-gnu-relro-fixups.patch b/patches/binutils-2.18/generic/gentoo/33_all_binutils-gnu-relro-fixups.patch deleted file mode 100644 index 2471163..0000000 --- a/patches/binutils-2.18/generic/gentoo/33_all_binutils-gnu-relro-fixups.patch +++ /dev/null @@ -1,536 +0,0 @@ -http://bugs.gentoo.org/192584 -http://sourceware.org/bugzilla/show_bug.cgi?id=5037 -http://sourceware.org/ml/binutils/2007-09/msg00208.html - -bfd/ - -2007-09-16 H.J. Lu <hongjiu.lu@intel.com> - - PR binutils/3281 - PR binutils/5037 - * elf-bfd.h (elf_obj_tdata): Remove relro. - - * elf.c (get_program_header_size): Check info->relro instead - of elf_tdata (abfd)->relro. - (_bfd_elf_map_sections_to_segments): Likewise. - (assign_file_positions_for_load_sections): Don't set - PT_GNU_RELRO segment alignment here. - (assign_file_positions_for_non_load_sections): Properly set up - PT_GNU_RELRO segment for copying executable/shared library. - (rewrite_elf_program_header): Remove PT_GNU_RELRO segment. - (copy_elf_program_header): Set p_size and p_size_valid fields for - PT_GNU_RELRO segment. - -include/elf/ - -2007-09-16 H.J. Lu <hongjiu.lu@intel.com> - - PR binutils/3281 - PR binutils/5037 - * internal.h (elf_segment_map): Add p_size and p_size_valid. - (ELF_IS_SECTION_IN_SEGMENT): Allow SHF_TLS sections in - PT_GNU_RELRO segments. - -ld/ - -2007-09-16 H.J. Lu <hongjiu.lu@intel.com> - - PR binutils/3281 - PR binutils/5037 - * ldexp.h (ldexp_control): Add relro, relro_start_stat and - relro_end_stat. - - * ldexp.c (fold_binary): Set expld.dataseg.relro to - exp_dataseg_relro_start or exp_dataseg_relro_end when - seeing DATA_SEGMENT_ALIGN or DATA_SEGMENT_RELRO_END, - respectively. - - * ldlang.c (lang_size_sections_1): Properly set - expld.dataseg.relro_start_stat and - expld.dataseg.relro_end_stat. - (find_relro_section_callback): New function. - (lang_find_relro_sections_1): Likewise. - (lang_find_relro_sections): Likewise. - (lang_process): Call lang_find_relro_sections for - non-relocatable link. - -ld/testsuite/ - -2007-09-16 H.J. Lu <hongjiu.lu@intel.com> - - PR binutils/3281 - PR binutils/5037 - * ld-elf/binutils.exp: Update "-z relro" tests to use relro1.s. - Add "-z relro" tests with relro2.s. Add "-z relro" tests with - TLS for objcopy. - - * ld-elf/relro1.s: New file. - * ld-elf/relro2.s: Likewise. - ---- - bfd/elf-bfd.h | 3 - - bfd/elf.c | 77 ++++++++++++++++++++++++----- - bfd/elflink.c | 1 - include/elf/internal.h | 10 +++ - ld/ldexp.c | 2 - ld/ldexp.h | 11 ++++ - ld/ldlang.c | 101 +++++++++++++++++++++++++++++++++++++++ - ld/testsuite/ld-elf/binutils.exp | 28 ++++++++-- - ld/testsuite/ld-elf/relro1.s | 14 +++++ - ld/testsuite/ld-elf/relro2.s | 5 + - 10 files changed, 227 insertions(+), 25 deletions(-) - -Index: binutils-2.18/bfd/elf-bfd.h -=================================================================== ---- binutils-2.18.orig/bfd/elf-bfd.h -+++ binutils-2.18/bfd/elf-bfd.h -@@ -1428,9 +1428,6 @@ struct elf_obj_tdata - /* Segment flags for the PT_GNU_STACK segment. */ - unsigned int stack_flags; - -- /* Should the PT_GNU_RELRO segment be emitted? */ -- bfd_boolean relro; -- - /* Symbol version definitions in external objects. */ - Elf_Internal_Verdef *verdef; - -Index: binutils-2.18/bfd/elf.c -=================================================================== ---- binutils-2.18.orig/bfd/elf.c -+++ binutils-2.18/bfd/elf.c -@@ -3321,7 +3321,7 @@ get_program_header_size (bfd *abfd, stru - /* We need a PT_DYNAMIC segment. */ - ++segs; - -- if (elf_tdata (abfd)->relro) -+ if (info->relro) - { - /* We need a PT_GNU_RELRO segment only when there is a - PT_DYNAMIC segment. */ -@@ -3851,7 +3851,7 @@ _bfd_elf_map_sections_to_segments (bfd * - pm = &m->next; - } - -- if (dynsec != NULL && elf_tdata (abfd)->relro) -+ if (dynsec != NULL && info->relro) - { - /* We make a PT_GNU_RELRO segment only when there is a - PT_DYNAMIC segment. */ -@@ -4326,12 +4326,10 @@ assign_file_positions_for_load_sections - p->p_memsz += this_hdr->sh_size; - } - -- if (p->p_type == PT_GNU_RELRO) -- p->p_align = 1; -- else if (align > p->p_align -- && !m->p_align_valid -- && (p->p_type != PT_LOAD -- || (abfd->flags & D_PAGED) == 0)) -+ if (align > p->p_align -+ && !m->p_align_valid -+ && (p->p_type != PT_LOAD -+ || (abfd->flags & D_PAGED) == 0)) - p->p_align = align; - } - -@@ -4480,18 +4478,53 @@ assign_file_positions_for_non_load_secti - if (m->count != 0) - { - if (p->p_type != PT_LOAD -- && (p->p_type != PT_NOTE || bfd_get_format (abfd) != bfd_core)) -+ && (p->p_type != PT_NOTE -+ || bfd_get_format (abfd) != bfd_core)) - { - Elf_Internal_Shdr *hdr; -+ asection *sect; -+ - BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs); - -- hdr = &elf_section_data (m->sections[m->count - 1])->this_hdr; -- p->p_filesz = (m->sections[m->count - 1]->filepos -- - 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; -+ 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; - } - } - else -@@ -5080,7 +5113,12 @@ rewrite_elf_program_header (bfd *ibfd, b - } - - if (segment->p_type != PT_LOAD) -- continue; -+ { -+ /* Remove PT_GNU_RELRO segment. */ -+ if (segment->p_type == PT_GNU_RELRO) -+ segment->p_type = PT_NULL; -+ continue; -+ } - - /* Determine if this segment overlaps any previous segments. */ - for (j = 0, segment2 = elf_tdata (ibfd)->phdr; j < i; j++, segment2 ++) -@@ -5604,6 +5642,17 @@ copy_elf_program_header (bfd *ibfd, bfd - map->p_align_valid = 1; - map->p_vaddr_offset = 0; - -+ if (map->p_type == PT_GNU_RELRO -+ && segment->p_filesz == segment->p_memsz) -+ { -+ /* The PT_GNU_RELRO segment may contain the first a few -+ bytes in the .got.plt section even if the whole .got.plt -+ section isn't in the PT_GNU_RELRO segment. We won't -+ change the size of the PT_GNU_RELRO segment. */ -+ map->p_size = segment->p_filesz; -+ map->p_size_valid = 1; -+ } -+ - /* Determine if this segment contains the ELF file header - and if it contains the program headers themselves. */ - map->includes_filehdr = (segment->p_offset == 0 -Index: binutils-2.18/bfd/elflink.c -=================================================================== ---- binutils-2.18.orig/bfd/elflink.c -+++ binutils-2.18/bfd/elflink.c -@@ -5327,7 +5327,6 @@ bfd_elf_size_dynamic_sections (bfd *outp - return TRUE; - - bed = get_elf_backend_data (output_bfd); -- elf_tdata (output_bfd)->relro = info->relro; - if (info->execstack) - elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X; - else if (info->noexecstack) -Index: binutils-2.18/include/elf/internal.h -=================================================================== ---- binutils-2.18.orig/include/elf/internal.h -+++ binutils-2.18/include/elf/internal.h -@@ -239,6 +239,8 @@ struct elf_segment_map - bfd_vma p_vaddr_offset; - /* Program segment alignment. */ - bfd_vma p_align; -+ /* Segment size in file and memory */ -+ bfd_vma p_size; - /* Whether the p_flags field is valid; if not, the flags are based - on the section flags. */ - unsigned int p_flags_valid : 1; -@@ -248,6 +250,9 @@ struct elf_segment_map - /* Whether the p_align field is valid; if not, PT_LOAD segment - alignment is based on the default maximum page size. */ - unsigned int p_align_valid : 1; -+ /* Whether the p_size field is valid; if not, the size are based -+ on the section sizes. */ -+ unsigned int p_size_valid : 1; - /* Whether this segment includes the file header. */ - unsigned int includes_filehdr : 1; - /* Whether this segment includes the program headers. */ -@@ -266,11 +271,12 @@ struct elf_segment_map - || segment->p_type == PT_TLS) ? sec_hdr->sh_size : 0) - - /* Decide if the given sec_hdr is in the given segment. PT_TLS segment -- contains only SHF_TLS sections. Only PT_LOAD and PT_TLS segments -- can contain SHF_TLS sections. */ -+ contains only SHF_TLS sections. Only PT_LOAD, PT_GNU_RELRO and -+ and PT_TLS segments can contain SHF_TLS sections. */ - #define ELF_IS_SECTION_IN_SEGMENT(sec_hdr, segment) \ - (((((sec_hdr->sh_flags & SHF_TLS) != 0) \ - && (segment->p_type == PT_TLS \ -+ || segment->p_type == PT_GNU_RELRO \ - || segment->p_type == PT_LOAD)) \ - || ((sec_hdr->sh_flags & SHF_TLS) == 0 \ - && segment->p_type != PT_TLS)) \ -Index: binutils-2.18/ld/ldexp.c -=================================================================== ---- binutils-2.18.orig/ld/ldexp.c -+++ binutils-2.18/ld/ldexp.c -@@ -390,6 +390,7 @@ fold_binary (etree_type *tree) - break; - - case DATA_SEGMENT_ALIGN: -+ expld.dataseg.relro = exp_dataseg_relro_start; - if (expld.phase != lang_first_phase_enum - && expld.section == bfd_abs_section_ptr - && (expld.dataseg.phase == exp_dataseg_none -@@ -425,6 +426,7 @@ fold_binary (etree_type *tree) - break; - - case DATA_SEGMENT_RELRO_END: -+ expld.dataseg.relro = exp_dataseg_relro_end; - if (expld.phase != lang_first_phase_enum - && (expld.dataseg.phase == exp_dataseg_align_seen - || expld.dataseg.phase == exp_dataseg_adjust -Index: binutils-2.18/ld/ldexp.h -=================================================================== ---- binutils-2.18.orig/ld/ldexp.h -+++ binutils-2.18/ld/ldexp.h -@@ -98,6 +98,8 @@ typedef enum { - lang_final_phase_enum - } lang_phase_type; - -+union lang_statement_union; -+ - struct ldexp_control { - /* Modify expression evaluation depending on this. */ - lang_phase_type phase; -@@ -125,6 +127,15 @@ struct ldexp_control { - } phase; - - bfd_vma base, min_base, relro_end, end, pagesize, maxpagesize; -+ -+ enum { -+ exp_dataseg_relro_none, -+ exp_dataseg_relro_start, -+ exp_dataseg_relro_end, -+ } relro; -+ -+ union lang_statement_union *relro_start_stat; -+ union lang_statement_union *relro_end_stat; - } dataseg; - }; - -Index: binutils-2.18/ld/ldlang.c -=================================================================== ---- binutils-2.18.orig/ld/ldlang.c -+++ binutils-2.18/ld/ldlang.c -@@ -4631,10 +4631,32 @@ lang_size_sections_1 - bfd_vma newdot = dot; - etree_type *tree = s->assignment_statement.exp; - -+ expld.dataseg.relro = exp_dataseg_relro_none; -+ - exp_fold_tree (tree, - output_section_statement->bfd_section, - &newdot); - -+ if (expld.dataseg.relro == exp_dataseg_relro_start) -+ { -+ if (!expld.dataseg.relro_start_stat) -+ expld.dataseg.relro_start_stat = s; -+ else -+ { -+ ASSERT (expld.dataseg.relro_start_stat == s); -+ } -+ } -+ else if (expld.dataseg.relro == exp_dataseg_relro_end) -+ { -+ if (!expld.dataseg.relro_end_stat) -+ expld.dataseg.relro_end_stat = s; -+ else -+ { -+ ASSERT (expld.dataseg.relro_end_stat == s); -+ } -+ } -+ expld.dataseg.relro = exp_dataseg_relro_none; -+ - /* This symbol is relative to this section. */ - if ((tree->type.node_class == etree_provided - || tree->type.node_class == etree_assign) -@@ -5660,6 +5682,81 @@ lang_gc_sections (void) - bfd_gc_sections (output_bfd, &link_info); - } - -+/* Worker for lang_find_relro_sections_1. */ -+ -+static void -+find_relro_section_callback (lang_wild_statement_type *ptr ATTRIBUTE_UNUSED, -+ struct wildcard_list *sec ATTRIBUTE_UNUSED, -+ asection *section, -+ lang_input_statement_type *file ATTRIBUTE_UNUSED, -+ void *data) -+{ -+ /* Discarded, excluded and ignored sections effectively have zero -+ size. */ -+ if (section->output_section != NULL -+ && section->output_section->owner == output_bfd -+ && (section->output_section->flags & SEC_EXCLUDE) == 0 -+ && !IGNORE_SECTION (section) -+ && section->size != 0) -+ { -+ bfd_boolean *has_relro_section = (bfd_boolean *) data; -+ *has_relro_section = TRUE; -+ } -+} -+ -+/* Iterate over sections for relro sections. */ -+ -+static void -+lang_find_relro_sections_1 (lang_statement_union_type *s, -+ bfd_boolean *has_relro_section) -+{ -+ if (*has_relro_section) -+ return; -+ -+ for (; s != NULL; s = s->header.next) -+ { -+ if (s == expld.dataseg.relro_end_stat) -+ break; -+ -+ switch (s->header.type) -+ { -+ case lang_wild_statement_enum: -+ walk_wild (&s->wild_statement, -+ find_relro_section_callback, -+ has_relro_section); -+ break; -+ case lang_constructors_statement_enum: -+ lang_find_relro_sections_1 (constructor_list.head, -+ has_relro_section); -+ break; -+ case lang_output_section_statement_enum: -+ lang_find_relro_sections_1 (s->output_section_statement.children.head, -+ has_relro_section); -+ break; -+ case lang_group_statement_enum: -+ lang_find_relro_sections_1 (s->group_statement.children.head, -+ has_relro_section); -+ break; -+ default: -+ break; -+ } -+ } -+} -+ -+static void -+lang_find_relro_sections (void) -+{ -+ bfd_boolean has_relro_section = FALSE; -+ -+ /* Check all sections in the link script. */ -+ -+ lang_find_relro_sections_1 (expld.dataseg.relro_start_stat, -+ &has_relro_section); -+ -+ if (!has_relro_section) -+ link_info.relro = FALSE; -+} -+ - /* Relax all sections until bfd_relax_section gives up. */ - - static void -@@ -5787,6 +5884,10 @@ lang_process (void) - section positions, since they will affect SIZEOF_HEADERS. */ - lang_record_phdrs (); - -+ /* Check relro sections. */ -+ if (link_info.relro && ! link_info.relocatable) -+ lang_find_relro_sections (); -+ - /* Size up the sections. */ - lang_size_sections (NULL, !command_line.relax); - -Index: binutils-2.18/ld/testsuite/ld-elf/binutils.exp -=================================================================== ---- binutils-2.18.orig/ld/testsuite/ld-elf/binutils.exp -+++ binutils-2.18/ld/testsuite/ld-elf/binutils.exp -@@ -104,24 +104,42 @@ binutils_test strip "-shared" maxpage1 - binutils_test objcopy "" maxpage1 - binutils_test objcopy "-shared" maxpage1 - --binutils_test strip "-z relro" maxpage1 --binutils_test strip "-z relro -shared" maxpage1 --binutils_test objcopy "-z relro" maxpage1 --binutils_test objcopy "-z relro -shared" maxpage1 -+binutils_test strip "-z relro" relro1 -+binutils_test strip "-z relro -shared" relro1 -+binutils_test objcopy "-z relro" relro1 -+binutils_test objcopy "-z relro -shared" relro1 -+if { ([istarget "i?86-*-elf*"] -+ || ([istarget "i?86-*-linux*"] -+ && ![istarget "*-*-*aout*"] -+ && ![istarget "*-*-*oldld*"]) -+ || [istarget "x86_64-*-linux*"] -+ || [istarget "amd64-*-linux*"]) } { -+ binutils_test strip "-z relro -shared" relro2 -+ binutils_test objcopy "-z relro -shared" relro2 -+} - - binutils_test objcopy "" tbss1 -+binutils_test objcopy "-z relro" tbss1 - binutils_test objcopy "-shared" tbss1 -+binutils_test objcopy "-shared -z relro" tbss1 - binutils_test objcopy "-z max-page-size=0x100000" tbss1 - binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss1 - binutils_test objcopy "" tdata1 -+binutils_test objcopy "-z relro" tdata1 - binutils_test objcopy "-shared" tdata1 -+binutils_test objcopy "-shared -z relro" tdata1 - binutils_test objcopy "-z max-page-size=0x100000" tdata1 - binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata1 - binutils_test objcopy "" tbss2 -+binutils_test objcopy "-z relro" tbss2 - binutils_test objcopy "-shared" tbss2 -+binutils_test objcopy "-shared -z relro" tbss2 - binutils_test objcopy "-z max-page-size=0x100000" tbss2 - binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss2 --binutils_test objcopy "-z max-page-size=0x100000" tdata2 -+ - binutils_test objcopy "" tdata2 -+binutils_test objcopy "-z relro" tdata2 - binutils_test objcopy "-shared" tdata2 -+binutils_test objcopy "-shared -z relro" tdata2 -+binutils_test objcopy "-z max-page-size=0x100000" tdata2 - binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata2 -Index: binutils-2.18/ld/testsuite/ld-elf/relro1.s -=================================================================== ---- /dev/null -+++ binutils-2.18/ld/testsuite/ld-elf/relro1.s -@@ -0,0 +1,14 @@ -+ .globl main -+ .globl start -+ .globl _start -+ .globl __start -+ .text -+main: -+start: -+_start: -+__start: -+ .long 0 -+ .data -+ .long 0 -+ .section .data.rel.ro,"aw",%progbits -+ .long 0 -Index: binutils-2.18/ld/testsuite/ld-elf/relro2.s -=================================================================== ---- /dev/null -+++ binutils-2.18/ld/testsuite/ld-elf/relro2.s -@@ -0,0 +1,5 @@ -+ .text -+ .globl x -+ .type x, @function -+x: -+ jmp foo@PLT diff --git a/patches/binutils-2.18/generic/gentoo/42_all_012_check_ldrunpath_length.patch b/patches/binutils-2.18/generic/gentoo/42_all_012_check_ldrunpath_length.patch deleted file mode 100644 index e03eca8..0000000 --- a/patches/binutils-2.18/generic/gentoo/42_all_012_check_ldrunpath_length.patch +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -e -## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org> -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for -## DP: cases where -rpath isn't specified. (#151024) - -if [ $# -ne 1 ]; then - echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" - exit 1 -fi - -[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts -patch_opts="${patch_opts:--f --no-backup-if-mismatch}" - -case "$1" in - -patch) patch $patch_opts -p1 < $0;; - -unpatch) patch $patch_opts -p1 -R < $0;; - *) - echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" - exit 1;; -esac - -exit 0 - -@DPATCH@ ---- - ld/emultempl/elf32.em | 4 ++++ - 1 file changed, 4 insertions(+) - -Index: binutils-2.18/ld/emultempl/elf32.em -=================================================================== ---- binutils-2.18.orig/ld/emultempl/elf32.em -+++ binutils-2.18/ld/emultempl/elf32.em -@@ -1216,6 +1216,8 @@ fragment <<EOF - && command_line.rpath == NULL) - { - lib_path = (const char *) getenv ("LD_RUN_PATH"); -+ if ((lib_path) && (strlen (lib_path) == 0)) -+ lib_path = NULL; - if (gld${EMULATION_NAME}_search_needed (lib_path, &n, - force)) - break; -@@ -1400,6 +1402,8 @@ gld${EMULATION_NAME}_before_allocation ( - rpath = command_line.rpath; - if (rpath == NULL) - rpath = (const char *) getenv ("LD_RUN_PATH"); -+ if ((rpath) && (strlen (rpath) == 0)) -+ rpath = NULL; - if (! (bfd_elf_size_dynamic_sections - (output_bfd, command_line.soname, rpath, - command_line.filter_shlib, diff --git a/patches/binutils-2.18/generic/gentoo/66_all_binutils-2.17.50.0.2-warn-textrel.patch b/patches/binutils-2.18/generic/gentoo/66_all_binutils-2.17.50.0.2-warn-textrel.patch deleted file mode 100644 index 85b517d..0000000 --- a/patches/binutils-2.18/generic/gentoo/66_all_binutils-2.17.50.0.2-warn-textrel.patch +++ /dev/null @@ -1,75 +0,0 @@ -textrels are bad for forcing copy-on-write (this affects everyone), -and for security/runtime code generation, this affects security ppl. -But in either case, it doesn't matter who needs textrels, it's -the very fact that they're needed at all. - -2006-06-10 Ned Ludd <solar@gentoo.org>, Mike Frysinger <vapier@gentoo.org> - - * bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs. - * ld/ldmain.c (main): Change textrel warning default to true. - * ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL - warnings from ld output. - ---- - bfd/elflink.c | 8 +++----- - ld/ldmain.c | 1 + - ld/testsuite/lib/ld-lib.exp | 4 ++++ - 3 files changed, 8 insertions(+), 5 deletions(-) - -Index: binutils-2.18/bfd/elflink.c -=================================================================== ---- binutils-2.18.orig/bfd/elflink.c -+++ binutils-2.18/bfd/elflink.c -@@ -10914,14 +10914,12 @@ bfd_elf_final_link (bfd *abfd, struct bf - goto error_return; - - /* Check for DT_TEXTREL (late, in case the backend removes it). */ -- if (info->warn_shared_textrel && info->shared) -+ o = bfd_get_section_by_name (dynobj, ".dynamic"); -+ if (info->warn_shared_textrel && o != NULL) - { - bfd_byte *dyncon, *dynconend; - - /* Fix up .dynamic entries. */ -- o = bfd_get_section_by_name (dynobj, ".dynamic"); -- BFD_ASSERT (o != NULL); -- - dyncon = o->contents; - dynconend = o->contents + o->size; - for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn) -@@ -10933,7 +10931,7 @@ bfd_elf_final_link (bfd *abfd, struct bf - if (dyn.d_tag == DT_TEXTREL) - { - info->callbacks->einfo -- (_("%P: warning: creating a DT_TEXTREL in a shared object.\n")); -+ (_("%P: warning: creating a DT_TEXTREL in object.\n")); - break; - } - } -Index: binutils-2.18/ld/ldmain.c -=================================================================== ---- binutils-2.18.orig/ld/ldmain.c -+++ binutils-2.18/ld/ldmain.c -@@ -280,6 +280,7 @@ main (int argc, char **argv) - emulation = get_emulation (argc, argv); - ldemul_choose_mode (emulation); - default_target = ldemul_choose_target (argc, argv); -+ link_info.warn_shared_textrel = TRUE; - lang_init (); - ldemul_before_parse (); - lang_has_input_file = FALSE; -Index: binutils-2.18/ld/testsuite/lib/ld-lib.exp -=================================================================== ---- binutils-2.18.orig/ld/testsuite/lib/ld-lib.exp -+++ binutils-2.18/ld/testsuite/lib/ld-lib.exp -@@ -194,6 +194,10 @@ proc default_ld_simple_link { ld target - # symbol, since the default linker script might use ENTRY. - regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output - -+ # Gentoo tweak: -+ # We want to ignore TEXTREL warnings since we force enable them by default -+ regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output -+ - if [string match "" $exec_output] then { - return 1 - } else { diff --git a/patches/binutils-2.18/generic/gentoo/76_all_only-use-new-ld-dtags.patch.disabled b/patches/binutils-2.18/generic/gentoo/76_all_only-use-new-ld-dtags.patch.disabled deleted file mode 100644 index f7db0c5..0000000 --- a/patches/binutils-2.18/generic/gentoo/76_all_only-use-new-ld-dtags.patch.disabled +++ /dev/null @@ -1,31 +0,0 @@ -Don't generate RPATH if we're going to be generating RUNPATH. - -need to ponder what ramifications this has before enabling it - ---- - bfd/elflink.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -Index: binutils-2.18/bfd/elflink.c -=================================================================== ---- binutils-2.18.orig/bfd/elflink.c -+++ binutils-2.18/bfd/elflink.c -@@ -5422,11 +5422,15 @@ bfd_elf_size_dynamic_sections (bfd *outp - - indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath, - TRUE); -- if (indx == (bfd_size_type) -1 -- || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx)) -+ if (indx == (bfd_size_type) -1) - return FALSE; - -- if (info->new_dtags) -+ if (!info->new_dtags) -+ { -+ if (!_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx)) -+ return FALSE; -+ } -+ else - { - _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx); - if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx)) diff --git a/patches/binutils-2.18/generic/gentoo/91_all_libiberty-pic.patch b/patches/binutils-2.18/generic/gentoo/91_all_libiberty-pic.patch deleted file mode 100644 index 9a5ebeb..0000000 --- a/patches/binutils-2.18/generic/gentoo/91_all_libiberty-pic.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- - libiberty/Makefile.in | 1 + - 1 file changed, 1 insertion(+) - -Index: binutils-2.18/libiberty/Makefile.in -=================================================================== ---- binutils-2.18.orig/libiberty/Makefile.in -+++ binutils-2.18/libiberty/Makefile.in -@@ -225,6 +225,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ - $(RANLIB) $(TARGETLIB); \ -+ cp $(TARGETLIB) ../ ; \ - cd ..; \ - else true; fi - diff --git a/patches/binutils-2.18/generic/gentoo/no_63_all_binutils-2.18-pt-pax-flags-20070828.patch b/patches/binutils-2.18/generic/gentoo/no_63_all_binutils-2.18-pt-pax-flags-20070828.patch deleted file mode 100644 index 4c0c1a5..0000000 --- a/patches/binutils-2.18/generic/gentoo/no_63_all_binutils-2.18-pt-pax-flags-20070828.patch +++ /dev/null @@ -1,263 +0,0 @@ ---- - bfd/elf-bfd.h | 3 +++ - bfd/elf.c | 27 ++++++++++++++++++++++++++- - bfd/elflink.c | 24 +++++++++++++++++++++--- - binutils/readelf.c | 1 + - include/bfdlink.h | 8 ++++++++ - include/elf/common.h | 16 ++++++++++++++++ - ld/emultempl/elf32.em | 12 ++++++++++++ - ld/ldgram.y | 2 ++ - 8 files changed, 89 insertions(+), 4 deletions(-) - -Index: binutils-2.18/bfd/elf-bfd.h -=================================================================== ---- binutils-2.18.orig/bfd/elf-bfd.h -+++ binutils-2.18/bfd/elf-bfd.h -@@ -1428,6 +1428,9 @@ struct elf_obj_tdata - /* Segment flags for the PT_GNU_STACK segment. */ - unsigned int stack_flags; - -+ /* Segment flags for the PT_PAX_FLAGS segment. */ -+ unsigned int pax_flags; -+ - /* Symbol version definitions in external objects. */ - Elf_Internal_Verdef *verdef; - -Index: binutils-2.18/bfd/elf.c -=================================================================== ---- binutils-2.18.orig/bfd/elf.c -+++ binutils-2.18/bfd/elf.c -@@ -1085,6 +1085,7 @@ get_segment_type (unsigned int p_type) - case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break; - case PT_GNU_STACK: pt = "STACK"; break; - case PT_GNU_RELRO: pt = "RELRO"; break; -+ case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break; - default: pt = NULL; break; - } - return pt; -@@ -2361,6 +2362,9 @@ bfd_section_from_phdr (bfd *abfd, Elf_In - case PT_GNU_RELRO: - return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro"); - -+ case PT_PAX_FLAGS: -+ return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags"); -+ - default: - /* Check for any processor-specific program segment types. */ - bed = get_elf_backend_data (abfd); -@@ -3341,6 +3345,11 @@ get_program_header_size (bfd *abfd, stru - ++segs; - } - -+ { -+ /* We need a PT_PAX_FLAGS segment. */ -+ ++segs; -+ } -+ - for (s = abfd->sections; s != NULL; s = s->next) - { - if ((s->flags & SEC_LOAD) != 0 -@@ -3868,6 +3877,20 @@ _bfd_elf_map_sections_to_segments (bfd * - pm = &m->next; - } - -+ { -+ amt = sizeof (struct elf_segment_map); -+ m = bfd_zalloc (abfd, amt); -+ if (m == NULL) -+ goto error_return; -+ m->next = NULL; -+ m->p_type = PT_PAX_FLAGS; -+ m->p_flags = elf_tdata (abfd)->pax_flags; -+ m->p_flags_valid = 1; -+ -+ *pm = m; -+ pm = &m->next; -+ } -+ - free (sections); - elf_tdata (abfd)->segment_map = mfirst; - } -@@ -5043,7 +5066,8 @@ rewrite_elf_program_header (bfd *ibfd, b - 6. PT_TLS segment includes only SHF_TLS sections. - 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. - 8. PT_DYNAMIC should not contain empty sections at the beginning -- (with the possible exception of .dynamic). */ -+ (with the possible exception of .dynamic). -+ 9. PT_PAX_FLAGS segments does not include any sections. */ - #define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \ - ((((segment->p_paddr \ - ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \ -@@ -5051,6 +5075,7 @@ rewrite_elf_program_header (bfd *ibfd, b - && (section->flags & SEC_ALLOC) != 0) \ - || IS_COREFILE_NOTE (segment, section)) \ - && segment->p_type != PT_GNU_STACK \ -+ && segment->p_type != PT_PAX_FLAGS \ - && (segment->p_type != PT_TLS \ - || (section->flags & SEC_THREAD_LOCAL)) \ - && (segment->p_type == PT_LOAD \ -Index: binutils-2.18/bfd/elflink.c -=================================================================== ---- binutils-2.18.orig/bfd/elflink.c -+++ binutils-2.18/bfd/elflink.c -@@ -5327,16 +5327,30 @@ bfd_elf_size_dynamic_sections (bfd *outp - return TRUE; - - bed = get_elf_backend_data (output_bfd); -+ elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC; -+ -+ if (info->execheap) -+ elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT; -+ else if (info->noexecheap) -+ elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT; -+ - if (info->execstack) -- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X; -+ { -+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X; -+ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP; -+ } - else if (info->noexecstack) -- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W; -+ { -+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W; -+ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP; -+ } - else - { - bfd *inputobj; - asection *notesec = NULL; - int exec = 0; - -+ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP; - for (inputobj = info->input_bfds; - inputobj; - inputobj = inputobj->link_next) -@@ -5349,7 +5363,11 @@ bfd_elf_size_dynamic_sections (bfd *outp - if (s) - { - if (s->flags & SEC_CODE) -- exec = PF_X; -+ { -+ elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP; -+ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP; -+ exec = PF_X; -+ } - notesec = s; - } - else if (bed->default_execstack) -Index: binutils-2.18/binutils/readelf.c -=================================================================== ---- binutils-2.18.orig/binutils/readelf.c -+++ binutils-2.18/binutils/readelf.c -@@ -2469,6 +2469,7 @@ get_segment_type (unsigned long p_type) - return "GNU_EH_FRAME"; - case PT_GNU_STACK: return "GNU_STACK"; - case PT_GNU_RELRO: return "GNU_RELRO"; -+ case PT_PAX_FLAGS: return "PAX_FLAGS"; - - default: - if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC)) -Index: binutils-2.18/include/bfdlink.h -=================================================================== ---- binutils-2.18.orig/include/bfdlink.h -+++ binutils-2.18/include/bfdlink.h -@@ -321,6 +321,14 @@ struct bfd_link_info - /* TRUE if PT_GNU_RELRO segment should be created. */ - unsigned int relro: 1; - -+ /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT -+ flags. */ -+ unsigned int execheap: 1; -+ -+ /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT -+ flags. */ -+ unsigned int noexecheap: 1; -+ - /* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */ - unsigned int warn_shared_textrel: 1; - -Index: binutils-2.18/include/elf/common.h -=================================================================== ---- binutils-2.18.orig/include/elf/common.h -+++ binutils-2.18/include/elf/common.h -@@ -309,6 +309,7 @@ - #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */ - #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */ - #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */ -+#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* PaX flags */ - - /* Program segment permissions, in program header p_flags field. */ - -@@ -319,6 +320,21 @@ - #define PF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */ - #define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */ - -+/* Flags to control PaX behavior. */ -+ -+#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */ -+#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */ -+#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */ -+#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */ -+#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */ -+#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */ -+#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */ -+#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */ -+#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */ -+#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */ -+#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */ -+#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */ -+ - /* Values for section header, sh_type field. */ - - #define SHT_NULL 0 /* Section header table entry unused */ -Index: binutils-2.18/ld/emultempl/elf32.em -=================================================================== ---- binutils-2.18.orig/ld/emultempl/elf32.em -+++ binutils-2.18/ld/emultempl/elf32.em -@@ -2136,6 +2136,16 @@ fragment <<EOF - link_info.noexecstack = TRUE; - link_info.execstack = FALSE; - } -+ else if (strcmp (optarg, "execheap") == 0) -+ { -+ link_info.execheap = TRUE; -+ link_info.noexecheap = FALSE; -+ } -+ else if (strcmp (optarg, "noexecheap") == 0) -+ { -+ link_info.noexecheap = TRUE; -+ link_info.execheap = FALSE; -+ } - EOF - - if test -n "$COMMONPAGESIZE"; then -@@ -2209,6 +2219,7 @@ fragment <<EOF - fprintf (file, _(" -z combreloc\t\tMerge dynamic relocs into one section and sort\n")); - fprintf (file, _(" -z defs\t\tReport unresolved symbols in object files.\n")); - fprintf (file, _(" -z execstack\t\tMark executable as requiring executable stack\n")); -+ fprintf (file, _(" -z execheap\t\tMark executable as requiring executable heap\n")); - fprintf (file, _(" -z initfirst\t\tMark DSO to be initialized first at runtime\n")); - fprintf (file, _(" -z interpose\t\tMark object to interpose all DSOs but executable\n")); - fprintf (file, _(" -z lazy\t\tMark object lazy runtime binding (default)\n")); -@@ -2221,6 +2232,7 @@ fragment <<EOF - fprintf (file, _(" -z nodlopen\t\tMark DSO not available to dlopen\n")); - fprintf (file, _(" -z nodump\t\tMark DSO not available to dldump\n")); - fprintf (file, _(" -z noexecstack\tMark executable as not requiring executable stack\n")); -+ fprintf (file, _(" -z noexecheap\tMark executable as not requiring executable heap\n")); - EOF - - if test -n "$COMMONPAGESIZE"; then -Index: binutils-2.18/ld/ldgram.y -=================================================================== ---- binutils-2.18.orig/ld/ldgram.y -+++ binutils-2.18/ld/ldgram.y -@@ -1099,6 +1099,8 @@ phdr_type: - $$ = exp_intop (0x6474e550); - else if (strcmp (s, "PT_GNU_STACK") == 0) - $$ = exp_intop (0x6474e551); -+ else if (strcmp (s, "PT_PAX_FLAGS") == 0) -+ $$ = exp_intop (0x65041580); - else - { - einfo (_("\ diff --git a/patches/binutils-2.18/generic/gentoo/no_76_all_use-new-ld-dtags.patch b/patches/binutils-2.18/generic/gentoo/no_76_all_use-new-ld-dtags.patch deleted file mode 100644 index 84e20f7..0000000 --- a/patches/binutils-2.18/generic/gentoo/no_76_all_use-new-ld-dtags.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- binutils/ld/ldmain.c -+++ binutils/ld/ldmain.c -@@ -296,6 +296,7 @@ main (int argc, char **argv) - - link_info.allow_undefined_version = TRUE; - link_info.keep_memory = TRUE; -+ link_info.new_dtags = TRUE; - link_info.combreloc = TRUE; - link_info.strip_discarded = TRUE; - link_info.callbacks = &link_callbacks; diff --git a/patches/binutils-2.18/generic/gentoo/no_77_all_generate-gnu-hash.patch b/patches/binutils-2.18/generic/gentoo/no_77_all_generate-gnu-hash.patch deleted file mode 100644 index eb8da88..0000000 --- a/patches/binutils-2.18/generic/gentoo/no_77_all_generate-gnu-hash.patch +++ /dev/null @@ -1,6 +0,0 @@ ---- binutils/ld/ldmain.c -+++ binutils/ld/ldmain.c -@@ -273,2 +273,3 @@ main (int argc, char **argv) - link_info.emit_hash = TRUE; -+ link_info.emit_gnu_hash = TRUE; - link_info.callbacks = &link_callbacks; diff --git a/patches/binutils-2.18/generic/gentoo/no_78_all_use-relro.patch b/patches/binutils-2.18/generic/gentoo/no_78_all_use-relro.patch deleted file mode 100644 index abd5187..0000000 --- a/patches/binutils-2.18/generic/gentoo/no_78_all_use-relro.patch +++ /dev/null @@ -1,6 +0,0 @@ ---- binutils/ld/ldmain.c -+++ binutils/ld/ldmain.c -@@ -293,2 +293,3 @@ main (int argc, char **argv) - link_info.combreloc = TRUE; -+ link_info.relro = TRUE; - link_info.strip_discarded = TRUE; |