|
|
58725c |
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.30/bfd/elf32-i386.c
|
|
|
58725c |
--- binutils.orig/bfd/elf32-i386.c 2018-02-27 17:25:53.961140597 +0000
|
|
|
58725c |
+++ binutils-2.30/bfd/elf32-i386.c 2018-02-27 17:27:14.115133477 +0000
|
|
|
58725c |
@@ -383,7 +383,7 @@ elf_i386_rtype_to_howto (bfd *abfd, unsi
|
|
|
58725c |
{
|
|
|
58725c |
(*_bfd_error_handler) (_("%B: invalid relocation type %d"),
|
|
|
58725c |
abfd, (int) r_type);
|
|
|
58725c |
- indx = R_386_NONE;
|
|
|
58725c |
+ return NULL;
|
|
|
58725c |
}
|
|
|
58725c |
/* PR 17512: file: 0f67f69d. */
|
|
|
58725c |
if (elf_howto_table [indx].type != r_type)
|
|
|
58725c |
diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.30/bfd/elf64-ppc.c
|
|
|
58725c |
--- binutils.orig/bfd/elf64-ppc.c 2018-02-27 17:25:53.969140496 +0000
|
|
|
58725c |
+++ binutils-2.30/bfd/elf64-ppc.c 2018-02-27 17:27:56.213604518 +0000
|
|
|
58725c |
@@ -2516,9 +2516,12 @@ ppc64_elf_info_to_howto (bfd *abfd, arel
|
|
|
58725c |
{
|
|
|
58725c |
(*_bfd_error_handler) (_("%B: invalid relocation type %d"),
|
|
|
58725c |
abfd, (int) type);
|
|
|
58725c |
- type = R_PPC64_NONE;
|
|
|
58725c |
+ cache_ptr->howto = NULL;
|
|
|
58725c |
}
|
|
|
58725c |
- cache_ptr->howto = ppc64_elf_howto_table[type];
|
|
|
58725c |
+ else
|
|
|
58725c |
+ cache_ptr->howto = ppc64_elf_howto_table[type];
|
|
|
58725c |
+ if (cache_ptr->howto == NULL || cache_ptr->howto->name == NULL)
|
|
|
58725c |
+ _bfd_error_handler (_("%B: invalid relocation type %d"), abfd, type);
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
/* Handle the R_PPC64_ADDR16_HA and similar relocs. */
|
|
|
58725c |
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.30/bfd/elf64-s390.c
|
|
|
58725c |
--- binutils.orig/bfd/elf64-s390.c 2018-02-27 17:25:53.968140509 +0000
|
|
|
58725c |
+++ binutils-2.30/bfd/elf64-s390.c 2018-02-27 17:28:24.632247443 +0000
|
|
|
58725c |
@@ -372,9 +372,10 @@ elf_s390_info_to_howto (bfd *abfd ATTRIB
|
|
|
58725c |
{
|
|
|
58725c |
(*_bfd_error_handler) (_("%B: invalid relocation type %d"),
|
|
|
58725c |
abfd, (int) r_type);
|
|
|
58725c |
- r_type = R_390_NONE;
|
|
|
58725c |
+ cache_ptr->howto = NULL;
|
|
|
58725c |
}
|
|
|
58725c |
- cache_ptr->howto = &elf_howto_table[r_type];
|
|
|
58725c |
+ else
|
|
|
58725c |
+ cache_ptr->howto = &elf_howto_table[r_type];
|
|
|
58725c |
}
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.30/bfd/elf64-x86-64.c
|
|
|
58725c |
--- binutils.orig/bfd/elf64-x86-64.c 2018-02-27 17:25:53.964140559 +0000
|
|
|
58725c |
+++ binutils-2.30/bfd/elf64-x86-64.c 2018-02-27 17:29:12.554645307 +0000
|
|
|
58725c |
@@ -284,7 +284,7 @@ elf_x86_64_rtype_to_howto (bfd *abfd, un
|
|
|
58725c |
{
|
|
|
58725c |
(*_bfd_error_handler) (_("%B: invalid relocation type %d"),
|
|
|
58725c |
abfd, (int) r_type);
|
|
|
58725c |
- r_type = R_X86_64_NONE;
|
|
|
58725c |
+ return NULL;
|
|
|
58725c |
}
|
|
|
58725c |
i = r_type;
|
|
|
58725c |
}
|
|
|
58725c |
@@ -347,7 +347,6 @@ elf_x86_64_info_to_howto (bfd *abfd ATTR
|
|
|
58725c |
|
|
|
58725c |
r_type = ELF32_R_TYPE (dst->r_info);
|
|
|
58725c |
cache_ptr->howto = elf_x86_64_rtype_to_howto (abfd, r_type);
|
|
|
58725c |
- BFD_ASSERT (r_type == cache_ptr->howto->type);
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
/* Support for core dump NOTE sections. */
|
|
|
58725c |
diff -rup binutils.orig/bfd/elfcode.h binutils-2.30/bfd/elfcode.h
|
|
|
58725c |
--- binutils.orig/bfd/elfcode.h 2018-02-27 17:25:53.964140559 +0000
|
|
|
58725c |
+++ binutils-2.30/bfd/elfcode.h 2018-02-27 17:26:57.234345581 +0000
|
|
|
58725c |
@@ -1474,6 +1474,12 @@ elf_slurp_reloc_table_from_section (bfd
|
|
|
58725c |
(*ebd->elf_info_to_howto) (abfd, relent, &rela);
|
|
|
58725c |
else
|
|
|
58725c |
(*ebd->elf_info_to_howto_rel) (abfd, relent, &rela);
|
|
|
58725c |
+
|
|
|
58725c |
+ if (relent->howto == NULL)
|
|
|
58725c |
+ {
|
|
|
58725c |
+ bfd_set_error (bfd_error_bad_value);
|
|
|
58725c |
+ goto error_return;
|
|
|
58725c |
+ }
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
if (allocated != NULL)
|
|
|
58725c |
diff -rup binutils.orig/binutils/objcopy.c binutils-2.30/binutils/objcopy.c
|
|
|
58725c |
--- binutils.orig/binutils/objcopy.c 2018-02-27 17:25:53.185150347 +0000
|
|
|
58725c |
+++ binutils-2.30/binutils/objcopy.c 2018-02-27 17:30:05.806976202 +0000
|
|
|
58725c |
@@ -3022,10 +3022,19 @@ copy_object (bfd *ibfd, bfd *obfd, const
|
|
|
58725c |
haven't been set yet. mark_symbols_used_in_relocations will
|
|
|
58725c |
ignore input sections which have no corresponding output
|
|
|
58725c |
section. */
|
|
|
58725c |
+ bfd_set_error (bfd_error_no_error);
|
|
|
58725c |
if (strip_symbols != STRIP_ALL)
|
|
|
58725c |
- bfd_map_over_sections (ibfd,
|
|
|
58725c |
- mark_symbols_used_in_relocations,
|
|
|
58725c |
- isympp);
|
|
|
58725c |
+ {
|
|
|
58725c |
+ bfd_map_over_sections (ibfd,
|
|
|
58725c |
+ mark_symbols_used_in_relocations,
|
|
|
58725c |
+ isympp);
|
|
|
58725c |
+ if (bfd_get_error () != bfd_error_no_error)
|
|
|
58725c |
+ {
|
|
|
58725c |
+ status = 1;
|
|
|
58725c |
+ return FALSE;
|
|
|
58725c |
+ }
|
|
|
58725c |
+ }
|
|
|
58725c |
+
|
|
|
58725c |
osympp = (asymbol **) xmalloc ((symcount + add_symbols + 1) * sizeof (asymbol *));
|
|
|
58725c |
symcount = filter_symbols (ibfd, obfd, osympp, isympp, symcount);
|
|
|
58725c |
}
|
|
|
58725c |
diff -rup binutils.orig/binutils/testsuite/binutils-all/objcopy.exp binutils-2.27/binutils/testsuite/binutils-all/objcopy.exp
|
|
|
58725c |
--- binutils.orig/binutils/testsuite/binutils-all/objcopy.exp 2018-04-11 12:34:04.671683298 +0100
|
|
|
58725c |
+++ binutils-2.27/binutils/testsuite/binutils-all/objcopy.exp 2018-04-11 12:36:50.053734109 +0100
|
|
|
58725c |
@@ -1083,6 +1083,29 @@ if [is_elf_format] {
|
|
|
58725c |
}
|
|
|
58725c |
run_dump_test "strip-11" $extra_strip11
|
|
|
58725c |
|
|
|
58725c |
+ if { [istarget "mips64*-*-openbsd*"] } {
|
|
|
58725c |
+ set reloc_format mips64
|
|
|
58725c |
+ } elseif { [istarget "arm-*"] \
|
|
|
58725c |
+ || [istarget "d10v-*"] \
|
|
|
58725c |
+ || [istarget "dlx-*"] \
|
|
|
58725c |
+ || [istarget "i*86-*"] \
|
|
|
58725c |
+ || [istarget "i960-*"] \
|
|
|
58725c |
+ || [istarget "m681*-*"] \
|
|
|
58725c |
+ || [istarget "m68hc1*-*"] \
|
|
|
58725c |
+ || ([istarget "mips*-*"] \
|
|
|
58725c |
+ && ![istarget "mips64*-ps2-elf*"] \
|
|
|
58725c |
+ && ![istarget "*-*-irix6*"] \
|
|
|
58725c |
+ && ![istarget "mips64*-*-freebsd*"] \
|
|
|
58725c |
+ && ![istarget "mips64*-*-kfreebsd*-gnu"] \
|
|
|
58725c |
+ && ![istarget "mips64*-*-linux*"]) \
|
|
|
58725c |
+ || [istarget "score*-*"] \
|
|
|
58725c |
+ || [istarget "xgate-*"] } {
|
|
|
58725c |
+ set reloc_format rel
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ set reloc_format rela
|
|
|
58725c |
+ }
|
|
|
58725c |
+ run_dump_test "strip-13" [list [list source strip-13${reloc_format}.s]]
|
|
|
58725c |
+
|
|
|
58725c |
if { [istarget "i*86-*"] || [istarget "x86_64-*-*"] } {
|
|
|
58725c |
# Check to make sure we don't strip a symbol named in relocations.
|
|
|
58725c |
set test "objcopy keeps symbols needed by relocs"
|
|
|
58725c |
diff -rup binutils.orig/binutils/testsuite/lib/utils-lib.exp binutils-2.27/binutils/testsuite/lib/utils-lib.exp
|
|
|
58725c |
--- binutils.orig/binutils/testsuite/lib/utils-lib.exp 2018-04-11 12:34:04.674683263 +0100
|
|
|
58725c |
+++ binutils-2.27/binutils/testsuite/lib/utils-lib.exp 2018-04-11 12:54:56.097850613 +0100
|
|
|
58725c |
@@ -1,4 +1,4 @@
|
|
|
58725c |
-# Copyright (C) 1993-2016 Free Software Foundation, Inc.
|
|
|
58725c |
+# Copyright (C) 1993-2018 Free Software Foundation, Inc.
|
|
|
58725c |
|
|
|
58725c |
# This program is free software; you can redistribute it and/or modify
|
|
|
58725c |
# it under the terms of the GNU General Public License as published by
|
|
|
58725c |
@@ -51,12 +51,17 @@ proc binutil_version { prog } {
|
|
|
58725c |
# default_binutils_run
|
|
|
58725c |
# run a program, returning the output
|
|
|
58725c |
# sets binutils_run_failed if the program does not exist
|
|
|
58725c |
+# sets binutils_run_status to the exit status of the program
|
|
|
58725c |
#
|
|
|
58725c |
proc default_binutils_run { prog progargs } {
|
|
|
58725c |
global binutils_run_failed
|
|
|
58725c |
+ global binutils_run_status
|
|
|
58725c |
global host_triplet
|
|
|
58725c |
|
|
|
58725c |
set binutils_run_failed 0
|
|
|
58725c |
+ if [info exists binutils_run_status] {
|
|
|
58725c |
+ unset binutils_run_status
|
|
|
58725c |
+ }
|
|
|
58725c |
|
|
|
58725c |
if ![is_remote host] {
|
|
|
58725c |
if {[which $prog] == 0} then {
|
|
|
58725c |
@@ -83,6 +88,7 @@ proc default_binutils_run { prog progarg
|
|
|
58725c |
regsub -all "\\$" "$progargs" "\\$" progargs
|
|
|
58725c |
|
|
|
58725c |
set state [remote_exec host $prog $progargs]
|
|
|
58725c |
+ set binutils_run_status [lindex $state 0]
|
|
|
58725c |
set exec_output [prune_warnings [lindex $state 1]]
|
|
|
58725c |
if {![string match "" $exec_output]} then {
|
|
|
58725c |
send_log "$exec_output\n"
|
|
|
58725c |
@@ -127,7 +133,6 @@ proc default_binutils_assemble_flags { s
|
|
|
58725c |
} else {
|
|
|
58725c |
send_log "$exec_output\n"
|
|
|
58725c |
verbose "$exec_output"
|
|
|
58725c |
- perror "$source: assembly failed"
|
|
|
58725c |
return 0
|
|
|
58725c |
}
|
|
|
58725c |
}
|
|
|
58725c |
@@ -214,6 +219,11 @@ proc exe_ext {} {
|
|
|
58725c |
# Assemble the file SOURCE.s. If omitted, this defaults to FILE.s.
|
|
|
58725c |
# This is useful if several .d files want to share a .s file.
|
|
|
58725c |
#
|
|
|
58725c |
+# dump: DUMP
|
|
|
58725c |
+# Match against DUMP.d. If omitted, this defaults to FILE.d. This
|
|
|
58725c |
+# is useful if several .d files differ by options only. Options are
|
|
|
58725c |
+# always read from FILE.d.
|
|
|
58725c |
+#
|
|
|
58725c |
# target: GLOBS...
|
|
|
58725c |
# Run this test only on a specified list of targets. More precisely,
|
|
|
58725c |
# each glob in the space-separated list is passed to "istarget"; if
|
|
|
58725c |
@@ -237,22 +247,22 @@ proc exe_ext {} {
|
|
|
58725c |
#
|
|
|
58725c |
# error: REGEX
|
|
|
58725c |
# An error with message matching REGEX must be emitted for the test
|
|
|
58725c |
-# to pass. The PROG, objdump, nm and objcopy options have no
|
|
|
58725c |
-# meaning and need not supplied if this is present.
|
|
|
58725c |
+# to pass. The DUMPPROG, addr2line, nm, objdump, readelf and size
|
|
|
58725c |
+# options have no meaning and need not supplied if this is present.
|
|
|
58725c |
+# Multiple "error" directives append to the expected error message.
|
|
|
58725c |
+#
|
|
|
58725c |
+# error_output: FILE
|
|
|
58725c |
+# Means the same as 'error', except the regular expression lines
|
|
|
58725c |
+# are contains in FILE.
|
|
|
58725c |
#
|
|
|
58725c |
# warning: REGEX
|
|
|
58725c |
-# Expect a gas warning matching REGEX. It is an error to issue
|
|
|
58725c |
-# both "error" and "warning".
|
|
|
58725c |
-#
|
|
|
58725c |
-# stderr: FILE
|
|
|
58725c |
-# FILE contains regexp lines to be matched against the diagnostic
|
|
|
58725c |
-# output of the assembler. This does not preclude the use of
|
|
|
58725c |
-# PROG, nm, objdump, or objcopy.
|
|
|
58725c |
-#
|
|
|
58725c |
-# error-output: FILE
|
|
|
58725c |
-# Means the same as 'stderr', but also indicates that the assembler
|
|
|
58725c |
-# is expected to exit unsuccessfully (therefore PROG, objdump, nm,
|
|
|
58725c |
-# and objcopy have no meaning and should not be supplied).
|
|
|
58725c |
+# Expect a warning matching REGEX. It is an error to issue both
|
|
|
58725c |
+# "error" and "warning". Multiple "warning" directives append to
|
|
|
58725c |
+# the expected linker warning message.
|
|
|
58725c |
+#
|
|
|
58725c |
+# warning_output: FILE
|
|
|
58725c |
+# Means the same as 'warning', except the regular expression
|
|
|
58725c |
+# lines are contains in FILE.
|
|
|
58725c |
#
|
|
|
58725c |
# Each option may occur at most once.
|
|
|
58725c |
#
|
|
|
58725c |
@@ -266,6 +276,7 @@ proc run_dump_test { name {extra_options
|
|
|
58725c |
global OBJDUMP NM OBJCOPY READELF STRIP
|
|
|
58725c |
global OBJDUMPFLAGS NMFLAGS OBJCOPYFLAGS READELFFLAGS STRIPFLAGS
|
|
|
58725c |
global ELFEDIT ELFEDITFLAGS
|
|
|
58725c |
+ global binutils_run_status
|
|
|
58725c |
global host_triplet
|
|
|
58725c |
global env
|
|
|
58725c |
global copyfile
|
|
|
58725c |
@@ -299,6 +310,11 @@ proc run_dump_test { name {extra_options
|
|
|
58725c |
set opts(PROG) {}
|
|
|
58725c |
set opts(DUMPPROG) {}
|
|
|
58725c |
set opts(source) {}
|
|
|
58725c |
+ set opts(dump) {}
|
|
|
58725c |
+ set opts(error) {}
|
|
|
58725c |
+ set opts(warning) {}
|
|
|
58725c |
+ set opts(error_output) {}
|
|
|
58725c |
+ set opts(warning_output) {}
|
|
|
58725c |
set opts(target) {}
|
|
|
58725c |
set opts(not-target) {}
|
|
|
58725c |
set opts(skip) {}
|
|
|
58725c |
@@ -317,12 +333,18 @@ proc run_dump_test { name {extra_options
|
|
|
58725c |
# directory.
|
|
|
58725c |
regsub -all "\\\$srcdir" "$opt_val" "$srcdir/$subdir" opt_val
|
|
|
58725c |
|
|
|
58725c |
- if [string length $opts($opt_name)] {
|
|
|
58725c |
- perror "option $opt_name multiply set in $file.d"
|
|
|
58725c |
- unresolved $subdir/$name
|
|
|
58725c |
- return
|
|
|
58725c |
+ switch -- $opt_name {
|
|
|
58725c |
+ warning {}
|
|
|
58725c |
+ error {}
|
|
|
58725c |
+ default {
|
|
|
58725c |
+ if [string length $opts($opt_name)] {
|
|
|
58725c |
+ perror "option $opt_name multiply set in $file.d"
|
|
|
58725c |
+ unresolved $subdir/$name
|
|
|
58725c |
+ return
|
|
|
58725c |
+ }
|
|
|
58725c |
+ }
|
|
|
58725c |
}
|
|
|
58725c |
- set opts($opt_name) $opt_val
|
|
|
58725c |
+ append opts($opt_name) $opt_val
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
foreach i $extra_options {
|
|
|
58725c |
@@ -340,7 +362,8 @@ proc run_dump_test { name {extra_options
|
|
|
58725c |
|
|
|
58725c |
# add extra option to end of existing option, adding space
|
|
|
58725c |
# if necessary.
|
|
|
58725c |
- if [string length $opts($opt_name)] {
|
|
|
58725c |
+ if { ![regexp "warning|error" $opt_name]
|
|
|
58725c |
+ && [string length $opts($opt_name)] } {
|
|
|
58725c |
append opts($opt_name) " "
|
|
|
58725c |
}
|
|
|
58725c |
append opts($opt_name) $opt_val
|
|
|
58725c |
@@ -378,28 +401,35 @@ proc run_dump_test { name {extra_options
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
set dumpprogram ""
|
|
|
58725c |
- if { $opts(DUMPPROG) != "" } {
|
|
|
58725c |
- switch -- $opts(DUMPPROG) {
|
|
|
58725c |
- addr2line { set dumpprogram addr2line }
|
|
|
58725c |
- nm { set dumpprogram nm }
|
|
|
58725c |
- objdump { set dumpprogram objdump }
|
|
|
58725c |
- readelf { set dumpprogram readelf }
|
|
|
58725c |
- size { set dumpprogram size }
|
|
|
58725c |
- default {
|
|
|
58725c |
- perror "unrecognized dump program option $opts(DUMPPROG) in $file.d"
|
|
|
58725c |
- unresolved $testname
|
|
|
58725c |
- return }
|
|
|
58725c |
- }
|
|
|
58725c |
- } else {
|
|
|
58725c |
- # Guess which program to run, by seeing which option was specified.
|
|
|
58725c |
- foreach p {addr2line nm objdump readelf size} {
|
|
|
58725c |
- if {$opts($p) != ""} {
|
|
|
58725c |
- if {$dumpprogram != ""} {
|
|
|
58725c |
- perror "more than one possible dump program specified in $file.d"
|
|
|
58725c |
+ # It's meaningless to require an output-testing method when we
|
|
|
58725c |
+ # expect an error.
|
|
|
58725c |
+ if { $opts(error) == "" && $opts(error_output) == "" } {
|
|
|
58725c |
+ if { $opts(DUMPPROG) != "" } {
|
|
|
58725c |
+ switch -- $opts(DUMPPROG) {
|
|
|
58725c |
+ addr2line { set dumpprogram addr2line }
|
|
|
58725c |
+ nm { set dumpprogram nm }
|
|
|
58725c |
+ objdump { set dumpprogram objdump }
|
|
|
58725c |
+ readelf { set dumpprogram readelf }
|
|
|
58725c |
+ size { set dumpprogram size }
|
|
|
58725c |
+ default {
|
|
|
58725c |
+ perror "unrecognized dump program option $opts(DUMPPROG)\
|
|
|
58725c |
+ in $file.d"
|
|
|
58725c |
unresolved $testname
|
|
|
58725c |
return
|
|
|
58725c |
- } else {
|
|
|
58725c |
- set dumpprogram $p
|
|
|
58725c |
+ }
|
|
|
58725c |
+ }
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ # Guess which program to run, by seeing which option was specified.
|
|
|
58725c |
+ foreach p {addr2line nm objdump readelf size} {
|
|
|
58725c |
+ if {$opts($p) != ""} {
|
|
|
58725c |
+ if {$dumpprogram != ""} {
|
|
|
58725c |
+ perror "more than one possible dump program specified\
|
|
|
58725c |
+ in $file.d"
|
|
|
58725c |
+ unresolved $testname
|
|
|
58725c |
+ return
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ set dumpprogram $p
|
|
|
58725c |
+ }
|
|
|
58725c |
}
|
|
|
58725c |
}
|
|
|
58725c |
}
|
|
|
58725c |
@@ -456,6 +486,12 @@ proc run_dump_test { name {extra_options
|
|
|
58725c |
set srcfile $srcdir/$subdir/$opts(source)
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
+ if { $opts(dump) == "" } {
|
|
|
58725c |
+ set dumpfile ${file}.d
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ set dumpfile $srcdir/$subdir/$opts(dump)
|
|
|
58725c |
+ }
|
|
|
58725c |
+
|
|
|
58725c |
if { $opts(as) == "binary" } {
|
|
|
58725c |
while {[file type $srcfile] eq "link"} {
|
|
|
58725c |
set newfile [file readlink $srcfile]
|
|
|
58725c |
@@ -464,7 +500,8 @@ proc run_dump_test { name {extra_options
|
|
|
58725c |
}
|
|
|
58725c |
set srcfile $newfile
|
|
|
58725c |
}
|
|
|
58725c |
- file copy -force ${srcfile} $tempfile
|
|
|
58725c |
+ # Make sure we copy the file if we are doing remote host testing.
|
|
|
58725c |
+ remote_download host ${srcfile} $tempfile
|
|
|
58725c |
} else {
|
|
|
58725c |
set exec_output [binutils_assemble_flags ${srcfile} $tempfile $opts(as)]
|
|
|
58725c |
if [string match "" $exec_output] then {
|
|
|
58725c |
@@ -475,16 +512,95 @@ proc run_dump_test { name {extra_options
|
|
|
58725c |
}
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
+ if { (($opts(warning) != "") && ($opts(error) != "")) \
|
|
|
58725c |
+ || (($opts(warning) != "") && ($opts(error_output) != "")) \
|
|
|
58725c |
+ || (($opts(warning) != "") && ($opts(warning_output) != "")) \
|
|
|
58725c |
+ || (($opts(error) != "") && ($opts(warning_output) != "")) \
|
|
|
58725c |
+ || (($opts(error) != "") && ($opts(error_output) != "")) \
|
|
|
58725c |
+ || (($opts(warning_output) != "") && ($opts(error_output) != "")) } {
|
|
|
58725c |
+ perror "bad mix of warning, error, warning_output, and error_output\
|
|
|
58725c |
+ test-directives"
|
|
|
58725c |
+ unresolved $testname
|
|
|
58725c |
+ return
|
|
|
58725c |
+ }
|
|
|
58725c |
+
|
|
|
58725c |
+ set check_prog(source) ""
|
|
|
58725c |
+ set check_prog(terminal) 0
|
|
|
58725c |
+ if { $opts(error) != "" \
|
|
|
58725c |
+ || $opts(warning) != "" \
|
|
|
58725c |
+ || $opts(error_output) != "" \
|
|
|
58725c |
+ || $opts(warning_output) != "" } {
|
|
|
58725c |
+
|
|
|
58725c |
+ if { $opts(error) != "" || $opts(error_output) != "" } {
|
|
|
58725c |
+ set check_prog(terminal) 1
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ set check_prog(terminal) 0
|
|
|
58725c |
+ }
|
|
|
58725c |
+
|
|
|
58725c |
+ if { $opts(error) != "" || $opts(warning) != "" } {
|
|
|
58725c |
+ set check_prog(source) "regex"
|
|
|
58725c |
+ if { $opts(error) != "" } {
|
|
|
58725c |
+ set check_prog(regex) $opts(error)
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ set check_prog(regex) $opts(warning)
|
|
|
58725c |
+ }
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ set check_prog(source) "file"
|
|
|
58725c |
+ if { $opts(error_output) != "" } {
|
|
|
58725c |
+ set check_prog(file) $opts(error_output)
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ set check_prog(file) $opts(warning_output)
|
|
|
58725c |
+ }
|
|
|
58725c |
+ }
|
|
|
58725c |
+ }
|
|
|
58725c |
+
|
|
|
58725c |
set progopts1 $opts($program)
|
|
|
58725c |
eval set progopts \$[string toupper $program]FLAGS
|
|
|
58725c |
eval set binary \$[string toupper $program]
|
|
|
58725c |
|
|
|
58725c |
set exec_output [binutils_run $binary "$progopts $progopts1 $tempfile $destopt ${copyfile}.o"]
|
|
|
58725c |
- if ![string match "" $exec_output] {
|
|
|
58725c |
- send_log "$exec_output\n"
|
|
|
58725c |
+ set cmdret 0
|
|
|
58725c |
+ if [info exists binutils_run_status] {
|
|
|
58725c |
+ set cmdret $binutils_run_status
|
|
|
58725c |
+ }
|
|
|
58725c |
+
|
|
|
58725c |
+ regsub "\n$" $exec_output "" exec_output
|
|
|
58725c |
+ if { $cmdret != 0 || $exec_output != "" || $check_prog(source) != "" } {
|
|
|
58725c |
+ set exitstat "succeeded"
|
|
|
58725c |
+ if { $cmdret != 0 } {
|
|
|
58725c |
+ set exitstat "failed"
|
|
|
58725c |
+ }
|
|
|
58725c |
+
|
|
|
58725c |
+ if { $check_prog(source) == "regex" } {
|
|
|
58725c |
+ verbose -log "$exitstat with: <$exec_output>,\
|
|
|
58725c |
+ expected: <$check_prog(regex)>"
|
|
|
58725c |
+ } elseif { $check_prog(source) == "file" } {
|
|
|
58725c |
+ verbose -log "$exitstat with: <$exec_output>,\
|
|
|
58725c |
+ expected in file $check_prog(file)"
|
|
|
58725c |
+ set_file_contents "tmpdir/prog.messages" "$exec_output"
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ verbose -log "$exitstat with: <$exec_output>, no expected output"
|
|
|
58725c |
+ }
|
|
|
58725c |
+ send_log -- "$exec_output\n"
|
|
|
58725c |
verbose "$exec_output"
|
|
|
58725c |
- fail $testname
|
|
|
58725c |
- return
|
|
|
58725c |
+
|
|
|
58725c |
+ if { (($check_prog(source) == "") == ($exec_output == "")) \
|
|
|
58725c |
+ && (($cmdret == 0) == ($check_prog(terminal) == 0)) \
|
|
|
58725c |
+ && ((($check_prog(source) == "regex") \
|
|
|
58725c |
+ && ($check_prog(regex) == "") == ($exec_output == "") \
|
|
|
58725c |
+ && [regexp -- $check_prog(regex) $exec_output]) \
|
|
|
58725c |
+ || (($check_prog(source) == "file") \
|
|
|
58725c |
+ && (![regexp_diff "tmpdir/prog.messages" \
|
|
|
58725c |
+ "$srcdir/$subdir/$check_prog(file)"]))) } {
|
|
|
58725c |
+ # We have the expected output from prog.
|
|
|
58725c |
+ if { $check_prog(terminal) || $program == "" } {
|
|
|
58725c |
+ pass $testname
|
|
|
58725c |
+ return
|
|
|
58725c |
+ }
|
|
|
58725c |
+ } else {
|
|
|
58725c |
+ fail $testname
|
|
|
58725c |
+ return
|
|
|
58725c |
+ }
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
set progopts1 $opts($dumpprogram)
|
|
|
58725c |
@@ -534,7 +650,7 @@ proc run_dump_test { name {extra_options
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
verbose_eval {[file_contents "tmpdir/dump.out"]} 3
|
|
|
58725c |
- if { [regexp_diff "tmpdir/dump.out" "${file}.d"] } then {
|
|
|
58725c |
+ if { [regexp_diff "tmpdir/dump.out" "${dumpfile}"] } then {
|
|
|
58725c |
fail $testname
|
|
|
58725c |
verbose "output is [file_contents "tmpdir/dump.out"]" 2
|
|
|
58725c |
return
|
|
|
58725c |
--- /dev/null 2018-04-11 08:10:00.466225454 +0100
|
|
|
58725c |
+++ binutils-2.27/binutils/testsuite/binutils-all/strip-13.d 2018-04-11 12:55:42.481306111 +0100
|
|
|
58725c |
@@ -0,0 +1,10 @@
|
|
|
58725c |
+#PROG: strip
|
|
|
58725c |
+#strip: -g
|
|
|
58725c |
+#error: \A[^\n]*: invalid relocation type 143\n
|
|
|
58725c |
+#error: [^\n]*: Bad value\Z
|
|
|
58725c |
+#not-target: h8300-* ip2k-* m6811-* m68hc11-* rx-*
|
|
|
58725c |
+# The H8300-*, IP2K and 68HC11 targets use 16-bit addressing, so `.dc.a'
|
|
|
58725c |
+# does not work for manual relocation data construction.
|
|
|
58725c |
+# The RX targets do not complain about unrecognised relocs, unless they
|
|
|
58725c |
+# are actually used
|
|
|
58725c |
+# (which is what should really happen with the other targets...)
|
|
|
58725c |
--- /dev/null 2018-04-11 08:10:00.466225454 +0100
|
|
|
58725c |
+++ binutils-2.27/binutils/testsuite/binutils-all/strip-13mips64.s 2018-04-11 12:37:17.195412074 +0100
|
|
|
58725c |
@@ -0,0 +1,14 @@
|
|
|
58725c |
+ .text
|
|
|
58725c |
+foo:
|
|
|
58725c |
+ .dc.l 0x12345678
|
|
|
58725c |
+
|
|
|
58725c |
+ .section .rela.text
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
+ .dc.l 0
|
|
|
58725c |
+ .dc.b 0, 0, 0, 0x8f
|
|
|
58725c |
+ .dc.a 0x0000008f
|
|
|
58725c |
+
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
+ .dc.l 0
|
|
|
58725c |
+ .dc.b 0, 0, 0, 0
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
--- /dev/null 2018-04-11 08:10:00.466225454 +0100
|
|
|
58725c |
+++ binutils-2.27/binutils/testsuite/binutils-all/strip-13rela.s 2018-04-11 12:37:17.195412074 +0100
|
|
|
58725c |
@@ -0,0 +1,12 @@
|
|
|
58725c |
+ .text
|
|
|
58725c |
+foo:
|
|
|
58725c |
+ .dc.l 0x12345678
|
|
|
58725c |
+
|
|
|
58725c |
+ .section .rela.text
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
+ .dc.a 0x0000008f
|
|
|
58725c |
+ .dc.a 0x0000008f
|
|
|
58725c |
+
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
--- /dev/null 2018-04-11 08:10:00.466225454 +0100
|
|
|
58725c |
+++ binutils-2.27/binutils/testsuite/binutils-all/strip-13rel.s 2018-04-11 12:37:17.195412074 +0100
|
|
|
58725c |
@@ -0,0 +1,10 @@
|
|
|
58725c |
+ .text
|
|
|
58725c |
+foo:
|
|
|
58725c |
+ .dc.l 0x12345678
|
|
|
58725c |
+
|
|
|
58725c |
+ .section .rel.text
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
+ .dc.a 0x0000008f
|
|
|
58725c |
+
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
+ .dc.a 0
|
|
|
58725c |
--- binutils.orig/bfd/elfnn-aarch64.c 2018-04-11 12:34:04.649683557 +0100
|
|
|
58725c |
+++ binutils-2.27/bfd/elfnn-aarch64.c 2018-04-11 13:33:08.539305994 +0100
|
|
|
58725c |
@@ -1977,6 +1977,8 @@ elfNN_aarch64_info_to_howto (bfd *abfd A
|
|
|
58725c |
|
|
|
58725c |
r_type = ELFNN_R_TYPE (elf_reloc->r_info);
|
|
|
58725c |
bfd_reloc->howto = elfNN_aarch64_howto_from_type (r_type);
|
|
|
58725c |
+ if (bfd_reloc->howto == NULL)
|
|
|
58725c |
+ _bfd_error_handler (_("%B: invalid relocation type %d"), abfd, r_type);
|
|
|
58725c |
}
|
|
|
58725c |
|
|
|
58725c |
static reloc_howto_type *
|