Sync with RHEL:

- Fix assignment of pages to segments. (PR 22758)
- Inject RPM_LD_FLAGS into the build.  (#1541027)
- Fix slowdown in readelf when examining files with lots of debug information.  (PR 22802)
- Remove support for PowerPC speculation barrier insertion.
- Rebase on 2.30
- Retire binutils-2.22.52.0.1-relro-on-by-default.patch
- Retire binutils-2.28-dynamic-section-warning.patch
- Retire binutils-2.29-skip-rp14918-test-for-arm.patch
- Retire binutils-2.29.1-gold-start-stop.patch
- Retire binutils-2.29.1-readelf-use-dynamic.patch
- Retire binutils-aarch64-pie.patch
- Retire binutils-coverity.patch
- Retire binutils-ppc64-stub-creation.patch
- Retire binutils-strip-delete-relocs.patch
- Retire binutils-support-v3-build-notes.patch
- Retire binutils-z-undefs.patch
This commit is contained in:
Nick Clifton 2018-02-21 09:31:35 +00:00
parent d07dbfb9ed
commit e0e1ae6f6a
22 changed files with 1022 additions and 2122 deletions

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ build-sources
/binutils-2.29.tar.xz
/binutils-2.29.1.tar.xz
/binutils-2.19.50.0.1-output-format.sed
/binutils-2.30.tar.xz

View File

@ -1,13 +0,0 @@
--- binutils-2.27.orig/ld/configure.tgt 2016-07-07 11:16:49.967963649 +0100
+++ binutils-2.27/ld/configure.tgt 2016-07-07 11:17:02.252045673 +0100
@@ -901,8 +901,8 @@ frv-*-* | hppa*-*-* | ia64-*-* | mips*-*
# FAIL: objcopy -shared -z relro (tbss2)
# FAIL: objcopy -shared -z relro (tbss3)
;;
-*-*-linux*)
- if test ${ac_default_ld_z_relro} = unset; then
+*)
+ if test x${ac_default_ld_z_relro} = xunset; then
ac_default_ld_z_relro=1
fi
;;

View File

@ -135,10 +135,10 @@ diff -rup binutils-2.26.orig/bfd/elf.c binutils-2.26/bfd/elf.c
+++ binutils-2.26/bfd/elf.c 2016-02-19 09:35:54.904106515 +0000
@@ -2387,6 +2387,7 @@ static const struct bfd_elf_special_sect
{ STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
{ STRING_COMMA_LEN (".gnu.lto_"), -1, SHT_PROGBITS, SHF_EXCLUDE },
{ STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ STRING_COMMA_LEN (".gnu.lto_"), -1, SHT_PROGBITS, SHF_EXCLUDE },
{ STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".gnu_object_only"), 0, SHT_GNU_OBJECT_ONLY, SHF_EXCLUDE },
{ STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 },
{ STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 },
{ STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 },
{ STRING_COMMA_LEN (".gnu.version_r"), 0, SHT_GNU_verneed, 0 },
diff -rup binutils-2.26.orig/bfd/format.c binutils-2.26/bfd/format.c
@ -711,7 +711,7 @@ diff -rup binutils-2.26.orig/ld/emultempl/spuelf.em binutils-2.26/ld/emultempl/s
if (is_spu_target ())
{
@@ -432,7 +432,7 @@ gld${EMULATION_NAME}_finish (void)
einfo ("%P: --auto-overlay ignored with zero local store range\n");
einfo (_("%P: --auto-overlay ignored with zero local store range\n"));
}
- finish_default ();
@ -2417,3 +2417,23 @@ diff -rup binutils-2.26.orig/ld/scripttempl/pe.sc binutils-2.26/ld/scripttempl/p
LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation
-LDEMUL_FINISH=gld${EMULATION_NAME}_finish
+LDEMUL_FINISH=ppc_finish
--- binutils.orig/bfd/format.c 2018-01-22 16:04:36.855155517 +0000
+++ binutils-2.30.0/bfd/format.c 2018-01-22 16:11:36.546253154 +0000
@@ -47,6 +47,7 @@ SUBSECTION
#include "bfd.h"
#include "libbfd.h"
#if BFD_SUPPORTS_PLUGINS
+#include "plugin-api.h"
#include "plugin.h"
#endif
--- binutils.orig/ld/ldlang.c 2018-01-22 16:04:37.271150658 +0000
+++ binutils-2.30.0/ld/ldlang.c 2018-01-22 16:14:10.653453040 +0000
@@ -8954,6 +8954,7 @@ cmdline_object_only_list_append (cmdline
archive = abfd->my_archive;
if (archive)
break;
+ /* Fall through. */
case cmdline_is_file_enum:
cmdline_list_append (&cmdline_object_only_file_list, type, data);
return;

View File

@ -0,0 +1,11 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.27/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2017-02-21 10:45:19.311956006 +0000
+++ binutils-2.27/bfd/elfnn-aarch64.c 2017-02-21 11:55:07.517922655 +0000
@@ -4947,6 +4947,7 @@ elfNN_aarch64_final_link_relocate (reloc
it here if it is defined in a non-shared object. */
if (h != NULL
&& h->type == STT_GNU_IFUNC
+ && (input_section->flags & SEC_ALLOC)
&& h->def_regular)
{
asection *plt;

View File

@ -1,33 +0,0 @@
diff -rup binutils.orig/binutils/readelf.c binutils-2.28/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2017-03-20 17:06:41.260789454 +0000
+++ binutils-2.28/binutils/readelf.c 2017-03-20 17:08:09.181289807 +0000
@@ -4965,12 +4965,6 @@ process_program_headers (FILE * file)
section in the DYNAMIC segment. */
dynamic_addr = segment->p_offset;
dynamic_size = segment->p_filesz;
- /* PR binutils/17512: Avoid corrupt dynamic section info in the segment. */
- if (dynamic_addr + dynamic_size >= current_file_size)
- {
- error (_("the dynamic segment offset + size exceeds the size of the file\n"));
- dynamic_addr = dynamic_size = 0;
- }
/* Try to locate the .dynamic section. If there is
a section header table, we can easily locate it. */
@@ -5005,6 +4999,16 @@ process_program_headers (FILE * file)
warn (_("the .dynamic section is not the first section"
" in the dynamic segment.\n"));
}
+
+ /* PR binutils/17512: Avoid corrupt dynamic section info in the
+ segment. Check this after matching against the section headers
+ so we don't warn on debuginfo file (which have NOBITS .dynamic
+ sections). */
+ if (dynamic_addr + dynamic_size >= current_file_size)
+ {
+ error (_("the dynamic segment offset + size exceeds the size of the file\n"));
+ dynamic_addr = dynamic_size = 0;
+ }
break;
case PT_INTERP:

View File

@ -1,16 +1,14 @@
--- binutils.orig/binutils/readelf.c 2017-07-24 15:27:09.859116315 +0100
+++ binutils-2.29/binutils/readelf.c 2017-07-24 15:30:33.557770525 +0100
@@ -18414,39 +18414,50 @@ process_archive (char * file_name, FILE
static bfd_boolean
process_file (char * file_name)
{
+ char * name;
+ char * saved_program_name;
FILE * file;
--- binutils.orig/binutils/readelf.c 2018-01-22 15:48:10.450701702 +0000
+++ binutils-2.30.0/binutils/readelf.c 2018-01-22 15:55:26.739588657 +0000
@@ -19019,75 +19019,85 @@ process_file (char * file_name)
Filedata * filedata = NULL;
struct stat statbuf;
char armag[SARMAG];
bfd_boolean ret = TRUE;
- bfd_boolean ret = TRUE;
+ bfd_boolean ret = FALSE;
+ char * name;
+ char * saved_program_name;
+
+ /* Overload program_name to include file_name. Doing this means
+ that warning/error messages will positively identify the file
+ concerned even when multiple instances of readelf are running. */
@ -18,7 +16,7 @@
+ sprintf (name, "%s: %s", program_name, file_name);
+ saved_program_name = program_name;
+ program_name = name;
+
if (stat (file_name, &statbuf) < 0)
{
if (errno == ENOENT)
@ -41,32 +39,84 @@
+ goto done;
}
file = fopen (file_name, "rb");
if (file == NULL)
filedata = calloc (1, sizeof * filedata);
if (filedata == NULL)
{
error (_("Out of memory allocating file data structure\n"));
- return FALSE;
+ goto done;
}
filedata->file_name = file_name;
filedata->handle = fopen (file_name, "rb");
if (filedata->handle == NULL)
{
- error (_("Input file '%s' is not readable.\n"), file_name);
- free (filedata);
- return FALSE;
+ error (_("Not readable\n"));
+ goto done;
}
if (fread (armag, SARMAG, 1, file) != 1)
if (fread (armag, SARMAG, 1, filedata->handle) != 1)
{
- error (_("%s: Failed to read file's magic number\n"), file_name);
+ error (_("Failed to read file's magic number\n"));
fclose (file);
- fclose (filedata->handle);
- free (filedata);
- return FALSE;
+ ret = FALSE;
+ goto done;
- }
-
- filedata->file_size = (bfd_size_type) statbuf.st_size;
-
- if (memcmp (armag, ARMAG, SARMAG) == 0)
- {
- if (! process_archive (filedata, FALSE))
- ret = FALSE;
- }
- else if (memcmp (armag, ARMAGT, SARMAG) == 0)
- {
- if ( ! process_archive (filedata, TRUE))
- ret = FALSE;
+ error (_("Failed to read file's magic number\n"));
}
else
{
- if (do_archive_index)
- error (_("File %s is not an archive so its index cannot be displayed.\n"),
- file_name);
+ filedata->file_size = (bfd_size_type) statbuf.st_size;
- rewind (filedata->handle);
- archive_file_size = archive_file_offset = 0;
-
- if (! process_object (filedata))
- ret = FALSE;
+ if (memcmp (armag, ARMAG, SARMAG) == 0)
+ {
+ if (process_archive (filedata, FALSE))
+ ret = TRUE;
+ }
+ else if (memcmp (armag, ARMAGT, SARMAG) == 0)
+ {
+ if (process_archive (filedata, TRUE))
+ ret = TRUE;
+ }
+ else
+ {
+ if (do_archive_index)
+ error (_("Not an archive so its index cannot be displayed.\n"));
+
+ rewind (filedata->handle);
+ archive_file_size = archive_file_offset = 0;
+
+ if (process_object (filedata))
+ ret = TRUE;
+ }
}
current_file_size = (bfd_size_type) statbuf.st_size;
@@ -18474,7 +18484,10 @@ process_file (char * file_name)
}
fclose (file);
fclose (filedata->handle);
+ done:
current_file_size = 0;
free (filedata);
+ free (program_name);
+ program_name = saved_program_name;

View File

@ -1,60 +1,3 @@
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.29.1/bfd/elf32-i386.c
--- binutils.orig/bfd/elf32-i386.c 2017-11-15 13:32:41.209042711 +0000
+++ binutils-2.29.1/bfd/elf32-i386.c 2017-11-15 13:42:09.365205187 +0000
@@ -2747,24 +2747,6 @@ elf_i386_allocate_dynrelocs (struct elf_
if (h->type != STT_FUNC)
eh->func_pointer_refcount = 0;
- /* We can't use the GOT PLT if pointer equality is needed since
- finish_dynamic_symbol won't clear symbol value and the dynamic
- linker won't update the GOT slot. We will get into an infinite
- loop at run-time. */
- if (htab->plt_got != NULL
- && h->type != STT_GNU_IFUNC
- && !h->pointer_equality_needed
- && h->plt.refcount > 0
- && h->got.refcount > 0)
- {
- /* Don't use the regular PLT if there are both GOT and GOTPLT
- reloctions. */
- h->plt.offset = (bfd_vma) -1;
-
- /* Use the GOT PLT. */
- eh->plt_got.refcount = 1;
- }
-
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle it
here if it is defined and referenced in a non-shared object. */
if (h->type == STT_GNU_IFUNC
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.29.1/bfd/elf64-x86-64.c
--- binutils.orig/bfd/elf64-x86-64.c 2017-11-15 13:32:41.142043517 +0000
+++ binutils-2.29.1/bfd/elf64-x86-64.c 2017-11-15 13:41:45.030498045 +0000
@@ -3184,24 +3184,6 @@ elf_x86_64_allocate_dynrelocs (struct el
eh->has_got_reloc,
eh);
- /* We can't use the GOT PLT if pointer equality is needed since
- finish_dynamic_symbol won't clear symbol value and the dynamic
- linker won't update the GOT slot. We will get into an infinite
- loop at run-time. */
- if (htab->plt_got != NULL
- && h->type != STT_GNU_IFUNC
- && !h->pointer_equality_needed
- && h->plt.refcount > 0
- && h->got.refcount > 0)
- {
- /* Don't use the regular PLT if there are both GOT and GOTPLT
- reloctions. */
- h->plt.offset = (bfd_vma) -1;
-
- /* Use the GOT PLT. */
- eh->plt_got.refcount = 1;
- }
-
/* Clear the reference count of function pointer relocations if
symbol isn't a normal function. */
if (h->type != STT_FUNC)
diff -rup binutils.orig/ld/testsuite/ld-i386/pltgot-1.d binutils-2.29.1/ld/testsuite/ld-i386/pltgot-1.d
--- binutils.orig/ld/testsuite/ld-i386/pltgot-1.d 2017-11-15 13:32:39.335065263 +0000
+++ binutils-2.29.1/ld/testsuite/ld-i386/pltgot-1.d 2017-11-15 15:03:55.649727195 +0000
@ -143,7 +86,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.29.1/l
-#...
-Disassembly of section .plt.got:
-[a-f0-9]+ <[a-z]+@plt>:
-[a-f0-9]+ <[a-z_]+@plt>:
-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*>
+#...
[ ]*[a-f0-9]+: 90 nop
@ -302,3 +245,23 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.29.1/ld/tes
+\[[ 0-9]+\] .plt +.*
+\[[ 0-9]+\] .plt.got +.*
+\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+31a 00 +AX +0 +0 4096
--- binutils.orig/bfd/elfxx-x86.c 2018-01-22 15:59:25.875788033 +0000
+++ binutils-2.30.0/bfd/elfxx-x86.c 2018-01-22 16:00:20.789146597 +0000
@@ -107,7 +107,7 @@ elf_x86_allocate_dynrelocs (struct elf_l
plt_entry_size = htab->plt.plt_entry_size;
resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh);
-
+#if 0
/* We can't use the GOT PLT if pointer equality is needed since
finish_dynamic_symbol won't clear symbol value and the dynamic
linker won't update the GOT slot. We will get into an infinite
@@ -125,7 +125,7 @@ elf_x86_allocate_dynrelocs (struct elf_l
/* Use the GOT PLT. */
eh->plt_got.refcount = 1;
}
-
+#endif
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle it
here if it is defined and referenced in a non-shared object. */
if (h->type == STT_GNU_IFUNC

View File

@ -1,32 +0,0 @@
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2017-07-24 15:24:18.365091235 +0100
+++ binutils-2.29/ld/testsuite/ld-plugin/lto.exp 2017-07-24 15:25:25.567317336 +0100
@@ -301,9 +301,6 @@ set lto_link_elf_tests [list \
[list "PR ld/16746 (2)" \
"-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \
{dummy.c} {} "pr16746b.exe"] \
- [list "PR ld/14918" \
- "-flto" "-flto" \
- {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"] \
[list "Build pr21382a.o" \
"" "-O2 -flto" \
{pr21382a.c} {} "" "c"] \
@@ -312,6 +309,19 @@ set lto_link_elf_tests [list \
{pr21382b.c} {} "pr21382.so" "c"] \
]
+# PR 14918 checks that libgcc is not spuriously included in a shared link of
+# an empty program. The ARM crt1.o startup code however calls __libc_csu_init
+# in /usr/lib/libc_nonshared.a(elf-init.oS). This in turn needs
+# __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1, so the
+# test fails. Hence this code to skip the test.
+if { ! [istarget "arm*-*-*"] } {
+ set lto_link_elf_tests [concat $lto_link_elf_tests [list \
+ [list "PR ld/14918" \
+ "-flto" "-flto" \
+ {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"] \
+ ]]
+}
+
# Check final symbols in executables.
set lto_link_symbol_tests [list \
[list "LTO 3 symbol" \

View File

@ -1,153 +0,0 @@
diff -rup binutils.orig/gold/layout.cc binutils-2.29.1/gold/layout.cc
--- binutils.orig/gold/layout.cc 2017-10-18 12:00:31.990714767 +0100
+++ binutils-2.29.1/gold/layout.cc 2017-10-18 12:00:41.351604074 +0100
@@ -2211,10 +2211,11 @@ Layout::define_section_symbols(Symbol_ta
0, // symsize
elfcpp::STT_NOTYPE,
elfcpp::STB_GLOBAL,
- elfcpp::STV_DEFAULT,
+ elfcpp::STV_PROTECTED,
0, // nonvis
false, // offset_is_from_end
- true); // only_if_ref
+ true, // only_if_ref
+ true); // must_be_in_reg
symtab->define_in_output_data(stop_name.c_str(),
NULL, // version
@@ -2224,10 +2225,11 @@ Layout::define_section_symbols(Symbol_ta
0, // symsize
elfcpp::STT_NOTYPE,
elfcpp::STB_GLOBAL,
- elfcpp::STV_DEFAULT,
+ elfcpp::STV_PROTECTED,
0, // nonvis
true, // offset_is_from_end
- true); // only_if_ref
+ true, // only_if_ref
+ true); // must_be_in_reg
}
}
}
Only in binutils-2.29.1/gold: layout.cc.orig
diff -rup binutils.orig/gold/symtab.cc binutils-2.29.1/gold/symtab.cc
--- binutils.orig/gold/symtab.cc 2017-10-18 12:00:31.990714767 +0100
+++ binutils-2.29.1/gold/symtab.cc 2017-10-18 12:00:41.352604062 +0100
@@ -1760,7 +1760,9 @@ Sized_symbol<size>*
Symbol_table::define_special_symbol(const char** pname, const char** pversion,
bool only_if_ref,
Sized_symbol<size>** poldsym,
- bool* resolve_oldsym, bool is_forced_local)
+ bool* resolve_oldsym,
+ bool is_forced_local,
+ bool must_be_in_reg)
{
*resolve_oldsym = false;
*poldsym = NULL;
@@ -1797,7 +1799,11 @@ Symbol_table::define_special_symbol(cons
oldsym = this->lookup(*pname, *pversion);
if (oldsym == NULL && is_default_version)
oldsym = this->lookup(*pname, NULL);
- if (oldsym == NULL || !oldsym->is_undefined())
+ // If the symbol must be defined in a regular object, ignore
+ // definition from a dynamic object.
+ if (oldsym == NULL
+ || (!oldsym->is_undefined()
+ && (!must_be_in_reg || !oldsym->is_from_dynobj())))
return NULL;
*pname = oldsym->name();
@@ -1916,7 +1922,8 @@ Symbol_table::define_in_output_data(cons
elfcpp::STV visibility,
unsigned char nonvis,
bool offset_is_from_end,
- bool only_if_ref)
+ bool only_if_ref,
+ bool must_be_in_reg)
{
if (parameters->target().get_size() == 32)
{
@@ -1925,7 +1932,8 @@ Symbol_table::define_in_output_data(cons
value, symsize, type, binding,
visibility, nonvis,
offset_is_from_end,
- only_if_ref);
+ only_if_ref,
+ must_be_in_reg);
#else
gold_unreachable();
#endif
@@ -1937,7 +1945,8 @@ Symbol_table::define_in_output_data(cons
value, symsize, type, binding,
visibility, nonvis,
offset_is_from_end,
- only_if_ref);
+ only_if_ref,
+ must_be_in_reg);
#else
gold_unreachable();
#endif
@@ -1962,7 +1971,8 @@ Symbol_table::do_define_in_output_data(
elfcpp::STV visibility,
unsigned char nonvis,
bool offset_is_from_end,
- bool only_if_ref)
+ bool only_if_ref,
+ bool must_be_in_reg)
{
Sized_symbol<size>* sym;
Sized_symbol<size>* oldsym;
@@ -1975,7 +1985,8 @@ Symbol_table::do_define_in_output_data(
sym = this->define_special_symbol<size, true>(&name, &version,
only_if_ref, &oldsym,
&resolve_oldsym,
- is_forced_local);
+ is_forced_local,
+ must_be_in_reg);
#else
gold_unreachable();
#endif
@@ -1986,7 +1997,8 @@ Symbol_table::do_define_in_output_data(
sym = this->define_special_symbol<size, false>(&name, &version,
only_if_ref, &oldsym,
&resolve_oldsym,
- is_forced_local);
+ is_forced_local,
+ must_be_in_reg);
#else
gold_unreachable();
#endif
diff -rup binutils.orig/gold/symtab.h binutils-2.29.1/gold/symtab.h
--- binutils.orig/gold/symtab.h 2017-10-18 12:00:32.002714624 +0100
+++ binutils-2.29.1/gold/symtab.h 2017-10-18 12:00:41.352604062 +0100
@@ -1488,7 +1488,8 @@ class Symbol_table
Output_data*, uint64_t value, uint64_t symsize,
elfcpp::STT type, elfcpp::STB binding,
elfcpp::STV visibility, unsigned char nonvis,
- bool offset_is_from_end, bool only_if_ref);
+ bool offset_is_from_end, bool only_if_ref,
+ bool must_be_in_reg = false);
// Define a special symbol based on an Output_segment. It is a
// multiple definition error if this symbol is already defined.
@@ -1803,7 +1804,8 @@ class Symbol_table
Sized_symbol<size>*
define_special_symbol(const char** pname, const char** pversion,
bool only_if_ref, Sized_symbol<size>** poldsym,
- bool* resolve_oldsym, bool is_forced_local);
+ bool* resolve_oldsym, bool is_forced_local,
+ bool must_be_in_reg = false);
// Define a symbol in an Output_data, sized version.
template<int size>
@@ -1814,7 +1816,8 @@ class Symbol_table
typename elfcpp::Elf_types<size>::Elf_WXword ssize,
elfcpp::STT type, elfcpp::STB binding,
elfcpp::STV visibility, unsigned char nonvis,
- bool offset_is_from_end, bool only_if_ref);
+ bool offset_is_from_end, bool only_if_ref,
+ bool must_be_in_reg = false);
// Define a symbol in an Output_segment, sized version.
template<int size>
Only in binutils-2.29.1/gold: symtab.h.orig

View File

@ -1,55 +0,0 @@
diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.29.1/binutils/doc/binutils.texi
--- binutils.orig/binutils/doc/binutils.texi 2017-11-01 11:44:12.360707737 +0000
+++ binutils-2.29.1/binutils/doc/binutils.texi 2017-11-01 11:45:38.702652255 +0000
@@ -4661,8 +4661,13 @@ given.
@itemx --all
Equivalent to specifying @option{--file-header},
@option{--program-headers}, @option{--sections}, @option{--symbols},
-@option{--relocs}, @option{--dynamic}, @option{--notes} and
-@option{--version-info}.
+@option{--relocs}, @option{--dynamic}, @option{--notes},
+@option{--version-info}, @option{--arch-specific}, @option{--unwind},
+@option{--section-groups} and @option{--histogram}.
+
+Note - this option does not enable @option{--use-dynamic} itself, so
+if that option is not present on the command line then dynamic symbols
+and dynamic relocs will not be displayed.
@item -h
@itemx --file-header
@@ -4758,6 +4763,9 @@ When displaying symbols, this option mak
symbol hash tables in the file's dynamic section, rather than the
symbol table sections.
+When displaying relocations, this option makes @command{readelf}
+display the dynamic relocations rather than the static relocations.
+
@item -x <number or name>
@itemx --hex-dump=<number or name>
Displays the contents of the indicated section as a hexadecimal bytes.
diff -rup binutils.orig/binutils/readelf.c binutils-2.29.1/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2017-11-01 11:44:12.357707774 +0000
+++ binutils-2.29.1/binutils/readelf.c 2017-11-01 11:45:11.901979878 +0000
@@ -7117,7 +7117,21 @@ process_relocs (FILE * file)
}
if (! found)
- printf (_("\nThere are no relocations in this file.\n"));
+ {
+ /* Users sometimes forget the -D option, so try to be helpful. */
+ for (i = 0; i < ARRAY_SIZE (dynamic_relocations); i++)
+ {
+ if (dynamic_info [dynamic_relocations [i].size])
+ {
+ printf (_("\nThere are no static relocations in this file."));
+ printf (_("\nTo see the dynamic relocations add --use-dynamic to the command line.\n"));
+
+ break;
+ }
+ }
+ if (i == ARRAY_SIZE (dynamic_relocations))
+ printf (_("\nThere are no relocations in this file.\n"));
+ }
}
return TRUE;

Binary file not shown.

View File

@ -1,193 +0,0 @@
Only in binutils-2.29.1/bfd: ChangeLog.orig
Only in binutils-2.29.1/bfd: ChangeLog.rej
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.29.1/bfd/elf64-s390.c
--- binutils.orig/bfd/elf64-s390.c 2018-01-22 12:10:06.282231202 +0000
+++ binutils-2.29.1/bfd/elf64-s390.c 2018-01-22 12:32:36.743617339 +0000
@@ -1600,8 +1600,7 @@ elf_s390_adjust_dynamic_symbol (struct b
{
if (h->plt.refcount <= 0
|| SYMBOL_CALLS_LOCAL (info, h)
- || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak))
+ || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
{
/* This case can occur if we saw a PLT32 reloc in an input
file, but the symbol was never referred to by a dynamic
@@ -1850,8 +1849,7 @@ allocate_dynrelocs (struct elf_link_hash
htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
else if (tls_type == GOT_TLS_GD)
htab->elf.srelgot->size += 2 * sizeof (Elf64_External_Rela);
- else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
+ else if (!UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)
&& (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
@@ -1890,7 +1888,8 @@ allocate_dynrelocs (struct elf_link_hash
if (eh->dyn_relocs != NULL
&& h->root.type == bfd_link_hash_undefweak)
{
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
eh->dyn_relocs = NULL;
/* Make sure undefined weak symbols are output as a dynamic
@@ -2307,6 +2306,7 @@ elf_s390_relocate_section (bfd *output_b
bfd_reloc_status_type r;
int tls_type;
asection *base_got = htab->elf.sgot;
+ bfd_boolean resolved_to_zero;
r_type = ELF64_R_TYPE (rel->r_info);
if (r_type == (int) R_390_GNU_VTINHERIT
@@ -2402,6 +2402,9 @@ elf_s390_relocate_section (bfd *output_b
if (bfd_link_relocatable (info))
continue;
+ resolved_to_zero = (h != NULL
+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
+
switch (r_type)
{
case R_390_GOTPLT12:
@@ -2489,8 +2492,7 @@ elf_s390_relocate_section (bfd *output_b
h)
|| (bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))
- || (ELF_ST_VISIBILITY (h->other)
- && h->root.type == bfd_link_hash_undefweak))
+ || resolved_to_zero)
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
@@ -2804,7 +2806,8 @@ elf_s390_relocate_section (bfd *output_b
if ((bfd_link_pic (info)
&& (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ && !resolved_to_zero)
|| h->root.type != bfd_link_hash_undefweak)
&& ((r_type != R_390_PC16
&& r_type != R_390_PC12DBL
@@ -3592,6 +3595,9 @@ elf_s390_finish_dynamic_symbol (bfd *out
else if (bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))
{
+ if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
+ return TRUE;
+
/* If this is a static link, or it is a -Bsymbolic link and
the symbol is defined locally or was forced to be local
because of a version file, we just want to emit a
Only in binutils-2.29.1/bfd: elf64-s390.c.orig
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.29.1/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2018-01-22 12:10:06.277231259 +0000
+++ binutils-2.29.1/bfd/elf-bfd.h 2018-01-22 12:30:14.318245660 +0000
@@ -266,6 +266,13 @@ struct elf_link_hash_entry
#define SYMBOL_CALLS_LOCAL(INFO, H) \
_bfd_elf_symbol_refs_local_p (H, INFO, 1)
+/* Whether an undefined weak symbol should resolve to its link-time
+ value, even in PIC or PIE objects. */
+#define UNDEFWEAK_NO_DYNAMIC_RELOC(INFO, H) \
+ ((H)->root.type == bfd_link_hash_undefweak \
+ && (ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT \
+ || (INFO)->dynamic_undefined_weak == 0))
+
/* Common symbols that are turned into definitions don't have the
DEF_REGULAR flag set, so they might appear to be undefined.
Symbols defined in linker scripts also don't have DEF_REGULAR set. */
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.29.1/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2018-01-22 12:10:06.271231328 +0000
+++ binutils-2.29.1/bfd/elfnn-aarch64.c 2018-01-22 12:35:13.030825190 +0000
@@ -4578,7 +4578,7 @@ aarch64_can_relax_tls (bfd *input_bfd,
if (symbol_got_type == GOT_TLS_IE && GOT_TLS_GD_ANY_P (reloc_got_type))
return TRUE;
- if (bfd_link_pic (info))
+ if (!bfd_link_executable (info))
return FALSE;
if (h && h->root.type == bfd_link_hash_undefweak)
@@ -4951,6 +4951,7 @@ elfNN_aarch64_final_link_relocate (reloc
bfd_boolean relative_reloc;
asection *base_got;
bfd_vma orig_value = value;
+ bfd_boolean resolved_to_zero;
globals = elf_aarch64_hash_table (info);
@@ -5176,6 +5177,9 @@ bad_ifunc_reloc:
}
}
+ resolved_to_zero = (h != NULL
+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
+
switch (bfd_r_type)
{
case BFD_RELOC_AARCH64_NONE:
@@ -5194,7 +5198,8 @@ bad_ifunc_reloc:
|| globals->root.is_relocatable_executable)
&& (input_section->flags & SEC_ALLOC)
&& (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ && !resolved_to_zero)
|| h->root.type != bfd_link_hash_undefweak))
/* Or we are creating an executable, we may need to keep relocations
for symbols satisfied by a dynamic library if we manage to avoid
@@ -6246,7 +6251,7 @@ elfNN_aarch64_relocate_section (bfd *out
indx = h && h->dynindx != -1 ? h->dynindx : 0;
need_relocs =
- (bfd_link_pic (info) || indx != 0) &&
+ (!bfd_link_executable (info) || indx != 0) &&
(h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak);
@@ -6341,7 +6346,7 @@ elfNN_aarch64_relocate_section (bfd *out
indx = h && h->dynindx != -1 ? h->dynindx : 0;
need_relocs =
- (bfd_link_pic (info) || indx != 0) &&
+ (!bfd_link_executable (info) || indx != 0) &&
(h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak);
@@ -8195,7 +8200,10 @@ elfNN_aarch64_allocate_dynrelocs (struct
if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak)
&& (bfd_link_pic (info)
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
+ /* Undefined weak symbol in static PIE resolves to 0 without
+ any dynamic relocations. */
+ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
{
htab->root.srelgot->size += RELOC_SIZE (htab);
}
@@ -8227,7 +8235,7 @@ elfNN_aarch64_allocate_dynrelocs (struct
indx = h && h->dynindx != -1 ? h->dynindx : 0;
if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak)
- && (bfd_link_pic (info)
+ && (!bfd_link_executable (info)
|| indx != 0
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
{
@@ -8995,7 +9003,10 @@ elfNN_aarch64_finish_dynamic_symbol (bfd
}
if (h->got.offset != (bfd_vma) - 1
- && elf_aarch64_hash_entry (h)->got_type == GOT_NORMAL)
+ && elf_aarch64_hash_entry (h)->got_type == GOT_NORMAL
+ /* Undefined weak symbol in static PIE resolves to 0 without
+ any dynamic relocations. */
+ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
{
Elf_Internal_Rela rela;
bfd_byte *loc;
Only in binutils-2.29.1/bfd: elfnn-aarch64.c.orig

View File

@ -0,0 +1,77 @@
diff --git a/bfd/elf.c b/bfd/elf.c
index c132098558..325bdd545a 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4727,33 +4727,35 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
the previous section, then we need a new segment. */
new_segment = TRUE;
}
+ else if ((abfd->flags & D_PAGED) != 0
+ && (((last_hdr->lma + last_size - 1) & -maxpagesize)
+ == (hdr->lma & -maxpagesize)))
+ {
+ /* If we are demand paged then we can't map two disk
+ pages onto the same memory page. */
+ new_segment = FALSE;
+ }
/* In the next test we have to be careful when last_hdr->lma is close
to the end of the address space. If the aligned address wraps
around to the start of the address space, then there are no more
pages left in memory and it is OK to assume that the current
section can be included in the current segment. */
- else if ((BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) + maxpagesize
- > last_hdr->lma)
- && (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) + maxpagesize
- <= hdr->lma))
+ else if ((BFD_ALIGN (last_hdr->lma + last_size, maxpagesize)
+ + maxpagesize > last_hdr->lma)
+ && (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize)
+ + maxpagesize <= hdr->lma))
{
/* If putting this section in this segment would force us to
skip a page in the segment, then we need a new segment. */
new_segment = TRUE;
}
else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0
- && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0
- && ((abfd->flags & D_PAGED) == 0
- || (((last_hdr->lma + last_size - 1) & -maxpagesize)
- != (hdr->lma & -maxpagesize))))
+ && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0)
{
/* We don't want to put a loaded section after a
nonloaded (ie. bss style) section in the same segment
as that will force the non-loaded section to be loaded.
- Consider .tbss sections as loaded for this purpose.
- However, like the writable/non-writable case below,
- if they are on the same page then they must be put
- in the same segment. */
+ Consider .tbss sections as loaded for this purpose. */
new_segment = TRUE;
}
else if ((abfd->flags & D_PAGED) == 0)
@@ -4769,21 +4771,11 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
{
new_segment = TRUE;
}
- else if (! writable
- && (hdr->flags & SEC_READONLY) == 0
- && ((info != NULL
- && info->relro_end > info->relro_start)
- || (((last_hdr->lma + last_size - 1) & -maxpagesize)
- != (hdr->lma & -maxpagesize))))
+ else if (! writable
+ && (hdr->flags & SEC_READONLY) == 0)
{
/* We don't want to put a writable section in a read only
- segment, unless they are on the same page in memory
- anyhow and there is no RELRO segment. We already
- know that the last section does not bring us past the
- current section on the page, so the only case in which
- the new section is not on the same page as the previous
- section is when the previous section ends precisely on
- a page boundary. */
+ segment. */
new_segment = TRUE;
}
else

View File

@ -1,22 +0,0 @@
--- binutils.orig/bfd/elf64-ppc.c 2018-01-25 13:23:13.575860963 +0000
+++ binutils-2.29.1/bfd/elf64-ppc.c 2018-01-25 13:24:36.564874275 +0000
@@ -12805,6 +12805,9 @@ ppc64_elf_size_stubs (struct bfd_link_in
stub_sec->flags &= ~SEC_RELOC;
}
+ if (htab->stub_iteration <= STUB_SHRINK_ITER
+ || htab->brlt->rawsize < htab->brlt->size)
+ htab->brlt->rawsize = htab->brlt->size;
htab->brlt->size = 0;
htab->brlt->reloc_count = 0;
htab->brlt->flags &= ~SEC_RELOC;
@@ -12858,6 +12861,9 @@ ppc64_elf_size_stubs (struct bfd_link_in
break;
if (group == NULL
+ && (htab->brlt->rawsize == htab->brlt->size
+ || (htab->stub_iteration > STUB_SHRINK_ITER
+ && htab->brlt->rawsize > htab->brlt->size))
&& (htab->glink_eh_frame == NULL
|| htab->glink_eh_frame->rawsize == htab->glink_eh_frame->size))
break;

View File

@ -11,11 +11,11 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
table being generated, but for the moment this case is very
rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (psym->st_other ^ vis));
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+#endif
}
printf (" %3.3s ", get_symbol_index_type (psym->st_shndx));
printf (" %3.3s ", get_symbol_index_type (filedata, psym->st_shndx));
@@ -11031,6 +11033,15 @@ print_dynamic_symbol (bfd_vma si, unsign
print_symbol (25, GET_DYNAMIC_NAME (psym->st_name));
else
@ -26,7 +26,7 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
+
+ /* Check to see if any other bits in the st_other field are set. */
+ if (psym->st_other ^ vis)
+ printf (" \t[%s]", get_symbol_other (psym->st_other ^ vis));
+ printf (" \t[%s]", get_symbol_other (filedata, psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');
@ -43,10 +43,10 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
Note - displaying this information disrupts the layout of the
table being generated, but for the moment this case is very rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (psym->st_other ^ vis));
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+#endif
}
printf (" %4s ", get_symbol_index_type (psym->st_shndx));
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
print_symbol (25, psym->st_name < strtab_size
@@ -11571,7 +11573,15 @@ process_symbol_table (FILE * file)
printf (sym_info == symbol_hidden ? "@%s" : "@@%s",
@ -58,7 +58,7 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
+ /* Check to see if any other bits in the st_other field are set. */
+ if (psym->st_other ^ vis)
+ printf (" \t[%s] ", get_symbol_other (psym->st_other ^ vis));
+ printf (" \t[%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');

View File

@ -0,0 +1,749 @@
diff -rup binutils.orig/bfd/elf32-ppc.c binutils-2.30/bfd/elf32-ppc.c
--- binutils.orig/bfd/elf32-ppc.c 2018-02-08 10:49:07.649185371 +0000
+++ binutils-2.30/bfd/elf32-ppc.c 2018-02-08 10:50:11.058395459 +0000
@@ -69,7 +69,7 @@ static bfd_reloc_status_type ppc_elf_unh
/* For new-style .glink and .plt. */
#define GLINK_PLTRESOLVE 16*4
#define GLINK_ENTRY_SIZE(htab, h) \
- (((!htab->params->speculate_indirect_jumps ? 6*4 : 4*4) \
+ ((4*4 \
+ (h != NULL \
&& h == htab->tls_get_addr \
&& !htab->params->no_tls_get_addr_opt ? 8*4 : 0) \
@@ -155,8 +155,6 @@ static const bfd_vma ppc_elf_vxworks_pic
#define BA 0x48000002
#define BCL_20_31 0x429f0005
#define BCTR 0x4e800420
-#define CRSETEQ 0x4c421242
-#define BEQCTRM 0x4dc20420
#define BEQLR 0x4d820020
#define CMPWI_11_0 0x2c0b0000
#define LIS_11 0x3d600000
@@ -2880,14 +2878,15 @@ ppc_elf_final_write_processing (bfd *abf
static bfd_boolean
is_nonpic_glink_stub (bfd *abfd, asection *glink, bfd_vma off)
{
- bfd_byte buf[3 * 4];
+ bfd_byte buf[4 * 4];
if (!bfd_get_section_contents (abfd, glink, buf, off, sizeof buf))
return FALSE;
return ((bfd_get_32 (abfd, buf + 0) & 0xffff0000) == LIS_11
&& (bfd_get_32 (abfd, buf + 4) & 0xffff0000) == LWZ_11_11
- && bfd_get_32 (abfd, buf + 8) == MTCTR_11);
+ && bfd_get_32 (abfd, buf + 8) == MTCTR_11
+ && bfd_get_32 (abfd, buf + 12) == BCTR);
}
static bfd_boolean
@@ -3366,7 +3365,7 @@ ppc_elf_link_hash_table_create (bfd *abf
{
struct ppc_elf_link_hash_table *ret;
static struct ppc_elf_params default_params
- = { PLT_OLD, 0, 1, 0, 1, 0, 0, 12, 0, 0, 0 };
+ = { PLT_OLD, 0, 0, 1, 0, 0, 12, 0, 0, 0 };
ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table));
if (ret == NULL)
@@ -7171,8 +7170,6 @@ ppc_elf_relax_section (bfd *abfd,
size = 4 * ARRAY_SIZE (stub_entry);
insn_offset = 0;
}
- if (!htab->params->speculate_indirect_jumps)
- size += 8;
stub_rtype = R_PPC_RELAX;
if (tsec == htab->elf.splt
|| tsec == htab->glink)
@@ -7454,26 +7451,6 @@ elf_finish_pointer_linker_section (bfd *
#define PPC_HI(v) (((v) >> 16) & 0xffff)
#define PPC_HA(v) PPC_HI ((v) + 0x8000)
-static inline bfd_byte *
-output_bctr (struct ppc_elf_link_hash_table *htab, bfd *obfd, bfd_byte *p)
-{
- if (!htab->params->speculate_indirect_jumps)
- {
- bfd_put_32 (obfd, CRSETEQ, p);
- p += 4;
- bfd_put_32 (obfd, BEQCTRM, p);
- p += 4;
- bfd_put_32 (obfd, B, p);
- p += 4;
- }
- else
- {
- bfd_put_32 (obfd, BCTR, p);
- p += 4;
- }
- return p;
-}
-
static void
write_glink_stub (struct elf_link_hash_entry *h, struct plt_entry *ent,
asection *plt_sec, unsigned char *p,
@@ -7541,7 +7518,8 @@ write_glink_stub (struct elf_link_hash_e
p += 4;
bfd_put_32 (output_bfd, MTCTR_11, p);
p += 4;
- p = output_bctr (htab, output_bfd, p);
+ bfd_put_32 (output_bfd, BCTR, p);
+ p += 4;
while (p < end)
{
bfd_put_32 (output_bfd, htab->params->ppc476_workaround ? BA : NOP, p);
@@ -8979,7 +8957,6 @@ ppc_elf_relocate_section (bfd *output_bf
stub = stub_entry;
size = ARRAY_SIZE (stub_entry);
}
- --size;
relocation += addend;
if (bfd_link_relocatable (info))
@@ -9004,7 +8981,6 @@ ppc_elf_relocate_section (bfd *output_bf
bfd_put_32 (input_bfd, insn, contents + insn_offset);
insn_offset += 4;
}
- output_bctr (htab, input_bfd, contents + insn_offset);
/* Rewrite the reloc and convert one of the trailing nop
relocs to describe this relocation. */
@@ -10713,7 +10689,8 @@ ppc_elf_finish_dynamic_sections (bfd *ou
p += 4;
bfd_put_32 (output_bfd, ADD_11_0_11, p);
p += 4;
- p = output_bctr (htab, output_bfd, p);
+ bfd_put_32 (output_bfd, BCTR, p);
+ p += 4;
while (p < endp)
{
bfd_put_32 (output_bfd,
diff -rup binutils.orig/bfd/elf32-ppc.h binutils-2.30/bfd/elf32-ppc.h
--- binutils.orig/bfd/elf32-ppc.h 2018-02-08 10:49:07.644185433 +0000
+++ binutils-2.30/bfd/elf32-ppc.h 2018-02-08 10:50:11.058395459 +0000
@@ -35,9 +35,6 @@ struct ppc_elf_params
/* Set if individual PLT call stubs should be aligned. */
int plt_stub_align;
- /* Clear if PLT call stubs should use a speculative execution barrier. */
- int speculate_indirect_jumps;
-
/* Whether to emit symbols for stubs. */
int emit_stub_syms;
diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.30/bfd/elf64-ppc.c
--- binutils.orig/bfd/elf64-ppc.c 2018-02-08 10:49:07.645185421 +0000
+++ binutils-2.30/bfd/elf64-ppc.c 2018-02-08 10:50:11.060395434 +0000
@@ -161,10 +161,6 @@ static bfd_vma opd_entry_value
#define LD_R11_0R11 0xe96b0000 /* ld %r11,xxx+16@l(%r11) */
#define BCTR 0x4e800420 /* bctr */
-#define CRSETEQ 0x4c421242 /* crset 4*%cr0+%eq */
-#define BEQCTRM 0x4dc20420 /* beqctr- */
-#define BEQCTRLM 0x4dc20421 /* beqctrl- */
-
#define ADDI_R11_R11 0x396b0000 /* addi %r11,%r11,off@l */
#define ADDIS_R2_R2 0x3c420000 /* addis %r2,%r2,off@ha */
#define ADDI_R2_R2 0x38420000 /* addi %r2,%r2,off@l */
@@ -193,8 +189,7 @@ static bfd_vma opd_entry_value
/* __glink_PLTresolve stub instructions. We enter with the index in R0. */
#define GLINK_PLTRESOLVE_SIZE(htab) \
- (8u + (htab->opd_abi ? 11 * 4 : 14 * 4) \
- + (!htab->params->speculate_indirect_jumps ? 2 * 4 : 0))
+ (8u + (htab->opd_abi ? 11 * 4 : 14 * 4))
/* 0: */
/* .quad plt0-1f */
/* __glink: */
@@ -9886,8 +9881,6 @@ size_global_entry_stubs (struct elf_link
unsigned int align_power;
stub_size = 16;
- if (!htab->params->speculate_indirect_jumps)
- stub_size += 8;
stub_off = s->size;
if (htab->params->plt_stub_align >= 0)
align_power = htab->params->plt_stub_align;
@@ -10453,8 +10446,6 @@ plt_stub_size (struct ppc_link_hash_tabl
size += 4;
if (PPC_HA (off) != 0)
size += 4;
- if (!htab->params->speculate_indirect_jumps)
- size += 8;
if (htab->opd_abi)
{
size += 4;
@@ -10476,11 +10467,7 @@ plt_stub_size (struct ppc_link_hash_tabl
size += 7 * 4;
if (ALWAYS_EMIT_R2SAVE
|| stub_entry->stub_type == ppc_stub_plt_call_r2save)
- {
- size += 6 * 4;
- if (!htab->params->speculate_indirect_jumps)
- size -= 4;
- }
+ size += 6 * 4;
}
return size;
}
@@ -10515,26 +10502,6 @@ plt_stub_pad (struct ppc_link_hash_table
return 0;
}
-static inline bfd_byte *
-output_bctr (struct ppc_link_hash_table *htab, bfd *obfd, bfd_byte *p)
-{
- if (!htab->params->speculate_indirect_jumps)
- {
- bfd_put_32 (obfd, CRSETEQ, p);
- p += 4;
- bfd_put_32 (obfd, BEQCTRM, p);
- p += 4;
- bfd_put_32 (obfd, B_DOT, p);
- p += 4;
- }
- else
- {
- bfd_put_32 (obfd, BCTR, p);
- p += 4;
- }
- return p;
-}
-
/* Build a .plt call stub. */
static inline bfd_byte *
@@ -10555,7 +10522,6 @@ build_plt_stub (struct ppc_link_hash_tab
if (!ALWAYS_USE_FAKE_DEP
&& plt_load_toc
&& plt_thread_safe
- && htab->params->speculate_indirect_jumps
&& !((stub_entry->h == htab->tls_get_addr_fd
|| stub_entry->h == htab->tls_get_addr)
&& htab->params->tls_get_addr_opt))
@@ -10710,7 +10676,7 @@ build_plt_stub (struct ppc_link_hash_tab
bfd_put_32 (obfd, B_DOT | (cmp_branch_off & 0x3fffffc), p), p += 4;
}
else
- p = output_bctr (htab, obfd, p);
+ bfd_put_32 (obfd, BCTR, p), p += 4;
return p;
}
@@ -10754,13 +10720,7 @@ build_tls_get_addr_stub (struct ppc_link
if (r != NULL)
r[0].r_offset += 2 * 4;
p = build_plt_stub (htab, stub_entry, p, offset, r);
- if (!htab->params->speculate_indirect_jumps)
- {
- p -= 4;
- bfd_put_32 (obfd, BEQCTRLM, p - 4);
- }
- else
- bfd_put_32 (obfd, BCTRL, p - 4);
+ bfd_put_32 (obfd, BCTRL, p - 4);
bfd_put_32 (obfd, LD_R2_0R1 + STK_TOC (htab), p), p += 4;
bfd_put_32 (obfd, LD_R11_0R1 + STK_LINKER (htab), p), p += 4;
@@ -11113,7 +11073,8 @@ ppc_build_one_stub (struct bfd_hash_entr
p += 4;
bfd_put_32 (htab->params->stub_bfd, MTCTR_R12, p);
p += 4;
- p = output_bctr (htab, htab->params->stub_bfd, p);
+ bfd_put_32 (htab->params->stub_bfd, BCTR, p);
+ p += 4;
break;
case ppc_stub_plt_call:
@@ -11446,8 +11407,6 @@ ppc_size_one_stub (struct bfd_hash_entry
if (PPC_LO (r2off) != 0)
size += 4;
}
- if (!htab->params->speculate_indirect_jumps)
- size += 8;
}
else if (info->emitrelocations)
{
@@ -13089,7 +13048,7 @@ build_global_entry_stubs (struct elf_lin
p += 4;
bfd_put_32 (s->owner, MTCTR_R12, p);
p += 4;
- output_bctr (htab, s->owner, p);
+ bfd_put_32 (s->owner, BCTR, p);
break;
}
return TRUE;
@@ -13218,7 +13177,8 @@ ppc64_elf_build_stubs (struct bfd_link_i
bfd_put_32 (htab->glink->owner, LD_R11_0R11 | 8, p);
p += 4;
}
- p = output_bctr (htab, htab->glink->owner, p);
+ bfd_put_32 (htab->glink->owner, BCTR, p);
+ p += 4;
BFD_ASSERT (p == htab->glink->contents + GLINK_PLTRESOLVE_SIZE (htab));
/* Build the .glink lazy link call stubs. */
diff -rup binutils.orig/bfd/elf64-ppc.h binutils-2.30/bfd/elf64-ppc.h
--- binutils.orig/bfd/elf64-ppc.h 2018-02-08 10:49:07.637185520 +0000
+++ binutils-2.30/bfd/elf64-ppc.h 2018-02-08 10:50:11.060395434 +0000
@@ -51,9 +51,6 @@ struct ppc64_elf_params
/* Set if PLT call stubs for localentry:0 functions should omit r2 save. */
int plt_localentry0;
- /* Clear if PLT call stubs should use a speculative execution barrier. */
- int speculate_indirect_jumps;
-
/* Whether to canonicalize .opd so that there are no overlapping
.opd entries. */
int non_overlapping_opd;
diff -rup binutils.orig/gold/options.h binutils-2.30/gold/options.h
--- binutils.orig/gold/options.h 2018-02-08 10:49:07.354189045 +0000
+++ binutils-2.30/gold/options.h 2018-02-08 10:50:11.060395434 +0000
@@ -1108,10 +1108,6 @@ class General_options
N_("(PowerPC64 only) Optimize calls to ELFv2 localentry:0 functions"),
N_("(PowerPC64 only) Don't optimize ELFv2 calls"));
- DEFINE_bool(speculate_indirect_jumps, options::TWO_DASHES, '\0', true,
- N_("(PowerPC only) PLT call stubs without speculation barrier"),
- N_("(PowerPC only) PLT call stubs with speculation barrier"));
-
DEFINE_bool(plt_static_chain, options::TWO_DASHES, '\0', false,
N_("(PowerPC64 only) PLT call stubs should load r11"),
N_("(PowerPC64 only) PLT call stubs should not load r11"));
diff -rup binutils.orig/gold/powerpc.cc binutils-2.30/gold/powerpc.cc
--- binutils.orig/gold/powerpc.cc 2018-02-08 10:49:07.355189033 +0000
+++ binutils-2.30/gold/powerpc.cc 2018-02-08 10:50:11.061395422 +0000
@@ -3781,8 +3781,6 @@ static const uint32_t b = 0x48000000;
static const uint32_t bcl_20_31 = 0x429f0005;
static const uint32_t bctr = 0x4e800420;
static const uint32_t bctrl = 0x4e800421;
-static const uint32_t beqctrm = 0x4dc20420;
-static const uint32_t beqctrlm = 0x4dc20421;
static const uint32_t beqlr = 0x4d820020;
static const uint32_t blr = 0x4e800020;
static const uint32_t bnectr_p4 = 0x4ce20420;
@@ -3792,7 +3790,6 @@ static const uint32_t cmpdi_11_0 = 0x2c2
static const uint32_t cmpwi_11_0 = 0x2c0b0000;
static const uint32_t cror_15_15_15 = 0x4def7b82;
static const uint32_t cror_31_31_31 = 0x4ffffb82;
-static const uint32_t crseteq = 0x4c421242;
static const uint32_t ld_0_1 = 0xe8010000;
static const uint32_t ld_0_12 = 0xe80c0000;
static const uint32_t ld_2_1 = 0xe8410000;
@@ -4168,24 +4165,6 @@ write_insn(unsigned char* p, uint32_t v)
elfcpp::Swap<32, big_endian>::writeval(p, v);
}
-template<bool big_endian>
-static unsigned char*
-output_bctr(unsigned char* p)
-{
- if (!parameters->options().speculate_indirect_jumps())
- {
- write_insn<big_endian>(p, crseteq);
- p += 4;
- write_insn<big_endian>(p, beqctrm);
- p += 4;
- write_insn<big_endian>(p, b);
- }
- else
- write_insn<big_endian>(p, bctr);
- p += 4;
- return p;
-}
-
template<int size>
static inline unsigned int
param_plt_align()
@@ -4454,7 +4433,6 @@ class Stub_table : public Output_relaxed
{
const Symbol* gsym = p->first.sym_;
return (4 * 4
- + (!parameters->options().speculate_indirect_jumps() ? 2 * 4 : 0)
+ (this->targ_->is_tls_get_addr_opt(gsym) ? 8 * 4 : 0));
}
@@ -4470,8 +4448,6 @@ class Stub_table : public Output_relaxed
got_addr += ppcobj->toc_base_offset();
Address off = plt_addr - got_addr;
unsigned int bytes = 4 * 4 + 4 * (ha(off) != 0);
- if (!parameters->options().speculate_indirect_jumps())
- bytes += 2 * 4;
const Symbol* gsym = p->first.sym_;
if (this->targ_->is_tls_get_addr_opt(gsym))
bytes += 13 * 4;
@@ -4502,8 +4478,6 @@ class Stub_table : public Output_relaxed
if (p->first.dest_ - loc + (1 << 25) < 2 << 25)
return 4;
unsigned int bytes = 16;
- if (!parameters->options().speculate_indirect_jumps())
- bytes += 8;
if (size == 32 && parameters->options().output_is_position_independent())
bytes += 16;
return bytes;
@@ -4955,8 +4929,7 @@ class Output_data_glink : public Output_
{
if (size == 64)
return (8
- + (this->targ_->abiversion() < 2 ? 11 * 4 : 14 * 4)
- + (!parameters->options().speculate_indirect_jumps() ? 2 * 4 : 0));
+ + (this->targ_->abiversion() < 2 ? 11 * 4 : 14 * 4));
return 16 * 4;
}
@@ -5033,8 +5006,7 @@ Output_data_glink<size, big_endian>::add
std::pair<typename Global_entry_stub_entries::iterator, bool> p
= this->global_entry_stubs_.insert(std::make_pair(gsym, off));
if (p.second)
- this->ge_size_
- = off + 16 + (!parameters->options().speculate_indirect_jumps() ? 8 : 0);
+ this->ge_size_ = off + 16;
}
template<int size, bool big_endian>
@@ -5223,10 +5195,7 @@ Stub_table<size, big_endian>::do_write(O
= plt_load_toc && this->targ_->plt_thread_safe();
bool use_fake_dep = false;
Address cmp_branch_off = 0;
- if (thread_safe
- && !parameters->options().speculate_indirect_jumps())
- use_fake_dep = true;
- else if (thread_safe)
+ if (thread_safe)
{
unsigned int pltindex
= ((pltoff - this->targ_->first_plt_entry_offset())
@@ -5274,7 +5243,7 @@ Stub_table<size, big_endian>::do_write(O
+ this->targ_->stk_linker()));
p += 4;
}
- use_fake_dep |= thread_safe;
+ use_fake_dep = thread_safe;
}
if (ha(off) != 0)
{
@@ -5365,14 +5334,7 @@ Stub_table<size, big_endian>::do_write(O
if (!cs->second.localentry0_
&& this->targ_->is_tls_get_addr_opt(gsym))
{
- if (!parameters->options().speculate_indirect_jumps())
- {
- write_insn<big_endian>(p, crseteq);
- p += 4;
- write_insn<big_endian>(p, beqctrlm);
- }
- else
- write_insn<big_endian>(p, bctrl);
+ write_insn<big_endian>(p, bctrl);
p += 4;
write_insn<big_endian>(p, ld_2_1 + this->targ_->stk_toc());
p += 4;
@@ -5391,7 +5353,7 @@ Stub_table<size, big_endian>::do_write(O
write_insn<big_endian>(p, b | (cmp_branch_off & 0x3fffffc));
}
else
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
@@ -5426,7 +5388,7 @@ Stub_table<size, big_endian>::do_write(O
write_insn<big_endian>(p, ld_12_12 + l(brltoff)), p += 4;
}
write_insn<big_endian>(p, mtctr_12), p += 4;
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
}
@@ -5522,7 +5484,7 @@ Stub_table<size, big_endian>::do_write(O
p += 4;
write_insn<big_endian>(p, mtctr_11);
p += 4;
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
@@ -5563,7 +5525,7 @@ Stub_table<size, big_endian>::do_write(O
p += 4;
write_insn<big_endian>(p, mtctr_12);
p += 4;
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
if (this->need_save_res_)
@@ -5630,7 +5592,7 @@ Output_data_glink<size, big_endian>::do_
write_insn<big_endian>(p, mtctr_12), p += 4;
write_insn<big_endian>(p, ld_11_11 + 8), p += 4;
}
- p = output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr), p += 4;
gold_assert(p == oview + this->pltresolve_size());
// Write lazy link call stubs.
@@ -5686,7 +5648,7 @@ Output_data_glink<size, big_endian>::do_
write_insn<big_endian>(p, addis_12_12 + ha(off)), p += 4;
write_insn<big_endian>(p, ld_12_12 + l(off)), p += 4;
write_insn<big_endian>(p, mtctr_12), p += 4;
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
else
@@ -5778,7 +5740,8 @@ Output_data_glink<size, big_endian>::do_
write_insn<big_endian>(p, add_11_0_11);
}
p += 4;
- p = output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
+ p += 4;
while (p < end_p)
{
write_insn<big_endian>(p, nop);
diff -rup binutils.orig/ld/emultempl/ppc32elf.em binutils-2.30/ld/emultempl/ppc32elf.em
--- binutils.orig/ld/emultempl/ppc32elf.em 2018-02-08 10:49:07.192191063 +0000
+++ binutils-2.30/ld/emultempl/ppc32elf.em 2018-02-08 10:50:11.062395410 +0000
@@ -38,7 +38,7 @@ static int notlsopt = 0;
/* Choose the correct place for .got. */
static int old_got = 0;
-static struct ppc_elf_params params = { PLT_UNSET, 0, 1, -1,
+static struct ppc_elf_params params = { PLT_UNSET, 0, -1,
0, 0, 0, 0, 0, 0, 0 };
static void
@@ -246,8 +246,6 @@ enum ppc32_opt
OPTION_NO_TLS_GET_ADDR_OPT,
OPTION_NEW_PLT,
OPTION_OLD_PLT,
- OPTION_SPECULATE_INDIRECT_JUMPS,
- OPTION_NO_SPECULATE_INDIRECT_JUMPS,
OPTION_PLT_ALIGN,
OPTION_NO_PLT_ALIGN,
OPTION_OLD_GOT,
@@ -269,8 +267,6 @@ if test -z "$VXWORKS_BASE_EM_FILE" ; the
PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
{ "secure-plt", no_argument, NULL, OPTION_NEW_PLT },
{ "bss-plt", no_argument, NULL, OPTION_OLD_PLT },
- { "speculate-indirect-jumps", no_argument, NULL, OPTION_SPECULATE_INDIRECT_JUMPS },
- { "no-speculate-indirect-jumps", no_argument, NULL, OPTION_NO_SPECULATE_INDIRECT_JUMPS },
{ "plt-align", optional_argument, NULL, OPTION_PLT_ALIGN },
{ "no-plt-align", no_argument, NULL, OPTION_NO_PLT_ALIGN },
{ "sdata-got", no_argument, NULL, OPTION_OLD_GOT },'
@@ -304,12 +300,6 @@ if test -z "$VXWORKS_BASE_EM_FILE" ; the
--bss-plt Force old-style BSS PLT.\n"
));
fprintf (file, _("\
- --speculate-indirect-jumps PLT call stubs without speculation barrier.\n"
- ));
- fprintf (file, _("\
- --no-speculate-indirect-jumps PLT call stubs with speculation barrier.\n"
- ));
- fprintf (file, _("\
--plt-align Align PLT call stubs to fit cache lines.\n"
));
fprintf (file, _("\
@@ -360,14 +350,6 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LI
params.plt_style = PLT_OLD;
break;
- case OPTION_SPECULATE_INDIRECT_JUMPS:
- params.speculate_indirect_jumps = 1;
- break;
-
- case OPTION_NO_SPECULATE_INDIRECT_JUMPS:
- params.speculate_indirect_jumps = 0;
- break;
-
case OPTION_PLT_ALIGN:
if (optarg != NULL)
{
diff -rup binutils.orig/ld/emultempl/ppc64elf.em binutils-2.30/ld/emultempl/ppc64elf.em
--- binutils.orig/ld/emultempl/ppc64elf.em 2018-02-08 10:49:07.192191063 +0000
+++ binutils-2.30/ld/emultempl/ppc64elf.em 2018-02-08 10:50:11.062395410 +0000
@@ -38,7 +38,7 @@ static struct ppc64_elf_params params =
&ppc_layout_sections_again,
1, -1, 0,
${DEFAULT_PLT_STATIC_CHAIN-0}, -1, 5,
- -1, 1, 0, -1, -1, 0};
+ -1, 0, -1, -1, 0};
/* Fake input file for stubs. */
static lang_input_statement_type *stub_file;
@@ -692,8 +692,6 @@ enum ppc64_opt
OPTION_NO_PLT_STATIC_CHAIN,
OPTION_PLT_THREAD_SAFE,
OPTION_NO_PLT_THREAD_SAFE,
- OPTION_SPECULATE_INDIRECT_JUMPS,
- OPTION_NO_SPECULATE_INDIRECT_JUMPS,
OPTION_PLT_ALIGN,
OPTION_NO_PLT_ALIGN,
OPTION_PLT_LOCALENTRY,
@@ -721,8 +719,6 @@ PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST
{ "no-plt-static-chain", no_argument, NULL, OPTION_NO_PLT_STATIC_CHAIN },
{ "plt-thread-safe", no_argument, NULL, OPTION_PLT_THREAD_SAFE },
{ "no-plt-thread-safe", no_argument, NULL, OPTION_NO_PLT_THREAD_SAFE },
- { "speculate-indirect-jumps", no_argument, NULL, OPTION_SPECULATE_INDIRECT_JUMPS },
- { "no-speculate-indirect-jumps", no_argument, NULL, OPTION_NO_SPECULATE_INDIRECT_JUMPS },
{ "plt-align", optional_argument, NULL, OPTION_PLT_ALIGN },
{ "no-plt-align", no_argument, NULL, OPTION_NO_PLT_ALIGN },
{ "plt-localentry", optional_argument, NULL, OPTION_PLT_LOCALENTRY },
@@ -764,13 +760,7 @@ PARSE_AND_LIST_OPTIONS=${PARSE_AND_LIST_
--plt-thread-safe PLT call stubs with load-load barrier.\n"
));
fprintf (file, _("\
- --no-plt-thread-safe PLT call stubs without load-load barrier.\n"
- ));
- fprintf (file, _("\
- --speculate-indirect-jumps PLT call stubs without speculation barrier.\n"
- ));
- fprintf (file, _("\
- --no-speculate-indirect-jumps PLT call stubs with speculation barrier.\n"
+ --no-plt-thread-safe PLT call stubs without barrier.\n"
));
fprintf (file, _("\
--plt-align [=<align>] Align PLT call stubs to fit cache lines.\n"
@@ -860,14 +850,6 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LI
params.plt_thread_safe = 0;
break;
- case OPTION_SPECULATE_INDIRECT_JUMPS:
- params.speculate_indirect_jumps = 1;
- break;
-
- case OPTION_NO_SPECULATE_INDIRECT_JUMPS:
- params.speculate_indirect_jumps = 0;
- break;
-
case OPTION_PLT_ALIGN:
if (optarg != NULL)
{
diff -rup binutils.orig/ld/ld.texinfo binutils-2.30/ld/ld.texinfo
--- binutils.orig/ld/ld.texinfo 2018-02-08 10:49:07.203190926 +0000
+++ binutils-2.30/ld/ld.texinfo 2018-02-08 10:50:11.063395397 +0000
@@ -7646,15 +7646,6 @@ looks for calls to commonly used functio
seen, adds the necessary barriers. Use these options to change the
default behaviour.
-@cindex PowerPC64 PLT call stub speculative execution barrier
-@kindex --speculate-indirect-jumps
-@kindex --no-speculate-indirect-jumps
-@item --speculate-indirect-jumps
-@itemx --no-speculate-indirect-jumps
-Use these options to control whether all indirect branch instructions
-emitted by @code{ld}, such as those in the PLT, have a speculative
-execution barrier to mitigate Spectre variant 2 attacks.
-
@cindex PowerPC64 ELFv2 PLT localentry optimization
@kindex --plt-localentry
@kindex --no-plt-localentry
diff -rup binutils.orig/ld/testsuite/ld-powerpc/elfv2exe.d binutils-2.30/ld/testsuite/ld-powerpc/elfv2exe.d
--- binutils.orig/ld/testsuite/ld-powerpc/elfv2exe.d 2018-02-08 10:49:07.261190203 +0000
+++ binutils-2.30/ld/testsuite/ld-powerpc/elfv2exe.d 2018-02-08 10:50:11.063395397 +0000
@@ -1,6 +1,6 @@
#source: elfv2.s
#as: -a64
-#ld: -melf64ppc --speculate-indirect-jumps --defsym f2=0x1234 --defsym f3=0x10008888 --defsym f4=0x1200000 --defsym _start=f1
+#ld: -melf64ppc --defsym f2=0x1234 --defsym f3=0x10008888 --defsym f4=0x1200000 --defsym _start=f1
#objdump: -dr
.*
diff -rup binutils.orig/ld/testsuite/ld-powerpc/elfv2so.d binutils-2.30/ld/testsuite/ld-powerpc/elfv2so.d
--- binutils.orig/ld/testsuite/ld-powerpc/elfv2so.d 2018-02-08 10:49:07.264190166 +0000
+++ binutils-2.30/ld/testsuite/ld-powerpc/elfv2so.d 2018-02-08 10:50:11.063395397 +0000
@@ -1,6 +1,6 @@
#source: elfv2.s
#as: -a64
-#ld: -melf64ppc -shared --speculate-indirect-jumps
+#ld: -melf64ppc -shared
#objdump: -dr
.*
diff -rup binutils.orig/ld/testsuite/ld-powerpc/powerpc.exp binutils-2.30/ld/testsuite/ld-powerpc/powerpc.exp
--- binutils.orig/ld/testsuite/ld-powerpc/powerpc.exp 2018-02-08 10:49:07.261190203 +0000
+++ binutils-2.30/ld/testsuite/ld-powerpc/powerpc.exp 2018-02-08 10:50:11.063395397 +0000
@@ -121,11 +121,11 @@ set ppcelftests {
"tls32"}
{"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" "" {}
{} "libtlslib32.so"}
- {"TLS32 dynamic exec" "-melf32ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o tmpdir/libtlslib32.so" "" "" {}
+ {"TLS32 dynamic exec" "-melf32ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o tmpdir/libtlslib32.so" "" "" {}
{{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
{objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
"tlsexe32"}
- {"TLS32 shared" "-shared -melf32ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o" "" "" {}
+ {"TLS32 shared" "-shared -melf32ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o" "" "" {}
{{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
{objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
"tls32.so"}
@@ -147,7 +147,7 @@ set ppcelftests {
{"TLS32 DLL" "-shared -melf32ppc --version-script tlsdll.ver" ""
"-a32" {tlsdll_32.s}
{} "tlsdll32.so"}
- {"TLS32 opt 5" "-melf32ppc -shared --gc-sections --secure-plt --no-plt-align --speculate-indirect-jumps tmpdir/tlsdll32.so" "" "-a32" {tlsopt5_32.s}
+ {"TLS32 opt 5" "-melf32ppc -shared --gc-sections --secure-plt --no-plt-align tmpdir/tlsdll32.so" "" "-a32" {tlsopt5_32.s}
{{objdump -dr tlsopt5_32.d}}
"tlsopt5_32"}
{"Shared library with global symbol" "-shared -melf32ppc" "" "-a32" {sdalib.s}
@@ -174,15 +174,15 @@ set ppc64elftests {
{} "libtlslib.so"}
{"TLS helper old shared lib" "-shared -melf64ppc" "" "-a64" {oldtlslib.s}
{} "liboldlib.so"}
- {"TLS dynamic exec" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/libtlslib.so" "" "" {}
+ {"TLS dynamic exec" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/libtlslib.so" "" "" {}
{{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
{objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
"tlsexe"}
- {"TLS dynamic old" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/liboldlib.so" "" "" {}
+ {"TLS dynamic old" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/liboldlib.so" "" "" {}
{{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
{objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
"tlsexeold"}
- {"TLS shared" "-shared -melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o" "" "" {}
+ {"TLS shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o" "" "" {}
{{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
{objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
"tls.so"}
@@ -190,17 +190,17 @@ set ppc64elftests {
{{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g}
{objdump -sj.tdata tlstoc.t}}
"tlstoc"}
- {"TLSTOC dynamic exec" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/libtlslib.so" ""
+ {"TLSTOC dynamic exec" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/libtlslib.so" ""
"" {}
{{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
{objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
"tlsexetoc"}
- {"TLSTOC dynamic old" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/liboldlib.so" ""
+ {"TLSTOC dynamic old" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/liboldlib.so" ""
"" {}
{{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
{objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
"tlsexetocold"}
- {"TLSTOC shared" "-shared -melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o" "" "" {}
+ {"TLSTOC shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o" "" "" {}
{{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
{objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
"tlstoc.so"}
@@ -221,7 +221,7 @@ set ppc64elftests {
"tlsopt4"}
{"TLS DLL" "-shared -melf64ppc --version-script tlsdll.ver" "" "-a64" {tlsdll.s}
{} "tlsdll.so"}
- {"TLS opt 5" "-melf64ppc --no-plt-align --speculate-indirect-jumps -shared --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s}
+ {"TLS opt 5" "-melf64ppc --no-plt-align -shared --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s}
{{objdump -dr tlsopt5.d} {readelf -wf tlsopt5.wf}}
"tlsopt5"}
{"sym@tocbase" "-shared -melf64ppc" "" "-a64" {symtocbase-1.s symtocbase-2.s}
diff -rup binutils.orig/ld/testsuite/ld-powerpc/relbrlt.d binutils-2.30/ld/testsuite/ld-powerpc/relbrlt.d
--- binutils.orig/ld/testsuite/ld-powerpc/relbrlt.d 2018-02-08 10:49:07.262190191 +0000
+++ binutils-2.30/ld/testsuite/ld-powerpc/relbrlt.d 2018-02-08 10:50:11.063395397 +0000
@@ -1,6 +1,6 @@
#source: relbrlt.s
#as: -a64
-#ld: -melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --emit-relocs
+#ld: -melf64ppc --no-plt-align --no-ld-generated-unwind-info --emit-relocs
#objdump: -Dr
.*

View File

@ -0,0 +1,13 @@
--- binutils.orig/binutils/dwarf.c 2018-02-08 10:49:07.154191536 +0000
+++ binutils-2.30/binutils/dwarf.c 2018-02-08 12:53:32.649380368 +0000
@@ -9851,6 +9851,10 @@ load_dwo_file (const char * main_filenam
void *
load_separate_debug_file (void * file, const char * filename)
{
+ /* Skip this operation if we are not interested in debug links. */
+ if (! do_follow_links && ! do_debug_links)
+ return NULL;
+
/* See if there is a dwo link. */
if (load_debug_section (str, file)
&& load_debug_section (abbrev, file)

View File

@ -1,73 +0,0 @@
diff -rup binutils.orig/bfd/elf64-sparc.c binutils-2.29.1/bfd/elf64-sparc.c
--- binutils.orig/bfd/elf64-sparc.c 2017-12-07 17:23:06.764174312 +0000
+++ binutils-2.29.1/bfd/elf64-sparc.c 2017-12-07 17:23:20.540009839 +0000
@@ -287,6 +287,7 @@ elf64_sparc_set_reloc (bfd *abfd ATTRIBU
unsigned int count)
{
asect->orelocation = location;
+ asect->reloc_count = count / 2;
canon_reloc_count (asect) = count;
}
Only in binutils-2.29.1/bfd: elf64-sparc.c.orig
diff -rup binutils.orig/bfd/elfcode.h binutils-2.29.1/bfd/elfcode.h
--- binutils.orig/bfd/elfcode.h 2017-12-07 17:23:06.722174814 +0000
+++ binutils-2.29.1/bfd/elfcode.h 2017-12-07 17:23:20.541009827 +0000
@@ -958,6 +958,12 @@ elf_write_relocs (bfd *abfd, asection *s
return;
}
+ if (ptr->howto == NULL)
+ {
+ *failedp = TRUE;
+ return;
+ }
+
src_rela.r_offset = ptr->address + addr_offset;
src_rela.r_info = ELF_R_INFO (n, ptr->howto->type);
src_rela.r_addend = ptr->addend;
diff -rup binutils.orig/binutils/objcopy.c binutils-2.29.1/binutils/objcopy.c
--- binutils.orig/binutils/objcopy.c 2017-12-07 17:23:06.769174253 +0000
+++ binutils-2.29.1/binutils/objcopy.c 2017-12-07 17:23:20.542009815 +0000
@@ -3785,14 +3785,24 @@ copy_relocations_in_section (bfd *ibfd,
}
else
{
- relpp = (arelent **) xmalloc (relsize);
- relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
- if (relcount < 0)
+ if (isection->orelocation != NULL)
{
- status = 1;
- bfd_nonfatal_message (NULL, ibfd, isection,
- _("relocation count is negative"));
- return;
+ /* Some other function has already set up the output relocs
+ for us, so scan those instead of the default relocs. */
+ relcount = isection->reloc_count;
+ relpp = isection->orelocation;
+ }
+ else
+ {
+ relpp = (arelent **) xmalloc (relsize);
+ relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
+ if (relcount < 0)
+ {
+ status = 1;
+ bfd_nonfatal_message (NULL, ibfd, isection,
+ _("relocation count is negative"));
+ return;
+ }
}
if (strip_symbols == STRIP_ALL)
@@ -3815,7 +3825,8 @@ copy_relocations_in_section (bfd *ibfd,
temp_relpp [temp_relcount++] = relpp [i];
}
relcount = temp_relcount;
- free (relpp);
+ if (isection->orelocation == NULL)
+ free (relpp);
relpp = temp_relpp;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,71 +0,0 @@
diff -rup binutils.orig/ld/emultempl/elf32.em binutils-2.29.1/ld/emultempl/elf32.em
--- binutils.orig/ld/emultempl/elf32.em 2018-01-16 11:34:58.040749108 +0000
+++ binutils-2.29.1/ld/emultempl/elf32.em 2018-01-16 11:35:35.697303875 +0000
@@ -2666,6 +2666,8 @@ fragment <<EOF
case 'z':
if (strcmp (optarg, "defs") == 0)
link_info.unresolved_syms_in_objects = RM_GENERATE_ERROR;
+ else if (strcmp (optarg, "undefs") == 0)
+ link_info.unresolved_syms_in_objects = RM_IGNORE;
else if (strcmp (optarg, "muldefs") == 0)
link_info.allow_multiple_definition = TRUE;
else if (CONST_STRNEQ (optarg, "max-page-size="))
Only in binutils-2.29.1/ld/emultempl: elf32.em.orig
diff -rup binutils.orig/ld/ld.texinfo binutils-2.29.1/ld/ld.texinfo
--- binutils.orig/ld/ld.texinfo 2018-01-16 11:34:58.208747127 +0000
+++ binutils-2.29.1/ld/ld.texinfo 2018-01-16 11:35:35.699303851 +0000
@@ -1125,8 +1125,9 @@ Generate common symbols with the STT_COM
link.
@item defs
-Disallows undefined symbols in object files. Undefined symbols in
-shared libraries are still allowed.
+Report unresolved symbol references from regular object files. This
+is done even if the linker is creating a non-symbolic shared library.
+This option is the inverse of @samp{-z undefs}.
@item execstack
Marks the object as requiring executable stack.
@@ -1279,6 +1280,11 @@ Generate GNU_PROPERTY_X86_FEATURE_1_SHST
to indicate compatibility with Intel Shadow Stack. Supported for
Linux/i386 and Linux/x86_64.
+@item undefs
+Do not report unresolved symbol references from regular object files,
+either when creating an executable, or when creating a shared library.
+This option is the inverse of @samp{-z defs}.
+
@end table
Other keywords are ignored for Solaris compatibility.
@@ -1684,6 +1690,7 @@ while linking a large executable.
@kindex --no-undefined
@kindex -z defs
+@kindex -z undefs
@item --no-undefined
@itemx -z defs
Report unresolved symbol references from regular object files. This
@@ -1692,6 +1699,8 @@ The switch @option{--[no-]allow-shlib-un
behaviour for reporting unresolved references found in shared
libraries being linked in.
+The effects of this option can be reverted by using @code{-z undefs}.
+
@kindex --allow-multiple-definition
@kindex -z muldefs
@item --allow-multiple-definition
Only in binutils-2.29.1/ld: ld.texinfo.orig
diff -rup binutils.orig/ld/NEWS binutils-2.29.1/ld/NEWS
--- binutils.orig/ld/NEWS 2018-01-16 11:34:58.209747115 +0000
+++ binutils-2.29.1/ld/NEWS 2018-01-16 11:35:57.855041557 +0000
@@ -1,5 +1,7 @@
-*- text -*-
+* Add "-z undefs" command line option as the inverse of the "-z defs" option.
+
Changes in 2.29:
* Support for -z shstk in the x86 ELF linker to generate
Only in binutils-2.29.1/ld: NEWS.orig
Only in binutils-2.29.1/ld: NEWS.rej

View File

@ -61,8 +61,8 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.29.1
Release: 19%{?dist}
Version: 2.30
Release: 5%{?dist}
License: GPLv3+
Group: Development/Tools
URL: https://sourceware.org/binutils
@ -112,10 +112,6 @@ Patch04: binutils-2.22.52.0.4-no-config-h-check.patch
# FIXME: Try removing....
Patch05: binutils-2.26-lto.patch
# Purpose: Skip PR14918 linker test for ARM native targets.
# Lifetime: Fixed in 2.30.
Patch06: binutils-2.29-skip-rp14918-test-for-arm.patch
# Purpose: Include the filename concerned in readelf error messages. This
# makes readelf's output more helpful when it is run on multiple
# input files.
@ -123,21 +119,7 @@ Patch06: binutils-2.29-skip-rp14918-test-for-arm.patch
# making it better (IMHO) but also potentially breaking tools that
# depend upon readelf's current format. Hence it remains a local
# patch.
Patch07: binutils-2.29-filename-in-error-messages.patch
# Purpose: Fix the generation of relocations to handle locating the start
# and stop symbols of orphan sections when using the GOLD linker.
# See: BZ 1500898 and PR 22291.
# Lifetime: Fixed in 2.30.
Patch08: binutils-2.29.1-gold-start-stop.patch
# Purpose: Update readelf so that if it is run with the --relocs option and
# there are no static relocs to be displayed, but there are dynamic
# relocs that could have been displayed, it will now issue a
# message suggesting the addition of the --use-dynamic option.
# See: BZ 1507694
# Lifetime: Fixed in 2.30.
Patch09: binutils-2.29.1-readelf-use-dynamic.patch
Patch06: binutils-2.29-filename-in-error-messages.patch
# Purpose: Disable an x86/x86_64 optimization that moves functions from the
# PLT into the GOTPLT for faster access. This optimization is
@ -145,12 +127,7 @@ Patch09: binutils-2.29.1-readelf-use-dynamic.patch
# as ltrace and LD_AUDIT. See BZs 1452111 and 1333481.
# Lifetime: Permanent. But it should not be.
# FIXME: Replace with a configure time option.
Patch10: binutils-2.29-revert-PLT-elision.patch
# Purpose: Fixes a bug in strip/objcopy which could cause it to crash when
# deleting relocs in a file which also contains mergeable notes.
# Lifetime: Fixed in 2.30.
Patch11: binutils-strip-delete-relocs.patch
Patch07: binutils-2.29-revert-PLT-elision.patch
# Purpose: Changes readelf so that when it displays extra information about
# a symbol, this information is placed at the end of the line.
@ -158,25 +135,29 @@ Patch11: binutils-strip-delete-relocs.patch
# FIXME: The proper fix would be to update the scripts that are expecting
# a fixed output from readelf. But it seems that some of them are
# no longer being maintained.
Patch12: binutils-readelf-other-sym-info.patch
Patch08: binutils-readelf-other-sym-info.patch
# Purpose: Enhances readelf and objcopy to support v3 build notes.
# Lifetime: Fixed in 2.30.
Patch13: binutils-support-v3-build-notes.patch
# Purpose: Do not create PLT entries for AARCH64 IFUNC symbols referenced in
# debug sections.
# Lifetime: Permanent.
# FIXME: Find related bug. Decide on permanency.
Patch09: binutils-2.27-aarch64-ifunc.patch
# Purpose: Adds a "-z undefs" option to the linker to compliment the already
# present "-z defs" option.
# Lifetime: Fixed in 2.30.
Patch14: binutils-z-undefs.patch
# Purpose: Remove support for inserting PowerPC Speculation Barrier
# instructions from the linker. (It has been deprecated in
# favour of a hardware fix).
# Lifetime: Fixed in 2.30.1 and/or 2.31.
Patch10: binutils-revert-PowerPC-speculation-barriers.patch
# Purpose: Fixes bugs in AArch64 static PIE support. Specifically: FSF PRs
# 22263 and 22269.
# Lifetime: Fixed in 2.30.
Patch15: binutils-aarch64-pie.patch
# Purpose: Stop readelf/objdump for searching for DWO links unless
# explicitly requested by the user.
# Lifetime: Fixed in 2.30.1 and/or 2.31.
Patch11: binutils-skip-dwo-search-if-not-needed.patch
# Purpose: Fixes the creation of function call stubs for PowerPC64.
# Lifetime: Fixed in 2.31. See BZ 1523457
Patch16: binutils-ppc64-stub-creation.patch
# Purpose: Fix a bug in the BFD linker's layout algorithm which ended up
# placing executable and non-executable pages in the same segment.
# Lifetime: Fixed in 2.30.1 and/or 2.31.
Patch12: binutils-page-to-segment-assignment.patch
#----------------------------------------------------------------------------
@ -315,10 +296,6 @@ using libelf instead of BFD.
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -610,6 +587,9 @@ fi
#----------------------------------------------------------------------------
%clean
rm -rf %{buildroot}
#----------------------------------------------------------------------------
%post
@ -724,6 +704,24 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Wed Feb 21 2018 Nick Clifton <nickc@redhat.com> 2.30-5
- Fix assignment of pages to segments. (PR 22758)
- Inject RPM_LD_FLAGS into the build. (#1541027)
- Fix slowdown in readelf when examining files with lots of debug information. (PR 22802)
- Remove support for PowerPC speculation barrier insertion.
- Rebase on 2.30
- Retire binutils-2.22.52.0.1-relro-on-by-default.patch
- Retire binutils-2.28-dynamic-section-warning.patch
- Retire binutils-2.29-skip-rp14918-test-for-arm.patch
- Retire binutils-2.29.1-gold-start-stop.patch
- Retire binutils-2.29.1-readelf-use-dynamic.patch
- Retire binutils-aarch64-pie.patch
- Retire binutils-coverity.patch
- Retire binutils-ppc64-stub-creation.patch
- Retire binutils-strip-delete-relocs.patch
- Retire binutils-support-v3-build-notes.patch
- Retire binutils-z-undefs.patch
* Mon Feb 12 2018 Nick Clifton <nickc@redhat.com> 2.29.1-19
- Remove comment that explained how to disable annobin. (#1541027)

View File

@ -1,2 +1,2 @@
SHA512 (binutils-2.29.1.tar.xz) = d748d22306477d60d921078804d21943248c23fca0707aac9b016a352c01c75ca69e82624ae37fb0bbd03af3b17088a94f60dfe1a86a7ff82e18ece3c24f0fd0
SHA512 (binutils-2.30.tar.xz) = e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839
SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2