aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'binutils')
-rw-r--r--binutils/NEWS21
-rwxr-xr-xbinutils/configure390
-rw-r--r--binutils/configure.ac2
-rw-r--r--binutils/dwarf.c35
-rw-r--r--binutils/dwarf.h1
-rw-r--r--binutils/objcopy.c2
-rw-r--r--binutils/objdump.c59
-rw-r--r--binutils/readelf.c50
8 files changed, 91 insertions, 469 deletions
diff --git a/binutils/NEWS b/binutils/NEWS
index a624106..6ef8e67 100644
--- a/binutils/NEWS
+++ b/binutils/NEWS
@@ -1,5 +1,22 @@
-*- text -*-
+* On s390 64-bit (s390x), gas, ld, objdump, and readelf now support generating
+ and processing SFrame V2 stack trace information (.sframe). The assembler
+ generates SFrame info from CFI directives with option "--gsframe". The
+ linker generates SFrame info for the linker-generated .plt section and merges
+ all .sframe sections. Both objdump and readelf dump SFrame info with option
+ "--sframe[=<section-name>]".
+
+* For SFrame stack trace format, the function start address in each SFrame
+ FDE has a changed encoding: The 32-bit signed integer now holds the offset
+ of the start PC of the associated function from the sfde_func_start_address
+ field itself (instead of the earlier where it was the offset from the start
+ of the SFrame section itself). All SFrame sections generated by gas and ld
+ now default to this new encoding, setting the (new)
+ SFRAME_F_FDE_FUNC_START_PCREL flag.
+
+ Relocatable SFrame links are now fixed.
+
* Readelf now recognizes RISC-V GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS and
GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED for zicfiss and zicfilp
extensions.
@@ -7,6 +24,10 @@
* For RISC-V dis-assembler, the definition of mapping symbol $x is changed,
so the file needs to be rebuilt since 2.45 once used .option arch directives.
+* The LoongArch disassembler now properly accepts multiple disassembly
+ options given by -M, such as "-M no-aliases,numeric". (Previously only the
+ first option took effect.)
+
Changes in 2.44:
* Support for Nios II targets has been removed except in the readelf utility,
diff --git a/binutils/configure b/binutils/configure
index a2a5bf0..4b24376 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -14675,287 +14675,6 @@ $as_echo "$LINGUAS" >&6; }
fi
-
-
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-# Find out how to test for executable files. Don't use a zero-byte file,
-# as systems may use methods other than mode bits to determine executability.
-cat >conf$$.file <<_ASEOF
-#! /bin/sh
-exit 0
-_ASEOF
-chmod +x conf$$.file
-if test -x conf$$.file >/dev/null 2>&1; then
- ac_executable_p="test -x"
-else
- ac_executable_p="test -f"
-fi
-rm -f conf$$.file
-
-# Extract the first word of "msgfmt", so it can be a program name with args.
-set dummy msgfmt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_MSGFMT+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case "$MSGFMT" in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
- ;;
- *)
- ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH; do
- IFS="$ac_save_IFS"
- test -z "$ac_dir" && ac_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
- if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
- (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
- ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext"
- break 2
- fi
- fi
- done
- done
- IFS="$ac_save_IFS"
- test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":"
- ;;
-esac
-fi
-MSGFMT="$ac_cv_path_MSGFMT"
-if test "$MSGFMT" != ":"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
-$as_echo "$MSGFMT" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- # Extract the first word of "gmsgfmt", so it can be a program name with args.
-set dummy gmsgfmt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GMSGFMT+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $GMSGFMT in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
- ;;
-esac
-fi
-GMSGFMT=$ac_cv_path_GMSGFMT
-if test -n "$GMSGFMT"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5
-$as_echo "$GMSGFMT" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-# Find out how to test for executable files. Don't use a zero-byte file,
-# as systems may use methods other than mode bits to determine executability.
-cat >conf$$.file <<_ASEOF
-#! /bin/sh
-exit 0
-_ASEOF
-chmod +x conf$$.file
-if test -x conf$$.file >/dev/null 2>&1; then
- ac_executable_p="test -x"
-else
- ac_executable_p="test -f"
-fi
-rm -f conf$$.file
-
-# Extract the first word of "xgettext", so it can be a program name with args.
-set dummy xgettext; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_XGETTEXT+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case "$XGETTEXT" in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
- ;;
- *)
- ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH; do
- IFS="$ac_save_IFS"
- test -z "$ac_dir" && ac_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
- if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
- (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
- ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext"
- break 2
- fi
- fi
- done
- done
- IFS="$ac_save_IFS"
- test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
- ;;
-esac
-fi
-XGETTEXT="$ac_cv_path_XGETTEXT"
-if test "$XGETTEXT" != ":"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
-$as_echo "$XGETTEXT" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- rm -f messages.po
-
-
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-# Find out how to test for executable files. Don't use a zero-byte file,
-# as systems may use methods other than mode bits to determine executability.
-cat >conf$$.file <<_ASEOF
-#! /bin/sh
-exit 0
-_ASEOF
-chmod +x conf$$.file
-if test -x conf$$.file >/dev/null 2>&1; then
- ac_executable_p="test -x"
-else
- ac_executable_p="test -f"
-fi
-rm -f conf$$.file
-
-# Extract the first word of "msgmerge", so it can be a program name with args.
-set dummy msgmerge; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_MSGMERGE+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case "$MSGMERGE" in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
- ;;
- *)
- ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH; do
- IFS="$ac_save_IFS"
- test -z "$ac_dir" && ac_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
- if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then
- ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext"
- break 2
- fi
- fi
- done
- done
- IFS="$ac_save_IFS"
- test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":"
- ;;
-esac
-fi
-MSGMERGE="$ac_cv_path_MSGMERGE"
-if test "$MSGMERGE" != ":"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5
-$as_echo "$MSGMERGE" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- if test "$GMSGFMT" != ":"; then
- if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
- (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
- : ;
- else
- GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5
-$as_echo "found $GMSGFMT program is not GNU msgfmt; ignore it" >&6; }
- GMSGFMT=":"
- fi
- fi
-
- if test "$XGETTEXT" != ":"; then
- if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
- (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
- : ;
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: found xgettext program is not GNU xgettext; ignore it" >&5
-$as_echo "found xgettext program is not GNU xgettext; ignore it" >&6; }
- XGETTEXT=":"
- fi
- rm -f messages.po
- fi
-
- ac_config_commands="$ac_config_commands default-2"
-
-
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
# Check whether --enable-maintainer-mode was given.
@@ -17613,13 +17332,6 @@ fi
# Capture the value of LINGUAS because we need it to compute CATALOGS.
LINGUAS="${LINGUAS-%UNSET%}"
-# Capture the value of obsolete ALL_LINGUAS because we need it to compute
- # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
- # from automake.
- eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
- # Capture the value of LINGUAS because we need it to compute CATALOGS.
- LINGUAS="${LINGUAS-%UNSET%}"
-
_ACEOF
@@ -17633,7 +17345,6 @@ do
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
"default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
- "default-2") CONFIG_COMMANDS="$CONFIG_COMMANDS default-2" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in:po/Make-in" ;;
@@ -19064,107 +18775,6 @@ _LT_EOF
;;
esac
done ;;
- "default-2":C)
- for ac_file in $CONFIG_FILES; do
- # Support "outfile[:infile[:infile...]]"
- case "$ac_file" in
- *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- esac
- # PO directories have a Makefile.in generated from Makefile.in.in.
- case "$ac_file" in */Makefile.in)
- # Adjust a relative srcdir.
- ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
- ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
- ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
- # In autoconf-2.13 it is called $ac_given_srcdir.
- # In autoconf-2.50 it is called $srcdir.
- test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
- case "$ac_given_srcdir" in
- .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
- /*) top_srcdir="$ac_given_srcdir" ;;
- *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
- if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
- rm -f "$ac_dir/POTFILES"
- test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
- cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
- POMAKEFILEDEPS="POTFILES.in"
- # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
- # on $ac_dir but don't depend on user-specified configuration
- # parameters.
- if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
- # The LINGUAS file contains the set of available languages.
- if test -n "$OBSOLETE_ALL_LINGUAS"; then
- test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.ac is obsolete" || echo "setting ALL_LINGUAS in configure.ac is obsolete"
- fi
- ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
- # Hide the ALL_LINGUAS assigment from automake.
- eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
- POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
- else
- # The set of available languages was given in configure.ac.
- eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
- fi
- case "$ac_given_srcdir" in
- .) srcdirpre= ;;
- *) srcdirpre='$(srcdir)/' ;;
- esac
- POFILES=
- GMOFILES=
- UPDATEPOFILES=
- DUMMYPOFILES=
- for lang in $ALL_LINGUAS; do
- POFILES="$POFILES $srcdirpre$lang.po"
- GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
- UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
- DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
- done
- # CATALOGS depends on both $ac_dir and the user's LINGUAS
- # environment variable.
- INST_LINGUAS=
- if test -n "$ALL_LINGUAS"; then
- for presentlang in $ALL_LINGUAS; do
- useit=no
- if test "%UNSET%" != "$LINGUAS"; then
- desiredlanguages="$LINGUAS"
- else
- desiredlanguages="$ALL_LINGUAS"
- fi
- for desiredlang in $desiredlanguages; do
- # Use the presentlang catalog if desiredlang is
- # a. equal to presentlang, or
- # b. a variant of presentlang (because in this case,
- # presentlang can be used as a fallback for messages
- # which are not translated in the desiredlang catalog).
- case "$desiredlang" in
- "$presentlang"*) useit=yes;;
- esac
- done
- if test $useit = yes; then
- INST_LINGUAS="$INST_LINGUAS $presentlang"
- fi
- done
- fi
- CATALOGS=
- if test -n "$INST_LINGUAS"; then
- for lang in $INST_LINGUAS; do
- CATALOGS="$CATALOGS $lang.gmo"
- done
- fi
- test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
- sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
- for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
- if test -f "$f"; then
- case "$f" in
- *.orig | *.bak | *~) ;;
- *) cat "$f" >> "$ac_dir/Makefile" ;;
- esac
- fi
- done
- fi
- ;;
- esac
- done ;;
esac
done # for ac_tag
diff --git a/binutils/configure.ac b/binutils/configure.ac
index 75ba9d3..cb65e50 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -156,8 +156,8 @@ AC_PROG_YACC
AM_PROG_LEX
ALL_LINGUAS="bg ca da es fi fr hr id it ja pt ro ru rw sk sr sv tr uk vi zh_CN zh_TW"
-ZW_GNU_GETTEXT_SISTER_DIR
AM_PO_SUBDIRS
+ZW_GNU_GETTEXT_SISTER_DIR
AM_MAINTAINER_MODE
AM_CONDITIONAL(GENINSRC_NEVER, false)
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 8806cde..e0e202f 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -30,6 +30,7 @@
#include "gdb/gdb-index.h"
#include "filenames.h"
#include "safe-ctype.h"
+#include "sframe-api.h"
#include <assert.h>
#ifdef HAVE_LIBDEBUGINFOD
@@ -102,6 +103,7 @@ int do_debug_str;
int do_debug_str_offsets;
int do_debug_loc;
int do_gdb_index;
+int do_sframe;
int do_trace_info;
int do_trace_abbrevs;
int do_trace_aranges;
@@ -7689,6 +7691,37 @@ display_trace_info (struct dwarf_section *section, void *file)
}
static int
+display_sframe (struct dwarf_section *section, void *file ATTRIBUTE_UNUSED)
+{
+ sframe_decoder_ctx *sfd_ctx = NULL;
+ unsigned char *data = section->start;
+ size_t sf_size = section->size;
+ int err = 0;
+
+ if (strcmp (section->name, "") == 0)
+ {
+ error (_("Section name must be provided \n"));
+ return false;
+ }
+
+ /* Decode the contents of the section. */
+ sfd_ctx = sframe_decode ((const char*)data, sf_size, &err);
+ if (!sfd_ctx || err)
+ {
+ error (_("SFrame decode failure: %s\n"), sframe_errmsg (err));
+ return false;
+ }
+
+ printf (_("Contents of the SFrame section %s:"), section->name);
+ /* Dump the contents as text. */
+ dump_sframe (sfd_ctx, section->address);
+
+ sframe_decoder_free (&sfd_ctx);
+
+ return true;
+}
+
+static int
display_debug_aranges (struct dwarf_section *section,
void *file ATTRIBUTE_UNUSED)
{
@@ -12671,6 +12704,7 @@ static const debug_dump_long_opts debug_option_table[] =
/* For compatibility with earlier versions of readelf. */
{ 'r', "ranges", &do_debug_aranges, 1 },
{ 's', "str", &do_debug_str, 1 },
+ { '\0', "sframe-internal-only", &do_sframe, 1 },
{ 'T', "trace_aranges", &do_trace_aranges, 1 },
{ 't', "pubtypes", &do_debug_pubtypes, 1 },
{ 'U', "trace_info", &do_trace_info, 1 },
@@ -12829,6 +12863,7 @@ struct dwarf_section_display debug_displays[] =
{ { ".debug_weaknames", ".zdebug_weaknames", "", NO_ABBREVS }, display_debug_not_supported, NULL, false },
{ { ".gdb_index", "", "", NO_ABBREVS }, display_gdb_index, &do_gdb_index, false },
{ { ".debug_names", "", "", NO_ABBREVS }, display_debug_names, &do_gdb_index, false },
+ { { ".sframe", "", "", NO_ABBREVS }, display_sframe, &do_sframe, true },
{ { ".trace_info", "", "", ABBREV (trace_abbrev) }, display_trace_info, &do_trace_info, true },
{ { ".trace_abbrev", "", "", NO_ABBREVS }, display_debug_abbrev, &do_trace_abbrevs, false },
{ { ".trace_aranges", "", "", NO_ABBREVS }, display_debug_aranges, &do_trace_aranges, false },
diff --git a/binutils/dwarf.h b/binutils/dwarf.h
index 3419027..6f693b1 100644
--- a/binutils/dwarf.h
+++ b/binutils/dwarf.h
@@ -102,6 +102,7 @@ enum dwarf_section_display_enum
weaknames,
gdb_index,
debug_names,
+ sframe,
trace_info,
trace_abbrev,
trace_aranges,
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 2e98ba4..8c90773 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -4398,7 +4398,7 @@ setup_section (bfd *ibfd, sec_ptr isection, bfd *obfd)
/* Allow the BFD backend to copy any private data it understands
from the input section to the output section. */
- if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
+ if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection, NULL))
err = _("failed to copy private data");
if (make_nobits)
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 43cfb79..7bb6d76 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -4987,44 +4987,20 @@ dump_ctf (bfd *abfd ATTRIBUTE_UNUSED, const char *sect_name ATTRIBUTE_UNUSED,
#endif
static void
-dump_section_sframe (bfd *abfd ATTRIBUTE_UNUSED,
- const char * sect_name)
-{
- asection *sec;
- sframe_decoder_ctx *sfd_ctx = NULL;
- bfd_size_type sf_size;
- bfd_byte *sframe_data;
- bfd_vma sf_vma;
- int err = 0;
-
- if (sect_name == NULL)
- sect_name = ".sframe";
+dump_sframe_section (bfd *abfd, const char *sect_name, bool is_mainfile)
- sec = read_section (abfd, sect_name, &sframe_data);
- if (sec == NULL)
- {
- my_bfd_nonfatal (bfd_get_filename (abfd));
- return;
- }
- sf_size = bfd_section_size (sec);
- sf_vma = bfd_section_vma (sec);
-
- /* Decode the contents of the section. */
- sfd_ctx = sframe_decode ((const char*)sframe_data, sf_size, &err);
- if (!sfd_ctx)
+{
+ /* Error checking for user provided SFrame section name, if any. */
+ if (sect_name)
{
- my_bfd_nonfatal (bfd_get_filename (abfd));
- free (sframe_data);
- return;
+ asection *sec = bfd_get_section_by_name (abfd, sect_name);
+ if (sec == NULL)
+ {
+ printf (_("No %s section present\n\n"), sanitize_string (sect_name));
+ return;
+ }
}
-
- printf (_("Contents of the SFrame section %s:"),
- sanitize_string (sect_name));
- /* Dump the contents as text. */
- dump_sframe (sfd_ctx, sf_vma);
-
- sframe_decoder_free (&sfd_ctx);
- free (sframe_data);
+ dump_dwarf (abfd, is_mainfile);
}
@@ -5846,7 +5822,7 @@ dump_bfd (bfd *abfd, bool is_mainfile)
dump_ctf (abfd, dump_ctf_section_name, dump_ctf_parent_name,
dump_ctf_parent_section_name);
if (dump_sframe_section_info)
- dump_section_sframe (abfd, dump_sframe_section_name);
+ dump_sframe_section (abfd, dump_sframe_section_name, is_mainfile);
if (dump_stab_section_info)
dump_stabs (abfd);
if (dump_reloc_info && ! disassemble)
@@ -6310,7 +6286,9 @@ main (int argc, char **argv)
seenflag = true;
if (optarg)
{
- if (dwarf_select_sections_by_names (optarg))
+ if (strcmp (optarg, "sframe-internal-only") == 0)
+ warn (_("Unrecognized debug option 'sframe-internal-only'\n"));
+ else if (dwarf_select_sections_by_names (optarg))
dump_dwarf_section_info = true;
}
else
@@ -6351,8 +6329,15 @@ main (int argc, char **argv)
#endif
case OPTION_SFRAME:
dump_sframe_section_info = true;
+
if (optarg)
dump_sframe_section_name = xstrdup (optarg);
+
+ /* Error checking for user-provided section name is done in
+ dump_sframe_section (). Initialize for now with the default
+ internal name: "sframe-internal-only". */
+ dwarf_select_sections_by_names ("sframe-internal-only");
+
seenflag = true;
break;
case 'G':
diff --git a/binutils/readelf.c b/binutils/readelf.c
index f49092f..5730247 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -6538,6 +6538,8 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
dump_any_debugging = true;
dwarf_select_sections_all ();
}
+ else if (strcmp (optarg, "sframe-internal-only") == 0)
+ warn (_("Unrecognized debug option 'sframe-internal-only'\n"));
else
{
do_debugging = false;
@@ -6583,9 +6585,15 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
break;
case OPTION_SFRAME_DUMP:
do_sframe = true;
+ /* Fix PR/32589 but keep the error messaging same ? */
+ if (optarg != NULL && strcmp (optarg, "") == 0)
+ {
+ do_dump = true;
+ error (_("Section name must be provided\n"));
+ }
/* Providing section name is optional. request_dump (), however,
thrives on non NULL optarg. Handle it explicitly here. */
- if (optarg != NULL)
+ else if (optarg != NULL)
request_dump (dumpdata, SFRAME_DUMP);
else
{
@@ -17102,44 +17110,6 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
#endif
static bool
-dump_section_as_sframe (Elf_Internal_Shdr * section, Filedata * filedata)
-{
- void * data = NULL;
- sframe_decoder_ctx *sfd_ctx = NULL;
- const char *print_name = printable_section_name (filedata, section);
-
- bool ret = true;
- size_t sf_size;
- int err = 0;
-
- if (strcmp (print_name, "") == 0)
- {
- error (_("Section name must be provided \n"));
- ret = false;
- return ret;
- }
-
- data = get_section_contents (section, filedata);
- sf_size = section->sh_size;
- /* Decode the contents of the section. */
- sfd_ctx = sframe_decode ((const char*)data, sf_size, &err);
- if (!sfd_ctx)
- {
- ret = false;
- error (_("SFrame decode failure: %s\n"), sframe_errmsg (err));
- goto fail;
- }
-
- printf (_("Contents of the SFrame section %s:"), print_name);
- /* Dump the contents as text. */
- dump_sframe (sfd_ctx, section->sh_addr);
-
- fail:
- free (data);
- return ret;
-}
-
-static bool
load_specific_debug_section (enum dwarf_section_display_enum debug,
const Elf_Internal_Shdr * sec,
void * data)
@@ -17706,7 +17676,7 @@ process_section_contents (Filedata * filedata)
#endif
if (dump & SFRAME_DUMP)
{
- if (! dump_section_as_sframe (section, filedata))
+ if (! display_debug_section (i, section, filedata))
res = false;
}
}