+2020-01-09 Aaron Merey <amerey@redhat.com>
+
+ * config/debuginfod.m4: New file. Add macro AC_DEBUGINFOD. Adds
+ new configure option --with-debuginfod.
+ * configure: Regenerate.
+ * configure.ac: Call AC_DEBUGINFOD.
+
2019-12-26 Christian Biesinger <cbiesinger@google.com>
* .gitignore: Add perf.data and perf.data.old.
+2020-01-10 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ PR ld/22269
+ * elf32-arm.c (elf32_arm_final_link_relocate): Use
+ UNDEFWEAK_NO_DYNAMIC_RELOC.
+ (allocate_dynrelocs_for_symbol): Likewise.
+
+2020-01-10 Tamar Christina <tamar.christina@arm.com>
+
+ PR 25210
+ * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Remove elfclass.
+
+2020-01-10 Alan Modra <amodra@gmail.com>
+
+ * coff-alpha.c (alpha_ecoff_object_p): Calculate size in bfd_size_type.
+
+2020-01-09 Nick Clifton <nickc@redhat.com>
+
+ PR 25221
+ * bfd.c (bfd_convert_section_contents): Check for a compress
+ header size that is larger than the actual section size.
+
2020-01-08 Alan Modra <amodra@gmail.com>
PR 25351
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
- /* Do nothing if ELF classes of input and output are the same. */
+ /* Do nothing if ELF classes of input and output are the same. */
if (get_elf_backend_data (ibfd)->s->elfclass
== get_elf_backend_data (obfd)->s->elfclass)
return TRUE;
if ((ibfd->flags & BFD_DECOMPRESS))
return TRUE;
- /* Do nothing if the input section isn't a SHF_COMPRESSED section. */
+ /* Do nothing if the input section isn't a SHF_COMPRESSED section. */
ihdr_size = bfd_get_compression_header_size (ibfd, isec);
if (ihdr_size == 0)
return TRUE;
+ /* PR 25221. Check for corrupt input sections. */
+ if (ihdr_size > bfd_get_section_limit (ibfd, isec))
+ /* FIXME: Issue a warning about a corrupt
+ compression header size field ? */
+ return FALSE;
+
contents = *ptr;
/* Convert the contents of the input SHF_COMPRESSED section to
use_memmove = FALSE;
}
+ else if (ihdr_size != sizeof (Elf64_External_Chdr))
+ {
+ /* FIXME: Issue a warning about a corrupt
+ compression header size field ? */
+ return FALSE;
+ }
else
{
Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents;
{
bfd_size_type size;
- size = sec->line_filepos * 8;
+ size = (bfd_size_type) sec->line_filepos * 8;
BFD_ASSERT (size == sec->size
|| size + 8 == sec->size);
if (!bfd_set_section_size (sec, size))
if (dynreloc_st_type == STT_GNU_IFUNC)
outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
else if (bfd_link_pic (info)
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
else
{
GOT entry's R_ARM_IRELATIVE relocation. */
elf32_arm_allocate_irelocs (info, htab->root.srelgot, 1);
else if (bfd_link_pic (info)
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
/* Reserve room for the GOT entry's R_ARM_RELATIVE relocation. */
elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
else if (htab->fdpic_p && tls_type == GOT_NORMAL)
if (s_name == NULL)
return NULL;
- /* PR 25210. Set the right class on the stub_bfd. */
- elf_elfheader (htab->stub_bfd)->e_ident[EI_CLASS] = ELFCLASSNN;
- BFD_ASSERT (ELFCLASSNN == get_elf_backend_data (htab->stub_bfd)->s->elfclass);
-
memcpy (s_name, section->name, namelen);
memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
return (*htab->add_stub_section) (s_name, section);
In releases, the date is not included in either version strings or
sonames. */
-#define BFD_VERSION_DATE 20200109
+#define BFD_VERSION_DATE 20200110
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
+2020-01-09 Nick Clifton <nickc@redhat.com>
+
+ PR 25220
+ * objcopy.c (empty_name): New variable.
+ (need_sym_before): Prevent an attempt to free a static variable.
+ (filter_symbols): Avoid strcmp test by checking for pointer
+ equality.
+
+2020-01-09 Nick Clifton <nickc@redhat.com>
+
+ * po/zh_TW.po: Updated Traditional Chinese translation.
+
+2020-01-09 Aaron Merey <amerey@redhat.com>
+
+ * Makefile.am (readelf_LDADD, objdump_LDADD): Add libdebuginfod.
+ * Makefile.in: Regenerate.
+ * NEWS: Update.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: Call AC_DEBUGINFOD.
+ * doc/Makefile.in: Regenerate.
+ * doc/binutils.texi: Add section on using binutils
+ with debuginfod.
+ * dwarf.c (debuginfod_fetch_separate_debug_info): New function.
+ Query debuginfod servers for the target debug file.
+ (load_separate_debug_info): Call
+ debuginfod_fetch_separate_debug_info if configured with
+ debuginfod.
+ (load_separate_debug_files): Add file argument to
+ load_separate_debug_info calls.
+ * dwarf.h (get_build_id): Add declaration.
+ * objdump.c (get_build_id): New function. Get build-id of file.
+ * readelf.c (get_build_id): Likewise.
+ * testsuite/binutils-all/debuginfod.exp: New tests.
+ * testsuite/binutils-all/linkdebug.s: Add .note.gnu.build-id
+ section.
+
2020-01-02 Sergey Belyashov <sergey.belyashov@gmail.com>
* readelf.c: Add support for new Z*) relocations and machine
AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
LIBICONV = @LIBICONV@
+LIBDEBUGINFOD = @LIBDEBUGINFOD@
+
# these two are almost the same program
AR_PROG=ar
RANLIB_PROG=ranlib
strings_SOURCES = strings.c $(BULIBS)
readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c $(ELFLIBS)
-readelf_LDADD = $(LIBINTL) $(LIBCTF_NOBFD) $(LIBIBERTY) $(ZLIB)
+readelf_LDADD = $(LIBINTL) $(LIBCTF_NOBFD) $(LIBIBERTY) $(ZLIB) $(LIBDEBUGINFOD)
elfedit_SOURCES = elfedit.c version.c $(ELFLIBS)
elfedit_LDADD = $(LIBINTL) $(LIBIBERTY)
objdump_SOURCES = objdump.c dwarf.c prdbg.c $(DEBUG_SRCS) $(BULIBS) $(ELFLIBS)
EXTRA_objdump_SOURCES = od-xcoff.c
-objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL)
+objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(LIBDEBUGINFOD)
objdump.@OBJEXT@:objdump.c
if am__fastdepCC
$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../bfd/version.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../bfd/version.m4 \
+ $(top_srcdir)/../config/debuginfod.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDEBUGINFOD = @LIBDEBUGINFOD@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBINTL_DEP = @LIBINTL_DEP@
objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
strings_SOURCES = strings.c $(BULIBS)
readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c $(ELFLIBS)
-readelf_LDADD = $(LIBINTL) $(LIBCTF_NOBFD) $(LIBIBERTY) $(ZLIB)
+readelf_LDADD = $(LIBINTL) $(LIBCTF_NOBFD) $(LIBIBERTY) $(ZLIB) $(LIBDEBUGINFOD)
elfedit_SOURCES = elfedit.c version.c $(ELFLIBS)
elfedit_LDADD = $(LIBINTL) $(LIBIBERTY)
strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
nm_new_SOURCES = nm.c $(BULIBS)
objdump_SOURCES = objdump.c dwarf.c prdbg.c $(DEBUG_SRCS) $(BULIBS) $(ELFLIBS)
EXTRA_objdump_SOURCES = od-xcoff.c
-objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL)
+objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(LIBDEBUGINFOD)
cxxfilt_SOURCES = cxxfilt.c $(BULIBS)
ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c binemul.c \
emul_$(EMULATION).c $(BULIBS)
-*- text -*-
+* Binutils now supports debuginfod, an HTTP server for distributing
+ ELF/DWARF debugging information as well as source code. When built with
+ debuginfod, readelf and objdump can automatically query debuginfod
+ servers for separate debug files when they otherwise cannot be found.
+ To build binutils with debuginfod, pass --with-debuginfod to configure.
+ This requires libdebuginfod, the debuginfod client library. debuginfod
+ is distributed with elfutils, starting with version 0.178. For more
+ information see https://sourceware.org/elfutils.
+
* Add --output option to the "ar" program. This option can be used to specify
the output directory when extracting members from an archive.
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
+/* Define to 1 if debuginfod is enabled. */
+#undef HAVE_LIBDEBUGINFOD
+
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
NO_WERROR
WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
+LIBDEBUGINFOD
OTOOL64
OTOOL
LIPO
enable_targets
enable_deterministic_archives
enable_default_strings_all
+with_debuginfod
enable_werror
enable_build_warnings
enable_nls
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-debuginfod Enable debuginfo lookups with debuginfod
+ (auto/yes/no)
--with-system-zlib use installed libz
--with-gnu-ld assume the C compiler uses GNU ld default=no
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
} # ac_fn_c_check_func
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
-
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- as_decl_name=`echo $2|sed 's/ *(.*//'`
- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
- (void) $as_decl_use;
-#else
- (void) $as_decl_name;
-#endif
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11526 "configure"
+#line 11530 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11632 "configure"
+#line 11636 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
+# Enable debuginfod
+
+# Check whether --with-debuginfod was given.
+if test "${with_debuginfod+set}" = set; then :
+ withval=$with_debuginfod;
+else
+ with_debuginfod=auto
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use debuginfod" >&5
+$as_echo_n "checking whether to use debuginfod... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_debuginfod" >&5
+$as_echo "$with_debuginfod" >&6; }
+
+if test "${with_debuginfod}" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod support disabled; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: debuginfod support disabled; some features may be unavailable." >&2;}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for debuginfod_begin in -ldebuginfod" >&5
+$as_echo_n "checking for debuginfod_begin in -ldebuginfod... " >&6; }
+if ${ac_cv_lib_debuginfod_debuginfod_begin+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldebuginfod $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char debuginfod_begin ();
+int
+main ()
+{
+return debuginfod_begin ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_debuginfod_debuginfod_begin=yes
+else
+ ac_cv_lib_debuginfod_debuginfod_begin=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_debuginfod_debuginfod_begin" >&5
+$as_echo "$ac_cv_lib_debuginfod_debuginfod_begin" >&6; }
+if test "x$ac_cv_lib_debuginfod_debuginfod_begin" = xyes; then :
+ have_debuginfod_lib=yes
+fi
+
+ ac_fn_c_check_decl "$LINENO" "debuginfod_begin" "ac_cv_have_decl_debuginfod_begin" "#include <elfutils/debuginfod.h>
+"
+if test "x$ac_cv_have_decl_debuginfod_begin" = xyes; then :
+ have_debuginfod_h=yes
+fi
+
+ if test "x$have_debuginfod_lib" = "xyes" -a \
+ "x$have_debuginfod_h" = "xyes"; then
+
+$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
+
+ LIBDEBUGINFOD="-ldebuginfod"
+
+ else
+
+ if test "$with_debuginfod" = yes; then
+ as_fn_error $? "debuginfod is missing or unusable" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&2;}
+ fi
+ fi
+fi
+
+
+
cat >>confdefs.h <<_ACEOF
#define DEFAULT_STRINGS_ALL $default_strings_all
_ACEOF
dnl
m4_include([../bfd/version.m4])
+m4_include([../config/debuginfod.m4])
AC_INIT([binutils], BFD_VERSION)
AC_CONFIG_SRCDIR(ar.c)
default_strings_all=1
fi], [default_strings_all=1])
+AC_DEBUGINFOD
+
AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
[Should strings use -a behavior by default?])
$(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
- $(top_srcdir)/../bfd/version.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../bfd/version.m4 \
+ $(top_srcdir)/../config/debuginfod.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDEBUGINFOD = @LIBDEBUGINFOD@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBINTL_DEP = @LIBINTL_DEP@
* elfedit:: Update ELF header and property of ELF files
* Common Options:: Command-line options for all utilities
* Selecting the Target System:: How these utilities determine the target
+* debuginfod:: Using binutils with debuginfod
* Reporting Bugs:: Reporting Bugs
* GNU Free Documentation License:: GNU Free Documentation License
* Binutils Index:: Binutils Index
deduced from the input file
@end enumerate
+@node debuginfod
+@chapter debuginfod
+@cindex separate debug files
+
+debuginfod is a web service that indexes ELF/DWARF debugging resources
+by build-id and serves them over HTTP.
+
+Binutils can be built with the debuginfod client library
+@code{libdebuginfod} using the @option{--with-debuginfod} configure option.
+This option is enabled by default if @code{libdebuginfod} is installed
+and found at configure time. This allows @command{objdump} and
+@command{readelf} to automatically query debuginfod servers for
+separate debug files when the files are otherwise not found.
+
+debuginfod is packaged with elfutils, starting with version 0.178.
+You can get the latest version from `https://sourceware.org/elfutils/'.
+
@node Reporting Bugs
@chapter Reporting Bugs
@cindex bugs
#include "safe-ctype.h"
#include <assert.h>
+#ifdef HAVE_LIBDEBUGINFOD
+#include <elfutils/debuginfod.h>
+#endif
+
#undef MAX
#undef MIN
#define MAX(a, b) ((a) > (b) ? (a) : (b))
first_separate_info = i;
}
+#if HAVE_LIBDEBUGINFOD
+/* Query debuginfod servers for the target debuglink or debugaltlink
+ file. If successful, store the path of the file in filename and
+ return TRUE, otherwise return FALSE. */
+
+static bfd_boolean
+debuginfod_fetch_separate_debug_info (struct dwarf_section * section,
+ char ** filename,
+ void * file)
+{
+ size_t build_id_len;
+ unsigned char * build_id;
+
+ if (strcmp (section->uncompressed_name, ".gnu_debuglink") == 0)
+ {
+ /* Get the build-id of file. */
+ build_id = get_build_id (file);
+ build_id_len = 0;
+ }
+ else if (strcmp (section->uncompressed_name, ".gnu_debugaltlink") == 0)
+ {
+ /* Get the build-id of the debugaltlink file. */
+ unsigned int filelen;
+
+ filelen = strnlen ((const char *)section->start, section->size);
+ if (filelen == section->size)
+ /* Corrupt debugaltlink. */
+ return FALSE;
+
+ build_id = section->start + filelen + 1;
+ build_id_len = section->size - (filelen + 1);
+
+ if (build_id_len == 0)
+ return FALSE;
+ }
+ else
+ return FALSE;
+
+ if (build_id)
+ {
+ int fd;
+ debuginfod_client * client;
+
+ client = debuginfod_begin ();
+ if (client == NULL)
+ return FALSE;
+
+ /* Query debuginfod servers for the target file. If found its path
+ will be stored in filename. */
+ fd = debuginfod_find_debuginfo (client, build_id, build_id_len, filename);
+ debuginfod_end (client);
+
+ /* Only free build_id if we allocated space for a hex string
+ in get_build_id (). */
+ if (build_id_len == 0)
+ free (build_id);
+
+ if (fd >= 0)
+ {
+ /* File successfully retrieved. Close fd since we want to
+ use open_debug_file () on filename instead. */
+ close (fd);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+#endif
+
static void *
load_separate_debug_info (const char * main_filename,
struct dwarf_section * xlink,
parse_func_type parse_func,
check_func_type check_func,
- void * func_data)
+ void * func_data,
+ void * file ATTRIBUTE_UNUSED)
{
const char * separate_filename;
char * debug_filename;
if (check_func (debug_filename, func_data))
goto found;
+#if HAVE_LIBDEBUGINFOD
+ {
+ char * tmp_filename;
+
+ if (debuginfod_fetch_separate_debug_info (xlink,
+ & tmp_filename,
+ file))
+ {
+ /* File successfully downloaded from server, replace
+ debug_filename with the file's path. */
+ free (debug_filename);
+ debug_filename = tmp_filename;
+ goto found;
+ }
+ }
+#endif
+
/* Failed to find the file. */
warn (_("could not find separate debug file '%s'\n"), separate_filename);
warn (_("tried: %s\n"), debug_filename);
sprintf (debug_filename, "%s", separate_filename);
warn (_("tried: %s\n"), debug_filename);
+#if HAVE_LIBDEBUGINFOD
+ {
+ char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
+ if (urls == NULL)
+ urls = "";
+
+ warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls);
+ }
+#endif
+
free (canon_dir);
free (debug_filename);
return NULL;
& debug_displays[gnu_debugaltlink].section,
parse_gnu_debugaltlink,
check_gnu_debugaltlink,
- & build_id_data);
+ & build_id_data,
+ file);
}
if (load_debug_section (gnu_debuglink, file))
& debug_displays[gnu_debuglink].section,
parse_gnu_debuglink,
check_gnu_debuglink,
- & crc32);
+ & crc32,
+ file);
}
if (first_separate_info != NULL)
extern dwarf_vma read_leb128 (unsigned char *, const unsigned char *const,
bfd_boolean, unsigned int *, int *);
+#if HAVE_LIBDEBUGINFOD
+extern unsigned char * get_build_id (void *);
+#endif
+
static inline void
report_leb_status (int status)
{
long symval;
flagword flags;
char * section;
- char * othersym;
+ const char * othersym;
};
typedef struct section_rename
string can't be parsed. */
static flagword
-parse_symflags (const char *s, char **other)
+parse_symflags (const char *s, const char **other)
{
flagword ret;
const char *snext;
return FALSE;
}
+/* Empty name is hopefully never a valid symbol name. */
+static const char * empty_name = "";
+
static bfd_boolean
need_sym_before (struct addsym_node **node, const char *sym)
{
{
if (!ptr->othersym)
break;
+ if (ptr->othersym == empty_name)
+ continue;
else if (strcmp (ptr->othersym, sym) == 0)
{
- free (ptr->othersym);
- ptr->othersym = ""; /* Empty name is hopefully never a valid symbol name. */
+ free ((char *) ptr->othersym);
+ ptr->othersym = empty_name;
*node = ptr;
return TRUE;
}
{
if (ptr->othersym)
{
- if (strcmp (ptr->othersym, ""))
+ if (ptr->othersym != empty_name)
fatal (_("'before=%s' not found"), ptr->othersym);
}
else
return data;
}
+#if HAVE_LIBDEBUGINFOD
+/* Return a hex string represention of the build-id. */
+
+unsigned char *
+get_build_id (void * data)
+{
+ unsigned i;
+ char * build_id_str;
+ bfd * abfd = (bfd *) data;
+ const struct bfd_build_id * build_id;
+
+ build_id = abfd->build_id;
+ if (build_id == NULL)
+ return NULL;
+
+ build_id_str = malloc (build_id->size * 2 + 1);
+ if (build_id_str == NULL)
+ return NULL;
+
+ for (i = 0; i < build_id->size; i++)
+ sprintf (build_id_str + (i * 2), "%02x", build_id->data[i]);
+ build_id_str[build_id->size * 2] = '\0';
+
+ return (unsigned char *)build_id_str;
+}
+#endif /* HAVE_LIBDEBUGINFOD */
+
static void
dump_dwarf_section (bfd *abfd, asection *section,
void *arg ATTRIBUTE_UNUSED)
"Project-Id-Version: binutils 2.31.90\n"
"Report-Msgid-Bugs-To: bug-binutils@gnu.org\n"
"POT-Creation-Date: 2019-01-19 16:32+0000\n"
-"PO-Revision-Date: 2019-10-11 01:58+0800\n"
+"PO-Revision-Date: 2019-12-15 21:07+0800\n"
"Last-Translator: pan93412 <pan93412@gmail.com>\n"
-"Language-Team: Chinese (traditional) <zh-l10n@linux.org.tw>\n"
+"Language-Team: Chinese (traditional) <zh-l10n@lists.linux.org.tw>\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Bugs: Report translation errors to the Language-Team address.\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Lokalize 19.08.1\n"
+"X-Generator: Lokalize 19.12.0\n"
#: addr2line.c:87
#, c-format
#: cxxfilt.c:124 nm.c:295 objdump.c:291
#, c-format
msgid "Report bugs to %s.\n"
-msgstr "將程式錯誤報告到 %s。\n"
+msgstr "請向 %s 匯報錯誤。\n"
#: debug.c:647
msgid "debug_add_to_current_namespace: no current file"
#: readelf.c:6289
#, c-format
msgid " [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n"
-msgstr " [è\99\9f] å\90\8d稱 é¡\9eå\9e\8b ä½\8då\9d\80 å\81\8f移 大å°\8f å\85¨ æ¨\99 連 資 齊\n"
+msgstr " [è\99\9f] å\90\8d稱 é¡\9eå\9e\8b ä½\8då\9d\80 å\81\8f移 大å°\8f å\85¨ æ\97\97 連 資 齊\n"
#: readelf.c:6296
#, fuzzy, c-format
#, c-format
msgid "%s: warning: unknown size for field `%s' in struct"
msgstr "%s:警告:結構中「%s」欄位的大小未知"
-
-#~ msgid "The information in section %s appears to be corrupt - the section is too small\n"
-#~ msgstr "位於區段 %s 中的列資訊似乎已損壞 - 區段過小\n"
-
-#~ msgid "unexpected end of debugging information"
-#~ msgstr "除錯資訊意外結束"
-
-#~ msgid "invalid number"
-#~ msgstr "無效的編號"
-
-#~ msgid "invalid string length"
-#~ msgstr "無效的字串長度"
-
-#~ msgid "expression stack overflow"
-#~ msgstr "表示式堆疊向上溢出"
-
-#~ msgid "unsupported IEEE expression operator"
-#~ msgstr "不支援的 IEEE 表示式運算子"
-
-#~ msgid "unknown section"
-#~ msgstr "未知的區段"
-
-#~ msgid "expression stack underflow"
-#~ msgstr "表示式堆疊向下溢出"
-
-#~ msgid "expression stack mismatch"
-#~ msgstr "表示式堆疊不匹配"
-
-#~ msgid "unknown builtin type"
-#~ msgstr "未知的內建類型"
-
-#~ msgid "unexpected number"
-#~ msgstr "意外的編號"
-
-#~ msgid "unexpected record type"
-#~ msgstr "意外的紀錄類型"
-
-#~ msgid "blocks left on stack at end"
-#~ msgstr "結束時仍留在堆疊中的區塊"
-
-#~ msgid "stack underflow"
-#~ msgstr "堆疊向下溢出"
-
-#~ msgid "illegal variable index"
-#~ msgstr "不正確的變數索引"
-
-#~ msgid "illegal type index"
-#~ msgstr "不正確的類型索引"
-
-#~ msgid "unknown TY code"
-#~ msgstr "未知的 TY 代碼"
-
-#~ msgid "undefined variable in TY"
-#~ msgstr "TY 中未定義的變量"
-
-#~ msgid "Pascal file name not supported"
-#~ msgstr "不支援 Pascal 檔案名"
-
-#~ msgid "unsupported qualifier"
-#~ msgstr "不支援的限定符號"
-
-#~ msgid "undefined variable in ATN"
-#~ msgstr "ATN 中未定義的變數"
-
-#~ msgid "unknown ATN type"
-#~ msgstr "未知的 ATN 類型"
-
-#~ msgid "unsupported ATN11"
-#~ msgstr "不支援 ATN11"
-
-#~ msgid "unsupported ATN12"
-#~ msgstr "不支援 ATN12"
-
-#~ msgid "unexpected string in C++ misc"
-#~ msgstr "意外的 C++ 雜項字串"
-
-#~ msgid "bad misc record"
-#~ msgstr "不良的雜項記錄"
-
-#~ msgid "unrecognized C++ misc record"
-#~ msgstr "無法識別的 C++ 雜項紀錄"
-
-#~ msgid "undefined C++ object"
-#~ msgstr "未定義的 C++ 物件"
-
-#~ msgid "unrecognized C++ object spec"
-#~ msgstr "無法識別的 C++ 物件規格"
-
-#~ msgid "unsupported C++ object type"
-#~ msgstr "不支援的 C++ 物件類型"
-
-#~ msgid "C++ base class not defined"
-#~ msgstr "未定義 C++ 基本類別"
-
-#~ msgid "C++ object has no fields"
-#~ msgstr "C++ 物件沒有欄位"
-
-#~ msgid "C++ base class not found in container"
-#~ msgstr "容器中找不到 C++ 基本類別"
-
-#~ msgid "C++ data member not found in container"
-#~ msgstr "容器中找不到 C++ 資料成員"
-
-#~ msgid "unknown C++ visibility"
-#~ msgstr "未知的 C++ 可見度"
-
-#~ msgid "bad C++ field bit pos or size"
-#~ msgstr "不良的 C++ 欄位位元位置或大小"
-
-#~ msgid "bad type for C++ method function"
-#~ msgstr "不良的 C++ 方法函式類型"
-
-#~ msgid "no type information for C++ method function"
-#~ msgstr "對於 C++ 方法函式沒有類型資訊"
-
-#~ msgid "C++ static virtual method"
-#~ msgstr "C++ 靜態虛擬方法"
-
-#~ msgid "unrecognized C++ object overhead spec"
-#~ msgstr "無法識別的 C++ 物件頂層規格"
-
-#~ msgid "undefined C++ vtable"
-#~ msgstr "未定義的 C++ vtable"
-
-#~ msgid "C++ default values not in a function"
-#~ msgstr "C++ 預設值不在函式之中"
-
-#~ msgid "unrecognized C++ default type"
-#~ msgstr "無法識別的 C++ 預設類型"
-
-#~ msgid "reference parameter is not a pointer"
-#~ msgstr "參考參數不是指標"
-
-#~ msgid "unrecognized C++ reference type"
-#~ msgstr "無法識別的 C++ 參考類型"
-
-#~ msgid "C++ reference is not pointer"
-#~ msgstr "C++ 參考不是指標"
-
-#~ msgid "missing required ASN"
-#~ msgstr "遺失必須的 ASN"
-
-#~ msgid "missing required ATN65"
-#~ msgstr "遺失必須的 ATN65"
-
-#~ msgid "bad ATN65 record"
-#~ msgstr "不良的 ATN65 記錄"
-
-#~ msgid "IEEE numeric overflow: 0x"
-#~ msgstr "IEEE 數值溢出:0x"
-
-#~ msgid "IEEE string length overflow: %u\n"
-#~ msgstr "IEEE 字串長度溢出:%u\n"
-
-#~ msgid "IEEE unsupported float type size %u\n"
-#~ msgstr "IEEE 不支援的浮點類型大小 %u\n"
-
-#~ msgid "input file named both on command line and with INPUT"
-#~ msgstr "同時在命令列和 INPUT 中輸入檔案名稱"
-
-#~ msgid "no input file"
-#~ msgstr "沒有輸入檔案"
-
-#~ msgid "no name for output file"
-#~ msgstr "輸出檔案沒有名稱"
-
-#~ msgid "warning: input and output formats are not compatible"
-#~ msgstr "警告:輸入和輸出格式不相容"
-
-#~ msgid "make .bss section"
-#~ msgstr "產生 .bss 區段"
-
-#~ msgid "make .nlmsections section"
-#~ msgstr "產生 .nlmsections 區段"
-
-#~ msgid "set .bss vma"
-#~ msgstr "設定 .bss vma"
-
-#~ msgid "set .data size"
-#~ msgstr "設定 .data 的大小"
-
-#~ msgid "warning: symbol %s imported but not in import list"
-#~ msgstr "警告:導入的符號 %s 不在導入列表中"
-
-#~ msgid "set start address"
-#~ msgstr "設定起始位址"
-
-#~ msgid "warning: START procedure %s not defined"
-#~ msgstr "警告:未定義 START 子程序 %s"
-
-#~ msgid "warning: EXIT procedure %s not defined"
-#~ msgstr "警告:未定義 EXIT 子程序 %s"
-
-#~ msgid "warning: CHECK procedure %s not defined"
-#~ msgstr "警告:未定義 CHECK 子程序 %s"
-
-#~ msgid "custom section"
-#~ msgstr "自訂區段"
-
-#~ msgid "help section"
-#~ msgstr "輔助區段"
-
-#~ msgid "message section"
-#~ msgstr "訊息區段"
-
-#~ msgid "module section"
-#~ msgstr "模組區段"
-
-#~ msgid "rpc section"
-#~ msgstr "rpc 區段"
-
-#~ msgid "%s: warning: shared libraries can not have uninitialized data"
-#~ msgstr "%s:警告:共享函式庫不能含有未初始化的資料"
-
-#~ msgid "shared section"
-#~ msgstr "共享區段"
-
-#~ msgid "warning: No version number given"
-#~ msgstr "警告:未指定版本號"
-
-#~ msgid "%s: read: %s"
-#~ msgstr "%s:讀取:%s"
-
-#~ msgid "warning: FULLMAP is not supported; try ld -M"
-#~ msgstr "警告:不支援 FULLMAP;請試用 ld -M"
-
-#~ msgid "Usage: %s [option(s)] [in-file [out-file]]\n"
-#~ msgstr "用法:%s [選項] [輸入檔案 [輸出檔案]]\n"
-
-#~ msgid " Convert an object file into a NetWare Loadable Module\n"
-#~ msgstr " 將物件檔案轉換為 NetWare 可載入模組\n"
-
-#, fuzzy
-#~ msgid ""
-#~ " The options are:\n"
-#~ " -I --input-target=<bfdname> Set the input binary file format\n"
-#~ " -O --output-target=<bfdname> Set the output binary file format\n"
-#~ " -T --header-file=<file> Read <file> for NLM header information\n"
-#~ " -l --linker=<linker> Use <linker> for any linking\n"
-#~ " -d --debug Display on stderr the linker command line\n"
-#~ " @<file> Read options from <file>.\n"
-#~ " -h --help Display this information\n"
-#~ " -v --version Display the program's version\n"
-#~ msgstr ""
-#~ " 選項是:\n"
-#~ " -I --input-target=<bfdname> 設定輸入二進位檔案格式\n"
-#~ " -O --output-target=<bfdname> 設定輸出二進位檔案格式\n"
-#~ " -T --header-file=<file> 讀取 <file> 用於 NLM 頁首資訊\n"
-#~ " -l --linker=<linker> 使用 <linker> 用於任何鏈結\n"
-#~ " -d --debug 顯示於標準勘誤鏈結器命令列\n"
-#~ " @<file> 讀取選項從 <file>。\n"
-#~ " -h --help 顯示這個資訊\n"
-#~ " -v --version 顯示程式版本\n"
-
-#~ msgid "support not compiled in for %s"
-#~ msgstr "未將對於 %s 的支援編譯進去"
-
-#~ msgid "make section"
-#~ msgstr "製作區段"
-
-#~ msgid "set section size"
-#~ msgstr "設定區段大小"
-
-#~ msgid "set section alignment"
-#~ msgstr "設定區段對齊"
-
-#~ msgid "set section flags"
-#~ msgstr "設定區段旗標"
-
-#~ msgid "set .nlmsections size"
-#~ msgstr "設定 .nlmsections 大小"
-
-#~ msgid "set .nlmsection contents"
-#~ msgstr "設定 .nlmsection 內容"
-
-#~ msgid "writing stub"
-#~ msgstr "正在寫入佔位區段"
-
-#~ msgid "unresolved PC relative reloc against %s"
-#~ msgstr "無法解析的以 %s 為準之 PC 相對重定位"
-
-#~ msgid "overflow when adjusting relocation against %s"
-#~ msgstr "以 %s 為準對齊重定位時發生溢出"
-
-#~ msgid "%s: execution of %s failed: "
-#~ msgstr "%s:執行 %s 失敗:"
-
-#~ msgid "Execution of %s failed"
-#~ msgstr "執行 %s 失敗"
-
-#~ msgid "data size %ld"
-#~ msgstr "資料大小 %ld"
-
-#~ msgid "Idx Name Size VMA LMA File off Algn"
-#~ msgstr "索引名稱 大小 VMA LMA 檔案關閉 對齊"
-
-#~ msgid "Idx Name Size VMA LMA File off Algn"
-#~ msgstr "索引名稱 大小 VMA LMA 檔案關閉 對齊"
-
-#, fuzzy
-#~ msgid "<no-name>"
-#~ msgstr "<no-name>"
-
-#, fuzzy
-#~ msgid "<unknown: %lx>"
-#~ msgstr "<unknown: %lx>"
-
-#~ msgid "File contains multiple symtab shndx tables\n"
-#~ msgstr "檔案含有多個符號分頁索引表\n"
-
-#~ msgid "'%s'"
-#~ msgstr "「%s」"
-
-#, fuzzy
-#~ msgid "Unable to seek to end of file!\n"
-#~ msgstr "無法尋指到檔案結尾!\n"
-
-#~ msgid "Unable to seek to end of file\n"
-#~ msgstr "無法搜索到檔案末尾\n"
-
-#, fuzzy
-#~ msgid "| <unknown>"
-#~ msgstr "|<unknown>"
-
-#, fuzzy
-#~ msgid "Any\n"
-#~ msgstr "任何\n"
-
-#~ msgid "No mangling for \"%s\"\n"
-#~ msgstr "\"%s\" 沒有損壞\n"
return TRUE;
}
+#if HAVE_LIBDEBUGINFOD
+/* Return a hex string representation of the build-id. */
+unsigned char *
+get_build_id (void * data)
+{
+ Filedata * filedata = (Filedata *)data;
+ Elf_Internal_Shdr * shdr;
+ unsigned long i;
+
+ /* Iterate through notes to find note.gnu.build-id. */
+ for (i = 0, shdr = filedata->section_headers;
+ i < filedata->file_header.e_shnum && shdr != NULL;
+ i++, shdr++)
+ {
+ if (shdr->sh_type != SHT_NOTE)
+ continue;
+
+ char * next;
+ char * end;
+ size_t data_remaining;
+ size_t min_notesz;
+ Elf_External_Note * enote;
+ Elf_Internal_Note inote;
+
+ bfd_vma offset = shdr->sh_offset;
+ bfd_vma align = shdr->sh_addralign;
+ bfd_vma length = shdr->sh_size;
+
+ enote = (Elf_External_Note *) get_section_contents (shdr, filedata);
+ if (enote == NULL)
+ continue;
+
+ if (align < 4)
+ align = 4;
+ else if (align != 4 && align != 8)
+ continue;
+
+ end = (char *) enote + length;
+ data_remaining = end - (char *) enote;
+
+ if (!is_ia64_vms (filedata))
+ {
+ min_notesz = offsetof (Elf_External_Note, name);
+ if (data_remaining < min_notesz)
+ {
+ warn (ngettext ("debuginfod: Corrupt note: only %ld byte remains, "
+ "not enough for a full note\n",
+ "Corrupt note: only %ld bytes remain, "
+ "not enough for a full note\n",
+ data_remaining),
+ (long) data_remaining);
+ break;
+ }
+ data_remaining -= min_notesz;
+
+ inote.type = BYTE_GET (enote->type);
+ inote.namesz = BYTE_GET (enote->namesz);
+ inote.namedata = enote->name;
+ inote.descsz = BYTE_GET (enote->descsz);
+ inote.descdata = ((char *) enote
+ + ELF_NOTE_DESC_OFFSET (inote.namesz, align));
+ inote.descpos = offset + (inote.descdata - (char *) enote);
+ next = ((char *) enote
+ + ELF_NOTE_NEXT_OFFSET (inote.namesz, inote.descsz, align));
+ }
+ else
+ {
+ Elf64_External_VMS_Note *vms_enote;
+
+ /* PR binutils/15191
+ Make sure that there is enough data to read. */
+ min_notesz = offsetof (Elf64_External_VMS_Note, name);
+ if (data_remaining < min_notesz)
+ {
+ warn (ngettext ("debuginfod: Corrupt note: only %ld byte remains, "
+ "not enough for a full note\n",
+ "Corrupt note: only %ld bytes remain, "
+ "not enough for a full note\n",
+ data_remaining),
+ (long) data_remaining);
+ break;
+ }
+ data_remaining -= min_notesz;
+
+ vms_enote = (Elf64_External_VMS_Note *) enote;
+ inote.type = BYTE_GET (vms_enote->type);
+ inote.namesz = BYTE_GET (vms_enote->namesz);
+ inote.namedata = vms_enote->name;
+ inote.descsz = BYTE_GET (vms_enote->descsz);
+ inote.descdata = inote.namedata + align_power (inote.namesz, 3);
+ inote.descpos = offset + (inote.descdata - (char *) enote);
+ next = inote.descdata + align_power (inote.descsz, 3);
+ }
+
+ /* Skip malformed notes. */
+ if ((size_t) (inote.descdata - inote.namedata) < inote.namesz
+ || (size_t) (inote.descdata - inote.namedata) > data_remaining
+ || (size_t) (next - inote.descdata) < inote.descsz
+ || ((size_t) (next - inote.descdata)
+ > data_remaining - (size_t) (inote.descdata - inote.namedata)))
+ {
+ warn (_("debuginfod: note with invalid namesz and/or descsz found\n"));
+ warn (_(" type: 0x%lx, namesize: 0x%08lx, descsize: 0x%08lx, alignment: %u\n"),
+ inote.type, inote.namesz, inote.descsz, (int) align);
+ continue;
+ }
+
+ /* Check if this is the build-id note. If so then convert the build-id
+ bytes to a hex string. */
+ if (inote.namesz > 0
+ && const_strneq (inote.namedata, "GNU")
+ && inote.type == NT_GNU_BUILD_ID)
+ {
+ unsigned long j;
+ char * build_id;
+
+ build_id = malloc (inote.descsz * 2 + 1);
+ if (build_id == NULL)
+ return NULL;
+
+ for (j = 0; j < inote.descsz; ++j)
+ sprintf (build_id + (j * 2), "%02x", inote.descdata[j] & 0xff);
+ build_id[inote.descsz * 2] = '\0';
+
+ return (unsigned char *)build_id;
+ }
+ }
+
+ return NULL;
+}
+#endif /* HAVE_LIBDEBUGINFOD */
+
/* If this is not NULL, load_debug_section will only look for sections
within the list of sections given here. */
static unsigned int * section_subset = NULL;
/* This is the separate debug info file. */
-/* Create a .debug_abbrev section for use by the .debug_info section
+/* Create .note.gnu.build-id note for use by the .gnu_debugaltlink
in the main object file. */
-
+
+ .section .note.gnu.build-id,"a",%note
+ .balign 4
+ .dc.l 0x04 ;# Name size
+ .dc.l 0x18 ;# Description size
+ .dc.l 0x03 ;# Type
+ .asciz "GNU" ;# Name
+ .dc.b 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
+ .dc.b 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
+ .dc.b 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef
+
+ /* Create a .debug_abbrev section for use by the .debug_info section
+ in the main object file. */
+
.section .debug_abbrev,"",%progbits
abbrevs:
.uleb128 0x01 ;# Abbrev code.
--- /dev/null
+dnl Copyright (C) 1997-2019 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([AC_DEBUGINFOD],
+[
+# Enable debuginfod
+AC_ARG_WITH([debuginfod],
+ AC_HELP_STRING([--with-debuginfod],
+ [Enable debuginfo lookups with debuginfod (auto/yes/no)]),
+ [], [with_debuginfod=auto])
+AC_MSG_CHECKING([whether to use debuginfod])
+AC_MSG_RESULT([$with_debuginfod])
+
+if test "${with_debuginfod}" = no; then
+ AC_MSG_WARN([debuginfod support disabled; some features may be unavailable.])
+else
+ AC_CHECK_LIB([debuginfod], [debuginfod_begin], [have_debuginfod_lib=yes])
+ AC_CHECK_DECL([debuginfod_begin], [have_debuginfod_h=yes], [],
+ [#include <elfutils/debuginfod.h>])
+ if test "x$have_debuginfod_lib" = "xyes" -a \
+ "x$have_debuginfod_h" = "xyes"; then
+ AC_DEFINE([HAVE_LIBDEBUGINFOD], [1],
+ [Define to 1 if debuginfod is enabled.])
+ AC_SUBST([LIBDEBUGINFOD], ["-ldebuginfod"])
+ else
+ AC_SUBST([LIBDEBUGINFOD], [])
+ if test "$with_debuginfod" = yes; then
+ AC_MSG_ERROR([debuginfod is missing or unusable])
+ else
+ AC_MSG_WARN([debuginfod is missing or unusable; some features may be unavailable.])
+ fi
+ fi
+fi
+])
extra_mpfr_configure_flags
gmpinc
gmplibs
+LIBDEBUGINFOD
do_compare
GNATMAKE
GNATBIND
enable_libstdcxx
enable_liboffloadmic
enable_bootstrap
+with_debuginfod
with_mpc
with_mpc_include
with_mpc_lib
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-build-libsubdir=DIR Directory where to find libraries for build system
--with-system-zlib use installed libz
+ --with-debuginfod Enable debuginfo lookups with debuginfod
+ (auto/yes/no)
--with-mpc=PATH specify prefix directory for installed MPC package.
Equivalent to --with-mpc-include=PATH/include plus
--with-mpc-lib=PATH/lib
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
gmpinc=
have_gmp=no
+# Check for debuginfod
+
+
+# Enable debuginfod
+
+# Check whether --with-debuginfod was given.
+if test "${with_debuginfod+set}" = set; then :
+ withval=$with_debuginfod;
+else
+ with_debuginfod=auto
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use debuginfod" >&5
+$as_echo_n "checking whether to use debuginfod... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_debuginfod" >&5
+$as_echo "$with_debuginfod" >&6; }
+
+if test "${with_debuginfod}" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod support disabled; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: debuginfod support disabled; some features may be unavailable." >&2;}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for debuginfod_begin in -ldebuginfod" >&5
+$as_echo_n "checking for debuginfod_begin in -ldebuginfod... " >&6; }
+if ${ac_cv_lib_debuginfod_debuginfod_begin+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldebuginfod $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char debuginfod_begin ();
+int
+main ()
+{
+return debuginfod_begin ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_debuginfod_debuginfod_begin=yes
+else
+ ac_cv_lib_debuginfod_debuginfod_begin=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_debuginfod_debuginfod_begin" >&5
+$as_echo "$ac_cv_lib_debuginfod_debuginfod_begin" >&6; }
+if test "x$ac_cv_lib_debuginfod_debuginfod_begin" = xyes; then :
+ have_debuginfod_lib=yes
+fi
+
+ ac_fn_c_check_decl "$LINENO" "debuginfod_begin" "ac_cv_have_decl_debuginfod_begin" "#include <elfutils/debuginfod.h>
+"
+if test "x$ac_cv_have_decl_debuginfod_begin" = xyes; then :
+ have_debuginfod_h=yes
+fi
+
+ if test "x$have_debuginfod_lib" = "xyes" -a \
+ "x$have_debuginfod_h" = "xyes"; then
+
+$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
+
+ LIBDEBUGINFOD="-ldebuginfod"
+
+ else
+
+ if test "$with_debuginfod" = yes; then
+ as_fn_error $? "debuginfod is missing or unusable" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&2;}
+ fi
+ fi
+fi
+
+
# Specify a location for mpc
# check for this first so it ends up on the link line before mpfr.
# Check for the recommended and required versions of GMP.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of gmp.h" >&5
$as_echo_n "checking for the correct version of gmp.h... " >&6; }
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "gmp.h"
int
m4_include(config/override.m4)
m4_include(config/proginstall.m4)
m4_include(config/elf.m4)
+m4_include(config/debuginfod.m4)
m4_include([libtool.m4])
m4_include([ltoptions.m4])
m4_include([ltsugar.m4])
gmpinc=
have_gmp=no
+# Check for debuginfod
+AC_DEBUGINFOD
+
# Specify a location for mpc
# check for this first so it ends up on the link line before mpfr.
AC_ARG_WITH(mpc,
+2020-01-10 Alan Modra <amodra@gmail.com>
+
+ * testsuite/gas/elf/pr14891.s: Don't start directives in first column.
+ * testsuite/gas/elf/pr21661.d: Don't run on hpux.
+
+2020-01-03 Sergey Belyashov <sergey.belyashov@gmail.com>
+
+ PR 25224
+ * config/tc-z80.c (emit_ld_m_rr): Use integer types when checking
+ opcode byte values.
+ (emit_ld_r_r): Likewise.
+ (emit_ld_rr_m): Likewise.
+ (emit_ld_rr_nn): Likewise.
+
+2020-01-09 Jan Beulich <jbeulich@suse.com>
+
+ * config/tc-i386.c (optimize_encoding): Add
+ is_any_vex_encoding() invocations. Drop respective
+ i.tm.extension_opcode == None checks.
+
+2020-01-09 Jan Beulich <jbeulich@suse.com>
+
+ * config/tc-i386.c (md_assemble): Check RegRex is clear during
+ REX transformations. Correct comment indentation.
+
+2020-01-09 Jan Beulich <jbeulich@suse.com>
+
+ * config/tc-i386.c (optimize_encoding): Generalize register
+ transformation for TEST optimization.
+
+2020-01-09 Jan Beulich <jbeulich@suse.com>
+
+ * testsuite/gas/i386/x86-64-sysenter-amd.s,
+ testsuite/gas/i386/x86-64-sysenter-amd.d,
+ testsuite/gas/i386/x86-64-sysenter-amd.l,
+ testsuite/gas/i386/x86-64-sysenter-intel.d,
+ testsuite/gas/i386/x86-64-sysenter-mixed.d: New.
+ * testsuite/gas/i386/i386.exp: Run new tests.
+
2020-01-08 Nick Clifton <nickc@redhat.com>
PR 25284
unsigned int j;
if (optimize_for_space
+ && !is_any_vex_encoding (&i.tm)
&& i.reg_operands == 1
&& i.imm_operands == 1
&& !i.types[1].bitfield.byte
&& i.op[0].imms->X_op == O_constant
&& fits_in_imm7 (i.op[0].imms->X_add_number)
- && ((i.tm.base_opcode == 0xa8
- && i.tm.extension_opcode == None)
+ && (i.tm.base_opcode == 0xa8
|| (i.tm.base_opcode == 0xf6
&& i.tm.extension_opcode == 0x0)))
{
i.types[1].bitfield.byte = 1;
/* Ignore the suffix. */
i.suffix = 0;
- if (base_regnum >= 4)
- {
- /* Handle SP, BP, SI, DI and R12-R15 registers. */
- if (i.types[1].bitfield.word)
- j = 16;
- else if (i.types[1].bitfield.dword)
- j = 32;
- else
- j = 48;
- i.op[1].regs -= j;
- }
+ /* Convert to byte registers. */
+ if (i.types[1].bitfield.word)
+ j = 16;
+ else if (i.types[1].bitfield.dword)
+ j = 32;
+ else
+ j = 48;
+ if (!(i.op[1].regs->reg_flags & RegRex) && base_regnum < 4)
+ j += 8;
+ i.op[1].regs -= j;
}
}
else if (flag_code == CODE_64BIT
+ && !is_any_vex_encoding (&i.tm)
&& ((i.types[1].bitfield.qword
&& i.reg_operands == 1
&& i.imm_operands == 1
&& i.tm.extension_opcode == None
&& fits_in_unsigned_long (i.op[0].imms->X_add_number))
|| (fits_in_imm31 (i.op[0].imms->X_add_number)
- && (((i.tm.base_opcode == 0x24
- || i.tm.base_opcode == 0xa8)
- && i.tm.extension_opcode == None)
+ && ((i.tm.base_opcode == 0x24
+ || i.tm.base_opcode == 0xa8)
|| (i.tm.base_opcode == 0x80
&& i.tm.extension_opcode == 0x4)
|| ((i.tm.base_opcode == 0xf6
|| (i.types[0].bitfield.qword
&& ((i.reg_operands == 2
&& i.op[0].regs == i.op[1].regs
- && ((i.tm.base_opcode == 0x30
- || i.tm.base_opcode == 0x28)
- && i.tm.extension_opcode == None))
+ && (i.tm.base_opcode == 0x30
+ || i.tm.base_opcode == 0x28))
|| (i.reg_operands == 1
&& i.operands == 1
- && i.tm.base_opcode == 0x30
- && i.tm.extension_opcode == None)))))
+ && i.tm.base_opcode == 0x30)))))
{
/* Optimize: -O:
andq $imm31, %r64 -> andl $imm31, %r32
}
else if (optimize > 1
&& !optimize_for_space
+ && !is_any_vex_encoding (&i.tm)
&& i.reg_operands == 2
&& i.op[0].regs == i.op[1].regs
&& ((i.tm.base_opcode & ~(Opcode_D | 1)) == 0x8
if (i.types[x].bitfield.class == Reg && i.types[x].bitfield.byte
&& (i.op[x].regs->reg_flags & RegRex64) == 0)
{
+ gas_assert (!(i.op[x].regs->reg_flags & RegRex));
/* In case it is "hi" register, give up. */
if (i.op[x].regs->reg_num > 3)
as_bad (_("can't encode register '%s%s' in an "
if (i.rex == 0 && i.rex_encoding)
{
/* Check if we can add a REX_OPCODE byte. Look for 8 bit operand
- that uses legacy register. If it is "hi" register, don't add
+ that uses legacy register. If it is "hi" register, don't add
the REX_OPCODE byte. */
int x;
for (x = 0; x < 2; x++)
&& (i.op[x].regs->reg_flags & RegRex64) == 0
&& i.op[x].regs->reg_num > 3)
{
+ gas_assert (!(i.op[x].regs->reg_flags & RegRex));
i.rex_encoding = FALSE;
break;
}
static str_to_float_t
get_str_to_float (const char *arg)
{
- if (strcasecmp(arg, "zeda32") == 0)
+ if (strcasecmp (arg, "zeda32") == 0)
return str_to_zeda32;
- if (strcasecmp(arg, "math48") == 0)
+ if (strcasecmp (arg, "math48") == 0)
return str_to_float48;
- if (strcasecmp(arg, "ieee754") != 0)
+ if (strcasecmp (arg, "ieee754") != 0)
as_fatal (_("invalid floating point numbers type `%s'"), arg);
return NULL;
}
break;
case OPTION_MACH_INST:
if ((ins_ok & INS_GBZ80) == 0)
- return setup_instruction_list(arg, & ins_ok, & ins_err);
+ return setup_instruction_list (arg, & ins_ok, & ins_err);
break;
case OPTION_MACH_NO_INST:
if ((ins_ok & INS_GBZ80) == 0)
- return setup_instruction_list(arg, & ins_err, & ins_ok);
+ return setup_instruction_list (arg, & ins_err, & ins_ok);
break;
case OPTION_MACH_WUD:
case OPTION_MACH_IUD:
{
for ( k = 0 ; regtable[i].name[k] ; ++k )
{
- buf[k] = ( j & ( 1<<k ) ) ? TOUPPER ( regtable[i].name[k] ) : regtable[i].name[k];
+ buf[k] = ( j & ( 1<<k ) ) ? TOUPPER (regtable[i].name[k]) : regtable[i].name[k];
}
- symbolS * psym = symbol_find_or_make(buf);
- S_SET_SEGMENT(psym, reg_section);
- symbol_set_value_expression(psym, ®);
+ symbolS * psym = symbol_find_or_make (buf);
+ S_SET_SEGMENT (psym, reg_section);
+ symbol_set_value_expression (psym, ®);
}
}
}
c = get_symbol_name (&name);
rest = input_line_pointer + 1;
- if (ISSPACE(c) && colonless_labels)
+ if (ISSPACE (c) && colonless_labels)
{
if (c == '\n')
{
len = 4;
else
len = 0;
- if (len && (!ISALPHA(rest[len]) ) )
+ if (len && (!ISALPHA (rest[len])))
{
/* Handle assignment here. */
if (line_start[-1] == '\n')
wrong_mach (int ins_type)
{
if (ins_type & ins_err)
- ill_op();
+ ill_op ();
else
as_warn (_("undocumented instruction"));
}
/* Check whether a symbol involves a register. */
static int
-contains_register(symbolS *sym)
+contains_register (symbolS *sym)
{
if (sym)
- {
- expressionS * ex = symbol_get_value_expression(sym);
- return (O_register == ex->X_op)
- || (ex->X_add_symbol && contains_register(ex->X_add_symbol))
- || (ex->X_op_symbol && contains_register(ex->X_op_symbol));
- }
- else
- return 0;
+ {
+ expressionS * ex = symbol_get_value_expression(sym);
+
+ return (O_register == ex->X_op)
+ || (ex->X_add_symbol && contains_register(ex->X_add_symbol))
+ || (ex->X_op_symbol && contains_register(ex->X_op_symbol));
+ }
+
+ return 0;
}
/* Parse general expression, not looking for indexed addressing. */
static int
unify_indexed (expressionS *op)
{
- if (O_register != symbol_get_value_expression(op->X_add_symbol)->X_op)
+ if (O_register != symbol_get_value_expression (op->X_add_symbol)->X_op)
return 0;
- int rnum = symbol_get_value_expression(op->X_add_symbol)->X_add_number;
- if ( ((REG_IX != rnum) && (REG_IY != rnum)) || contains_register(op->X_op_symbol) )
+ int rnum = symbol_get_value_expression (op->X_add_symbol)->X_add_number;
+ if ( ((REG_IX != rnum) && (REG_IY != rnum)) || contains_register (op->X_op_symbol))
{
- ill_op();
+ ill_op ();
return 0;
}
- /* convert subtraction to addition of negative value */
+ /* Convert subtraction to addition of negative value. */
if (O_subtract == op->X_op)
{
expressionS minus;
minus.X_add_number = 0;
minus.X_add_symbol = op->X_op_symbol;
minus.X_op_symbol = 0;
- op->X_op_symbol = make_expr_symbol(&minus);
+ op->X_op_symbol = make_expr_symbol (&minus);
op->X_op = O_add;
}
- /* clear X_add_number of the expression */
+
+ /* Clear X_add_number of the expression. */
if (op->X_add_number != 0)
{
expressionS add;
add.X_add_number = op->X_add_number;
add.X_add_symbol = op->X_op_symbol;
add.X_op_symbol = 0;
- op->X_add_symbol = make_expr_symbol(&add);
+ op->X_add_symbol = make_expr_symbol (&add);
}
else
op->X_add_symbol = op->X_op_symbol;
return 1;
}
-/* Parse expression, change operator to O_md1 for indexed addressing*/
+/* Parse expression, change operator to O_md1 for indexed addressing. */
static const char *
parse_exp (const char *s, expressionS *op)
{
{
case O_add:
case O_subtract:
- if (unify_indexed(op) && op->X_md)
+ if (unify_indexed (op) && op->X_md)
op->X_op = O_md1;
break;
case O_register:
- if ( op->X_md && ((REG_IX == op->X_add_number)||(REG_IY == op->X_add_number)) )
+ if (op->X_md && ((REG_IX == op->X_add_number) || (REG_IY == op->X_add_number)))
{
op->X_add_symbol = zero;
op->X_op = O_md1;
if ( (val->X_op == O_register)
|| (val->X_op == O_md1)
- || contains_register(val->X_add_symbol)
- || contains_register(val->X_op_symbol) )
+ || contains_register (val->X_add_symbol)
+ || contains_register (val->X_op_symbol))
ill_op ();
if (size <= 2 && val->X_op_symbol)
{
bfd_boolean simplify = TRUE;
- int shift = symbol_get_value_expression(val->X_op_symbol)->X_add_number;
+ int shift = symbol_get_value_expression (val->X_op_symbol)->X_add_number;
if (val->X_op == O_bit_and && shift == (1 << (size*8))-1)
shift = 0;
else if (val->X_op != O_right_shift)
}
p = frag_more (1);
*p = val->X_add_number;
- if ( contains_register(val->X_add_symbol) || contains_register(val->X_op_symbol) )
+ if ( contains_register (val->X_add_symbol) || contains_register (val->X_op_symbol) )
{
- ill_op();
+ ill_op ();
}
else if ((r_type == BFD_RELOC_8_PCREL) && (val->X_op == O_constant))
{
if (*p == ',' && arg_s.X_md == 0 && arg_s.X_op == O_register && arg_s.X_add_number == REG_A)
{ /* possible instruction in generic format op A,x */
if (!(ins_ok & INS_EZ80) && !sdcc_compat)
- ill_op();
+ ill_op ();
++p;
p = parse_exp (p, & arg_s);
}
return p;
}
+/* For 8-bit indirect load to memory instructions like: LD (HL),n or LD (ii+d),n. */
static void
-emit_ld_m_n(expressionS *dst, expressionS *src)
-{ /* for 8-bit indirect load to memory instructions like: LD (HL),n or LD (ii+d),n */
+emit_ld_m_n (expressionS *dst, expressionS *src)
+{
char *q;
char prefix;
expressionS dst_offset;
emit_byte (src, BFD_RELOC_8);
}
+/* For 8-bit load register to memory instructions: LD (<expression>),r. */
static void
-emit_ld_m_r(expressionS *dst, expressionS *src)
-{ /* for 8-bit load register to memory instructions: LD (<expression>),r */
+emit_ld_m_r (expressionS *dst, expressionS *src)
+{
char *q;
char prefix = 0;
expressionS dst_offset;
ill_op ();
}
+/* For 16-bit load register to memory instructions: LD (<expression>),rr. */
static void
-emit_ld_m_rr(expressionS *dst, expressionS *src)
-{ /* for 16-bit load register to memory instructions: LD (<expression>),rr */
+emit_ld_m_rr (expressionS *dst, expressionS *src)
+{
char *q;
- char prefix = 0;
- char opcode = 0;
+ int prefix = 0;
+ int opcode = 0;
expressionS dst_offset;
switch (dst->X_op)
case REG_BC: opcode = 0x0F; break;
case REG_DE: opcode = 0x1F; break;
case REG_HL: opcode = 0x2F; break;
- case REG_IX: opcode = (prefix != '\xfd') ? 0x3F : 0x3E; break;
- case REG_IY: opcode = (prefix != '\xfd') ? 0x3E : 0x3F; break;
+ case REG_IX: opcode = (prefix != 0xFD) ? 0x3F : 0x3E; break;
+ case REG_IY: opcode = (prefix != 0xFD) ? 0x3E : 0x3F; break;
default:
ill_op ();
}
q = frag_more (prefix ? 2 : 1);
*q++ = prefix;
*q = opcode;
- if (prefix == '\xfd' || prefix == '\xdd')
+ if (prefix == 0xFD || prefix == 0xDD)
{
dst_offset = *dst;
dst_offset.X_op = O_symbol;
{ /* mostly 8-bit load register from register instructions: LD r,r */
/* there are some exceptions: LD SP,HL/IX/IY; LD I,HL and LD HL,I */
char *q;
- char prefix = 0;
- char opcode = 0;
+ int prefix = 0;
+ int opcode = 0;
int ii_halves = 0;
switch (dst->X_add_number)
break;
case REG_H|R_IX:
case REG_L|R_IX:
- if (prefix == '\xfd' || dst->X_add_number == REG_H || dst->X_add_number == REG_L)
+ if (prefix == 0xFD || dst->X_add_number == REG_H || dst->X_add_number == REG_L)
ill_op (); /* LD IYL,IXL and LD H,IXH are not permitted */
prefix = 0xDD;
ii_halves = 1;
break;
case REG_H|R_IY:
case REG_L|R_IY:
- if (prefix == '\xdd' || dst->X_add_number == REG_H || dst->X_add_number == REG_L)
+ if (prefix == 0xDD || dst->X_add_number == REG_H || dst->X_add_number == REG_L)
ill_op (); /* LD IXH,IYH and LD L,IYL are not permitted */
prefix = 0xFD;
ii_halves = 1;
case 0x49: /* LIS prefix, in Z80 it is LD C,C */
case 0x52: /* SIL prefix, in Z80 it is LD D,D */
case 0x5B: /* LIL prefix, in Z80 it is LD E,E */
- as_warn(_("unsupported instruction, assembled as NOP"));
+ as_warn (_("unsupported instruction, assembled as NOP"));
opcode = 0x00;
break;
default:;
emit_ld_rr_m (expressionS *dst, expressionS *src)
{ /* for 16-bit indirect load from memory to register: LD rr,(xxx) */
char *q;
- char prefix = 0;
- char opcode = 0;
+ int prefix = 0;
+ int opcode = 0;
expressionS src_offset;
/* GBZ80 has no support for 16-bit load from memory instructions */
case REG_BC: opcode = 0x07; break;
case REG_DE: opcode = 0x17; break;
case REG_HL: opcode = 0x27; break;
- case REG_IX: opcode = (!prefix || prefix == '\xdd') ? 0x37 : 0x31; break;
- case REG_IY: opcode = prefix ? ((prefix == '\xdd') ? 0x31 : 0x37) : 0x36; break;
+ case REG_IX: opcode = (!prefix || prefix == 0xDD) ? 0x37 : 0x31; break;
+ case REG_IY: opcode = prefix ? ((prefix == 0xDD) ? 0x31 : 0x37) : 0x36; break;
default:
ill_op ();
}
q = frag_more (2);
*q++ = prefix;
*q = opcode;
- if (prefix != '\xed')
+ if (prefix != 0xED)
{
src_offset = *src;
src_offset.X_op = O_symbol;
emit_ld_rr_nn (expressionS *dst, expressionS *src)
{ /* mostly load imediate value to multibyte register instructions: LD rr,nn */
char *q;
- char prefix = 0x00;
- char opcode = 0x21; /* LD HL,nn */
+ int prefix = 0x00;
+ int opcode = 0x21; /* LD HL,nn */
switch (dst->X_add_number)
{
case REG_IX:
char *q;
if (!(ins_ok & INS_GBZ80))
- return emit_insn(prefix, opcode, args);
+ return emit_insn (prefix, opcode, args);
p = parse_exp (args, & dst);
if (*p++ != ',')
*q = 0xE2;
}
else
- ill_op();
+ ill_op ();
}
else
{
switch (rnum)
{
case REG_IX:
- opcode = (opcode == 0x33) ? 0x55 : (opcode|0x00);
+ opcode = (opcode == (char)0x33) ? 0x55 : (opcode|0x00);
break;
case REG_IY:
- opcode = (opcode == 0x32) ? 0x54 : (opcode|0x01);
+ opcode = (opcode == (char)0x32) ? 0x54 : (opcode|0x01);
}
q = frag_more (2);
/* PEA ii without displacement is mostly typo,
because there is PUSH instruction which is shorter and faster */
/*if (arg.X_op == O_register)
- as_warn(_("PEA is used without displacement, use PUSH instead"));*/
+ as_warn (_("PEA is used without displacement, use PUSH instead"));*/
q = frag_more (2);
*q++ = prefix;
emit_reti (char prefix, char opcode, const char * args)
{
if (ins_ok & INS_GBZ80)
- return emit_insn(0x00, 0xD9, args);
+ return emit_insn (0x00, 0xD9, args);
- return emit_insn(prefix, opcode, args);
+ return emit_insn (prefix, opcode, args);
}
static const char *
if (*p == ',' && arg_s.X_md == 0 && arg_s.X_op == O_register && arg_s.X_add_number == REG_A)
{
if (!(ins_ok & INS_EZ80))
- ill_op();
+ ill_op ();
++p;
p = parse_exp (p, & arg_s);
}
q = frag_more (2);
*q++ = prefix;
*q = opcode;
- emit_byte(& arg, BFD_RELOC_8);
+ emit_byte (& arg, BFD_RELOC_8);
return p;
}
input_line_pointer = (char*)skip_space (input_line_pointer);
c = get_symbol_name (& name);
- if (strncasecmp(name, "ADL", 4) != 0)
+ if (strncasecmp (name, "ADL", 4) != 0)
{
ill_op ();
return;
for (i = 0; (i < 3) && (ISALPHA (*p)); i++)
sbuf[i] = TOLOWER (*p++);
- if (*p && !ISSPACE(*p))
+ if (*p && !ISSPACE (*p))
return 0;
*suffix = p;
sbuf[i] = 0;
- t = bsearch(sbuf, sf, ARRAY_SIZE (sf), sizeof(sf[0]), (int(*)(const void*, const void*))strcmp);
+ t = bsearch (sbuf, sf, ARRAY_SIZE (sf), sizeof (sf[0]), (int(*)(const void*, const void*)) strcmp);
if (t == NULL)
return 0;
i = t - sf;
i = 0x40;
break;
}
- *frag_more(1) = (char)i;
+ *frag_more (1) = (char)i;
switch (i)
{
case 0x40: inst_mode = INST_MODE_FORCED | INST_MODE_S | INST_MODE_IS; break;
{
if ((*p) && (!ISSPACE (*p)))
{
- if (*p != '.' || !(ins_ok & INS_EZ80) || !assemble_suffix(&p))
+ if (*p != '.' || !(ins_ok & INS_EZ80) || !assemble_suffix (&p))
{
as_bad (_("syntax error"));
goto end;
if (!insp || (insp->inss && !(insp->inss & ins_ok)))
{
as_bad (_("Unknown instruction '%s'"), buf);
- *frag_more(1) = 0;
+ *frag_more (1) = 0;
}
else
{
*signP = sign;
if (sign || *p == '+')
++p;
- if (strncasecmp(p, "NaN", 3) == 0)
+ if (strncasecmp (p, "NaN", 3) == 0)
{
*mantissaP = 0;
*expP = 0;
input_line_pointer = p + 3;
return 1;
}
- if (strncasecmp(p, "inf", 3) == 0)
+ if (strncasecmp (p, "inf", 3) == 0)
{
*mantissaP = 1ull << 63;
*expP = EXP_MAX;
input_line_pointer = p + 3;
return 1;
}
- for (; ISDIGIT(*p); ++p)
+ for (; ISDIGIT (*p); ++p)
{
if (mantissa >> 60)
{
mantissa = mantissa * 10 + (*p - '0');
}
/* skip non-significant digits */
- for (; ISDIGIT(*p); ++p)
+ for (; ISDIGIT (*p); ++p)
exponent++;
if (*p == '.')
{
p++;
- if (!exponent) /* if no precission overflow */
+ if (!exponent) /* If no precission overflow. */
{
- for (; ISDIGIT(*p); ++p, --exponent)
+ for (; ISDIGIT (*p); ++p, --exponent)
{
if (mantissa >> 60)
{
mantissa = mantissa * 10 + (*p - '0');
}
}
- for (; ISDIGIT(*p); ++p)
+ for (; ISDIGIT (*p); ++p)
;
}
if (*p == 'e' || *p == 'E')
es = (*p == '-');
if (es || *p == '+')
p++;
- for (; ISDIGIT(*p); ++p)
+ for (; ISDIGIT (*p); ++p)
{
if (t < 100)
t = t * 10 + (*p - '0');
}
exponent += (es) ? -t : t;
}
- if (ISALNUM(*p) || *p == '.')
+ if (ISALNUM (*p) || *p == '.')
return 0;
input_line_pointer = p;
if (mantissa == 0)
/* normalization */
for (; mantissa <= ~0ull/10; --exponent)
mantissa *= 10;
- /*
- now we have sign, mantissa, and signed decimal exponent
- need to recompute to binary exponent
- */
+ /* Now we have sign, mantissa, and signed decimal exponent
+ need to recompute to binary exponent. */
for (i = 64; exponent > 0; --exponent)
{
/* be sure that no integer overflow */
foo:
-.section foo, "a"
+ .section foo, "a"
-.section bar, "a"
+ .section bar, "a"
bar:
#name: unsupported .symver with common symbol
+#notarget: *-*-hpux*
#error_output: pr21661.l
run_dump_test "x86-64-nops-5"
run_dump_test "x86-64-nops-5-k8"
run_dump_test "x86-64-nops-7"
+ run_dump_test "x86-64-sysenter-intel"
+ run_dump_test "x86-64-sysenter-mixed"
+ run_dump_test "x86-64-sysenter-amd"
+ run_list_test "x86-64-sysenter-amd"
run_dump_test "noreg64"
run_list_test "cvtsi2sX"
run_dump_test "x86-64-sse4_1"
--- /dev/null
+#as: -mintel64
+#objdump: -dw -Mamd64
+#name: x86-64 sysenter (Intel64/AMD64)
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <.text>:
+[ ]*[a-f0-9]+:[ ]+0f 34[ ]+\(bad\)[ ]*
+[ ]*[a-f0-9]+:[ ]+0f 35[ ]+\(bad\)[ ]*
+[ ]*[a-f0-9]+:[ ]+0f 34[ ]+\(bad\)[ ]*
+[ ]*[a-f0-9]+:[ ]+0f 35[ ]+\(bad\)[ ]*
+#pass
--- /dev/null
+.*: Assembler messages:
+.*:2: Error: .*
+.*:3: Error: .*
+.*:6: Error: .*
+.*:7: Error: .*
--- /dev/null
+ .text
+ sysenter
+ sysexit
+
+ .intel_syntax noprefix
+ sysenter
+ sysexit
--- /dev/null
+#as: -mintel64
+#objdump: -dw -Mintel64
+#name: x86-64 sysenter (Intel64/Intel64)
+#source: x86-64-sysenter-amd.s
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <.text>:
+[ ]*[a-f0-9]+: 0f 34 sysenter *
+[ ]*[a-f0-9]+: 0f 35 sysexit *
+[ ]*[a-f0-9]+: 0f 34 sysenter *
+[ ]*[a-f0-9]+: 0f 35 sysexit *
+#pass
--- /dev/null
+#as: -mintel64
+#objdump: -dw
+#name: x86-64 sysenter (Intel64/Default)
+#source: x86-64-sysenter-amd.s
+#dump: x86-64-sysenter-intel.d
+
+2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * tui/tui-source.c (tui_source_window::do_scroll_vertical): Update
+ all source windows, and maintain horizontal scroll status while
+ doing so.
+
+2020-01-09 Tom Tromey <tom@tromey.com>
+
+ PR tui/18932:
+ * tui/tui-source.c (tui_source_window::do_scroll_vertical): Call
+ update_source_window, not print_source_lines.
+
+2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * tui/tui.c (tui_enable): Register tui hooks after calling
+ tui_display_main.
+
+2020-01-09 Christian Biesinger <cbiesinger@google.com>
+
+ * gdbsupport/common-defs.h: Don't define _FORTIFY_SOURCE on MinGW.
+
+2020-01-08 Simon Marchi <simon.marchi@efficios.com>
+
+ * thread.c (print_thread_info_1): Fix indentation.
+
+2020-01-09 Christian Biesinger <cbiesinger@google.com>
+
+ * symtab.c (general_symbol_info::compute_and_set_names): Move the
+ unique_xmalloc_ptr outside the if to always free the demangled name.
+
2020-01-08 Tom Tromey <tromey@adacore.com>
* xcoffread.c (enter_line_range, read_xcoff_symtab)
plus this seems like a reasonable safety measure. The check for
optimization is required because _FORTIFY_SOURCE only works when
optimization is enabled. If _FORTIFY_SOURCE is already defined,
- then we don't do anything. */
+ then we don't do anything. Also, on MinGW, fortify requires
+ linking to -lssp, and to avoid the hassle of checking for
+ that and linking to it statically, we just don't define
+ _FORTIFY_SOURCE there. */
-#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
+#if (!defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 \
+ && !defined(__MINGW32__))
#define _FORTIFY_SOURCE 2
#endif
htab_find_slot_with_hash (per_bfd->demangled_names_hash.get (),
&entry, *hash, INSERT));
+ /* The const_cast is safe because the only reason it is already
+ initialized is if we purposefully set it from a background
+ thread to avoid doing the work here. However, it is still
+ allocated from the heap and needs to be freed by us, just
+ like if we called symbol_find_demangled_name here. If this is
+ nullptr, we call symbol_find_demangled_name below, but we put
+ this smart pointer here to be sure that we don't leak this name. */
+ gdb::unique_xmalloc_ptr<char> demangled_name
+ (const_cast<char *> (language_specific.demangled_name));
+
/* If this name is not in the hash table, add it. */
if (*slot == NULL
/* A C version of the symbol may have already snuck into the table.
else
linkage_name_copy = linkage_name;
- /* The const_cast is safe because the only reason it is already
- initialized is if we purposefully set it from a background
- thread to avoid doing the work here. However, it is still
- allocated from the heap and needs to be freed by us, just
- like if we called symbol_find_demangled_name here. */
- gdb::unique_xmalloc_ptr<char> demangled_name
- (language_specific.demangled_name
- ? const_cast<char *> (language_specific.demangled_name)
- : symbol_find_demangled_name (this, linkage_name_copy.data ()));
+ if (demangled_name.get () == nullptr)
+ demangled_name.reset
+ (symbol_find_demangled_name (this, linkage_name_copy.data ()));
/* Suppose we have demangled_name==NULL, copy_name==0, and
linkage_name_copy==linkage_name. In this case, we already have the
+2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.tui/basic.exp: Add more scrolling tests.
+
+2020-01-09 Tom Tromey <tom@tromey.com>
+
+ PR tui/18932:
+ * lib/tuiterm.exp (Term::wait_for): Rename from _accept. Return a
+ meangingful value.
+ (Term::command, Term::resize): Update.
+ * gdb.tui/basic.exp: Add scrolling test.
+
+2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.tui/tui-layout-asm.exp: New file.
+
+2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * lib/tuiterm.exp (Term::check_box_contents): New proc.
+
+2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * lib/tuiterm.exp (Term::prepare_for_tui): New proc.
+ (Term::enter_tui): Use Term::prepare_for_tui.
+
+2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * lib/tuiterm.exp (Term::dump_screen): Always dump the screen when
+ called.
+
+2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.base/skip.exp: Fix race condition in test.
+
2020-01-06 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.base/backtrace.c: New file.
gdb_test "step" ".*" "step 2"; # Return from bar()
# With gcc 9.2.0 we jump once back to main before entering foo here.
# If that happens try to step a second time.
- gdb_test "step" "foo \\(\\) at.*" "step 3" "main \\(\\) at .*" "step"
+ gdb_test "step" "foo \\(\\) at.*" "step 3" \
+ "main \\(\\) at .*\r\n$gdb_prompt " "step"
gdb_test "step" ".*" "step 4"; # Return from foo()
gdb_test "step" "main \\(\\) at.*" "step 5"
}
gdb_test "step" ".*" "step 2"; # Return from bar()
# With gcc 9.2.0 we jump once back to main before entering foo here.
# If that happens try to step a second time.
- gdb_test "step" "foo \\(\\) at.*" "step 3" "main \\(\\) at.*" "step"
+ gdb_test "step" "foo \\(\\) at.*" "step 3" \
+ "main \\(\\) at .*\r\n$gdb_prompt " "step"
gdb_test "step" ".*" "step 4"; # Return from foo()
gdb_test "step" "main \\(\\) at.*" "step 5"
}
gdb_test "step" ".*" "step 2"; # Return from bar()
# With gcc 9.2.0 we jump once back to main before entering foo here.
# If that happens try to step a second time.
- gdb_test "step" "foo \\(\\) at.*" "step 3" "main \\(\\) at.*" "step"
+ gdb_test "step" "foo \\(\\) at.*" "step 3" \
+ "main \\(\\) at .*\r\n$gdb_prompt " "step"
gdb_test "step" ".*" "step 4"; # Return from foo()
gdb_test "step" "main \\(\\) at.*" "step 5"
}
Term::command "list main"
Term::check_contents "list main" "21 *return 0"
+# Get the first source line.
+set line [Term::get_line 1]
+# Send an up arrow.
+send_gdb "\033\[A"
+# Wait for a redraw and check that the first line changed.
+if {[Term::wait_for [string_to_regexp $line]] \
+ && [Term::get_line 1] != $line\
+ && [Term::get_line 2] == $line} {
+ pass "scroll up"
+} else {
+ fail "scroll up"
+}
+
+# Check the horizontal scrolling. First confirm that 'main ()' is
+# where we expect it to be. This relies on the current way we
+# position source code on the screen, which might change in the
+# future. The important part of this test is detecting the left/right
+# scrolling, not which line main is actually on.
+set line_num 6
+set line [Term::get_line $line_num]
+gdb_assert {[regexp -- "19\[\\t \]+main \\(\\)" $line]} \
+ "check main is where we expect on the screen"
+set regexp "19\[\\t \]+ain \\(\\)"
+# Send a right arrow.
+send_gdb "\033\[C"
+if {[Term::wait_for $regexp]} {
+ pass "scroll right"
+} else {
+ fail "scroll right"
+}
+set line [Term::get_line $line_num]
+# Send a down arrow.
+send_gdb "\033\[B"
+if {[Term::wait_for $regexp] \
+ && [Term::get_line [expr {$line_num - 1}]] == $line} {
+ pass "scroll down"
+} else {
+ fail "scroll down"
+}
+
Term::check_box "source box" 0 0 80 15
Term::command "layout asm"
--- /dev/null
+# Copyright 2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Ensure that 'layout asm' before starting the inferior puts us in the
+# asm layout and displays the disassembly for main.
+
+load_lib "tuiterm.exp"
+
+standard_testfile tui-layout.c
+
+if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
+ return -1
+}
+
+Term::clean_restart 24 80 $testfile
+if {![Term::prepare_for_tui]} {
+ unsupported "TUI not supported"
+}
+
+# This puts us into TUI mode, and should display the ASM window.
+Term::command "layout asm"
+Term::check_box_contents "check asm box contents" 0 0 80 15 "<main>"
_clear_lines 0 $_rows
}
- # Accept some output from gdb and update the screen.
- proc _accept {wait_for} {
+ # Accept some output from gdb and update the screen. WAIT_FOR is
+ # a regexp matching the line to wait for. Return 0 on timeout, 1
+ # on success.
+ proc wait_for {wait_for} {
global expect_out
global gdb_prompt
variable _cur_x
timeout {
# Assume a timeout means we somehow missed the
# expected result, and carry on.
- return
+ return 0
}
}
set wait_for $prompt_wait_for
}
}
+
+ return 1
}
# Like ::clean_restart, but ensures that gdb starts in an
}
}
- # Start the TUI. Returns 1 on success, 0 if TUI tests should be
- # skipped.
- proc enter_tui {} {
+ # Setup ready for starting the tui, but don't actually start it.
+ # Returns 1 on success, 0 if TUI tests should be skipped.
+ proc prepare_for_tui {} {
if {[skip_tui_tests]} {
return 0
}
gdb_test_no_output "set tui border-kind ascii"
gdb_test_no_output "maint set tui-resize-message on"
+ return 1
+ }
+
+ # Start the TUI. Returns 1 on success, 0 if TUI tests should be
+ # skipped.
+ proc enter_tui {} {
+ if {![prepare_for_tui]} {
+ return 0
+ }
+
command "tui enable"
return 1
}
# be supplied by this function.
proc command {cmd} {
send_gdb "$cmd\n"
- _accept [string_to_regexp $cmd]
+ wait_for [string_to_regexp $cmd]
}
# Return the text of screen line N, without attributes. Lines are
}
}
+ # Check the contents of a box on the screen. This is a little
+ # like check_contents, but doens't check the whole screen
+ # contents, only the contents of a single box. This procedure
+ # includes (effectively) a call to check_box to ensure there is a
+ # box where expected, if there is then the contents of the box are
+ # matched against REGEXP.
+ proc check_box_contents {test_name x y width height regexp} {
+ variable _chars
+
+ set why [_check_box $x $y $width $height]
+ if {$why != ""} {
+ dump_screen
+ fail "$test_name (box check: $why)"
+ return
+ }
+
+ # Now grab the contents of the box, join each line together
+ # with a newline character and match against REGEXP.
+ set result ""
+ for {set yy [expr {$y + 1}]} {$yy < [expr {$y + $height - 1}]} {incr yy} {
+ for {set xx [expr {$x + 1}]} {$xx < [expr {$x + $width - 1}]} {incr xx} {
+ append result [lindex $_chars($xx,$yy) 0]
+ }
+ append result "\n"
+ }
+
+ if {![gdb_assert {[regexp -- $regexp $result]} $test_name]} {
+ dump_screen
+ }
+ }
+
# A debugging function to dump the current screen, with line
# numbers.
proc dump_screen {} {
variable _rows
variable _cols
- verbose "Screen Dump ($_cols x $_rows):"
+ verbose -log "Screen Dump ($_cols x $_rows):"
for {set y 0} {$y < $_rows} {incr y} {
set fmt [format %5d $y]
- verbose "$fmt [get_line $y]"
+ verbose -log "$fmt [get_line $y]"
}
}
# Due to the strange column resizing behavior, and because we
# don't care about this intermediate resize, we don't check
# the size here.
- _accept "@@ resize done $_resize_count"
+ wait_for "@@ resize done $_resize_count"
incr _resize_count
# Somehow the number of columns transmitted to gdb is one less
# than what we request from expect. We hide this weird
# details from the caller.
_do_resize $_rows $cols
stty columns [expr {$_cols + 1}] < $gdb_spawn_name
- _accept "@@ resize done $_resize_count, size = ${_cols}x${rows}"
+ wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}"
incr _resize_count
}
}
for (inferior *inf : all_inferiors ())
for (thread_info *tp : inf->threads ())
- {
- int core;
+ {
+ int core;
- any_thread = true;
- if (tp == current_thread && tp->state == THREAD_EXITED)
- current_exited = true;
+ any_thread = true;
+ if (tp == current_thread && tp->state == THREAD_EXITED)
+ current_exited = true;
- if (!should_print_thread (requested_threads, default_inf_num,
- global_ids, pid, tp))
- continue;
+ if (!should_print_thread (requested_threads, default_inf_num,
+ global_ids, pid, tp))
+ continue;
- ui_out_emit_tuple tuple_emitter (uiout, NULL);
+ ui_out_emit_tuple tuple_emitter (uiout, NULL);
- if (!uiout->is_mi_like_p ())
- {
- if (tp == current_thread)
- uiout->field_string ("current", "*");
- else
- uiout->field_skip ("current");
+ if (!uiout->is_mi_like_p ())
+ {
+ if (tp == current_thread)
+ uiout->field_string ("current", "*");
+ else
+ uiout->field_skip ("current");
- uiout->field_string ("id-in-tg", print_thread_id (tp));
- }
+ uiout->field_string ("id-in-tg", print_thread_id (tp));
+ }
- if (show_global_ids || uiout->is_mi_like_p ())
- uiout->field_signed ("id", tp->global_num);
+ if (show_global_ids || uiout->is_mi_like_p ())
+ uiout->field_signed ("id", tp->global_num);
- /* For the CLI, we stuff everything into the target-id field.
- This is a gross hack to make the output come out looking
- correct. The underlying problem here is that ui-out has no
- way to specify that a field's space allocation should be
- shared by several fields. For MI, we do the right thing
- instead. */
+ /* For the CLI, we stuff everything into the target-id field.
+ This is a gross hack to make the output come out looking
+ correct. The underlying problem here is that ui-out has no
+ way to specify that a field's space allocation should be
+ shared by several fields. For MI, we do the right thing
+ instead. */
- if (uiout->is_mi_like_p ())
- {
- uiout->field_string ("target-id", target_pid_to_str (tp->ptid));
+ if (uiout->is_mi_like_p ())
+ {
+ uiout->field_string ("target-id", target_pid_to_str (tp->ptid));
- const char *extra_info = target_extra_thread_info (tp);
- if (extra_info != nullptr)
- uiout->field_string ("details", extra_info);
+ const char *extra_info = target_extra_thread_info (tp);
+ if (extra_info != nullptr)
+ uiout->field_string ("details", extra_info);
- const char *name = (tp->name != nullptr
- ? tp->name
- : target_thread_name (tp));
- if (name != NULL)
- uiout->field_string ("name", name);
- }
- else
- {
- uiout->field_string ("target-id",
- thread_target_id_str (tp).c_str ());
- }
+ const char *name = (tp->name != nullptr
+ ? tp->name
+ : target_thread_name (tp));
+ if (name != NULL)
+ uiout->field_string ("name", name);
+ }
+ else
+ {
+ uiout->field_string ("target-id",
+ thread_target_id_str (tp).c_str ());
+ }
- if (tp->state == THREAD_RUNNING)
- uiout->text ("(running)\n");
- else
- {
- /* The switch below puts us at the top of the stack (leaf
- frame). */
- switch_to_thread (tp);
- print_stack_frame (get_selected_frame (NULL),
- /* For MI output, print frame level. */
- uiout->is_mi_like_p (),
- LOCATION, 0);
- }
+ if (tp->state == THREAD_RUNNING)
+ uiout->text ("(running)\n");
+ else
+ {
+ /* The switch below puts us at the top of the stack (leaf
+ frame). */
+ switch_to_thread (tp);
+ print_stack_frame (get_selected_frame (NULL),
+ /* For MI output, print frame level. */
+ uiout->is_mi_like_p (),
+ LOCATION, 0);
+ }
- if (uiout->is_mi_like_p ())
- {
- const char *state = "stopped";
+ if (uiout->is_mi_like_p ())
+ {
+ const char *state = "stopped";
- if (tp->state == THREAD_RUNNING)
- state = "running";
- uiout->field_string ("state", state);
- }
+ if (tp->state == THREAD_RUNNING)
+ state = "running";
+ uiout->field_string ("state", state);
+ }
- core = target_core_of_thread (tp->ptid);
- if (uiout->is_mi_like_p () && core != -1)
- uiout->field_signed ("core", core);
- }
+ core = target_core_of_thread (tp->ptid);
+ if (uiout->is_mi_like_p () && core != -1)
+ uiout->field_signed ("core", core);
+ }
/* This end scope restores the current thread and the frame
selected before the "info threads" command, and it finishes the
{
if (!content.empty ())
{
- struct tui_line_or_address l;
struct symtab *s;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+ struct gdbarch *arch = gdbarch;
if (cursal.symtab == NULL)
- s = find_pc_line_symtab (get_frame_pc (get_selected_frame (NULL)));
+ {
+ struct frame_info *fi = get_selected_frame (NULL);
+ s = find_pc_line_symtab (get_frame_pc (fi));
+ arch = get_frame_arch (fi);
+ }
else
s = cursal.symtab;
- l.loa = LOA_LINE;
- l.u.line_no = start_line_or_addr.u.line_no
- + num_to_scroll;
+ int line_no = start_line_or_addr.u.line_no + num_to_scroll;
const std::vector<off_t> *offsets;
if (g_source_cache.get_line_charpos (s, &offsets)
- && l.u.line_no > offsets->size ())
- l.u.line_no = start_line_or_addr.u.line_no;
- if (l.u.line_no <= 0)
- l.u.line_no = 1;
-
- print_source_lines (s, l.u.line_no, l.u.line_no + 1, 0);
+ && line_no > offsets->size ())
+ line_no = start_line_or_addr.u.line_no;
+ if (line_no <= 0)
+ line_no = 1;
+
+ cursal.line = line_no;
+ find_line_pc (cursal.symtab, cursal.line, &cursal.pc);
+ for (struct tui_source_window_base *win_info : tui_source_windows ())
+ win_info->update_source_window_as_is (arch, cursal);
}
}
clearok (stdscr, TRUE);
}
- /* Install the TUI specific hooks. */
- tui_install_hooks ();
- rl_startup_hook = tui_rl_startup_hook;
-
if (tui_update_variables ())
tui_rehighlight_all ();
else
tui_display_main ();
+ /* Install the TUI specific hooks. This must be done after the call to
+ tui_display_main so that we don't detect the symtab changed event it
+ can cause. */
+ tui_install_hooks ();
+ rl_startup_hook = tui_rl_startup_hook;
+
/* Restore TUI keymap. */
tui_set_key_mode (tui_current_key_mode);
+2020-01-10 Alan Modra <amodra@gmail.com>
+
+ * opcode/spu.h: Formatting.
+ (UNSIGNED_EXTRACT): Use 1u.
+ (SIGNED_EXTRACT): Don't sign extend with shifts.
+ (DECODE_INSN_I9a, DECODE_INSN_I9b): Avoid left shift of signed value.
+ Keep result signed.
+ (DECODE_INSN_U9a, DECODE_INSN_U9b): Delete.
+
2020-01-07 Shahab Vahedi <shahab@synopsys.com>
* opcode/arc.h (insn_class_t): Add 'LLOCK' and 'SCOND'.
int arg[5];
};
-#define SIGNED_EXTRACT(insn,size,pos) (((int)((insn) << (32-size-pos))) >> (32-size))
-#define UNSIGNED_EXTRACT(insn,size,pos) (((insn) >> pos) & ((1 << size)-1))
+#define UNSIGNED_EXTRACT(insn, size, pos) \
+ (((insn) >> (pos)) & ((1u << (size)) - 1))
+#define SIGNED_EXTRACT(insn, size, pos) \
+ (((int) UNSIGNED_EXTRACT(insn, size, pos) \
+ ^ (1 << ((size) - 1))) - (1 << ((size) - 1)))
#define DECODE_INSN_RT(insn) (insn & 0x7f)
#define DECODE_INSN_RA(insn) ((insn >> 7) & 0x7f)
#define DECODE_INSN_RB(insn) ((insn >> 14) & 0x7f)
#define DECODE_INSN_RC(insn) ((insn >> 21) & 0x7f)
-#define DECODE_INSN_I10(insn) SIGNED_EXTRACT(insn,10,14)
-#define DECODE_INSN_U10(insn) UNSIGNED_EXTRACT(insn,10,14)
+#define DECODE_INSN_I10(insn) SIGNED_EXTRACT (insn, 10, 14)
+#define DECODE_INSN_U10(insn) UNSIGNED_EXTRACT (insn, 10, 14)
/* For branching, immediate loads, hbr and lqa/stqa. */
-#define DECODE_INSN_I16(insn) SIGNED_EXTRACT(insn,16,7)
-#define DECODE_INSN_U16(insn) UNSIGNED_EXTRACT(insn,16,7)
+#define DECODE_INSN_I16(insn) SIGNED_EXTRACT (insn, 16, 7)
+#define DECODE_INSN_U16(insn) UNSIGNED_EXTRACT (insn, 16, 7)
/* for stop */
-#define DECODE_INSN_U14(insn) UNSIGNED_EXTRACT(insn,14,0)
+#define DECODE_INSN_U14(insn) UNSIGNED_EXTRACT (insn, 14, 0)
/* For ila */
-#define DECODE_INSN_I18(insn) SIGNED_EXTRACT(insn,18,7)
-#define DECODE_INSN_U18(insn) UNSIGNED_EXTRACT(insn,18,7)
+#define DECODE_INSN_I18(insn) SIGNED_EXTRACT (insn, 18, 7)
+#define DECODE_INSN_U18(insn) UNSIGNED_EXTRACT (insn, 18, 7)
/* For rotate and shift and generate control mask */
-#define DECODE_INSN_I7(insn) SIGNED_EXTRACT(insn,7,14)
-#define DECODE_INSN_U7(insn) UNSIGNED_EXTRACT(insn,7,14)
+#define DECODE_INSN_I7(insn) SIGNED_EXTRACT (insn, 7, 14)
+#define DECODE_INSN_U7(insn) UNSIGNED_EXTRACT (insn, 7, 14)
/* For float <-> int conversion */
-#define DECODE_INSN_I8(insn) SIGNED_EXTRACT(insn,8,14)
-#define DECODE_INSN_U8(insn) UNSIGNED_EXTRACT(insn,8,14)
+#define DECODE_INSN_I8(insn) SIGNED_EXTRACT (insn, 8, 14)
+#define DECODE_INSN_U8(insn) UNSIGNED_EXTRACT (insn, 8, 14)
/* For hbr */
-#define DECODE_INSN_I9a(insn) ((SIGNED_EXTRACT(insn,2,23) << 7) | UNSIGNED_EXTRACT(insn,7,0))
-#define DECODE_INSN_I9b(insn) ((SIGNED_EXTRACT(insn,2,14) << 7) | UNSIGNED_EXTRACT(insn,7,0))
-#define DECODE_INSN_U9a(insn) ((UNSIGNED_EXTRACT(insn,2,23) << 7) | UNSIGNED_EXTRACT(insn,7,0))
-#define DECODE_INSN_U9b(insn) ((UNSIGNED_EXTRACT(insn,2,14) << 7) | UNSIGNED_EXTRACT(insn,7,0))
+#define DECODE_INSN_I9a(insn) \
+ ((SIGNED_EXTRACT (insn, 2, 23) * 128) | (int) UNSIGNED_EXTRACT (insn, 7, 0))
+#define DECODE_INSN_I9b(insn) \
+ ((SIGNED_EXTRACT (insn, 2, 14) * 128) | (int) UNSIGNED_EXTRACT (insn, 7, 0))
+2020-01-10 Alan Modra <amodra@gmail.com>
+
+ * tilepro-opc.c (parse_insn_tilepro): Make opval unsigned.
+ * tilegx-opc.c (parse_insn_tilegx): Likewise. Delete raw_opval.
+
+2020-01-10 Alan Modra <amodra@gmail.com>
+
+ * m10300-dis.c (disassemble): Move extraction of DREG, AREG, RREG,
+ and XRREG value earlier to avoid a shift with negative exponent.
+ * m10200-dis.c (disassemble): Similarly.
+
+2020-01-09 Nick Clifton <nickc@redhat.com>
+
+ PR 25224
+ * z80-dis.c (ld_ii_ii): Use correct cast.
+
+2020-01-03 Sergey Belyashov <sergey.belyashov@gmail.com>
+
+ PR 25224
+ * z80-dis.c (ld_ii_ii): Use character constant when checking
+ opcode byte value.
+
+2020-01-09 Jan Beulich <jbeulich@suse.com>
+
+ * i386-dis.c (SEP_Fixup): New.
+ (SEP): Define.
+ (dis386_twobyte): Use it for sysenter/sysexit.
+ (enum x86_64_isa): Change amd64 enumerator to value 1.
+ (OP_J): Compare isa64 against intel64 instead of amd64.
+ * i386-opc.tbl (sysenter, sysexit): Split into AMD64 and Intel64
+ forms.
+ * i386-tbl.h: Re-generate.
+
2020-01-08 Alan Modra <amodra@gmail.com>
* z8k-dis.c: Include libiberty.h
static void CMP_Fixup (int, int);
static void BadOp (void);
static void REP_Fixup (int, int);
+static void SEP_Fixup (int, int);
static void BND_Fixup (int, int);
static void NOTRACK_Fixup (int, int);
static void HLE_Fixup1 (int, int);
#define EMCq { OP_EMC, q_mode }
#define MXC { OP_MXC, 0 }
#define OPSUF { OP_3DNowSuffix, 0 }
+#define SEP { SEP_Fixup, 0 }
#define CMP { CMP_Fixup, 0 }
#define XMM0 { XMM_Fixup, 0 }
#define FXSAVE { FXSAVE_Fixup, 0 }
{ "rdtsc", { XX }, 0 },
{ "rdmsr", { XX }, 0 },
{ "rdpmc", { XX }, 0 },
- { "sysenter", { XX }, 0 },
- { "sysexit", { XX }, 0 },
+ { "sysenter", { SEP }, 0 },
+ { "sysexit", { SEP }, 0 },
{ Bad_Opcode },
{ "getsec", { XX }, 0 },
/* 38 */
enum x86_64_isa
{
- amd64 = 0,
+ amd64 = 1,
intel64
};
disp -= 0x100;
break;
case v_mode:
- if (isa64 == amd64)
+ if (isa64 != intel64)
case dqw_mode:
USED_REX (REX_W);
if ((sizeflag & DFLAG)
|| (address_mode == mode_64bit
- && ((isa64 != amd64 && bytemode != dqw_mode)
+ && ((isa64 == intel64 && bytemode != dqw_mode)
|| (rex & REX_W))))
disp = get32s ();
else
& ~((bfd_vma) 0xffff));
}
if (address_mode != mode_64bit
- || (isa64 == amd64 && !(rex & REX_W)))
+ || (isa64 != intel64 && !(rex & REX_W)))
used_prefixes |= (prefixes & PREFIX_DATA);
break;
default:
}
}
+static void
+SEP_Fixup (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
+{
+ if ( isa64 != amd64 )
+ return;
+
+ obufp = obuf;
+ BadOp ();
+ mnemonicendp = obufp;
+ ++codep;
+}
+
/* For BND-prefixed instructions 0xF2 prefix should be displayed as
"bnd". */
cmpxchg8b, 1, 0xfc7, 0x1, 2, Cpu586, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|IsLockable|NoRex64|HLEPrefixOk, { Qword|Unspecified|BaseIndex }
// Pentium II/Pentium Pro extensions.
-sysenter, 0, 0xf34, None, 2, Cpu686, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
-sysexit, 0, 0xf35, None, 2, Cpu686, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
+sysenter, 0, 0xf34, None, 2, Cpu686, Intel64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
+sysenter, 0, 0xf34, None, 2, Cpu686|CpuNo64, AMD64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
+sysexit, 0, 0xf35, None, 2, Cpu686, Intel64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
+sysexit, 0, 0xf35, None, 2, Cpu686|CpuNo64, AMD64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
fxsave, 1, 0xfae, 0x0, 2, CpuFXSR, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf, { Unspecified|BaseIndex }
fxsave64, 1, 0xfae, 0x0, 2, CpuFXSR|Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Rex64, { Unspecified|BaseIndex }
fxrstor, 1, 0xfae, 0x1, 2, CpuFXSR, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf, { Unspecified|BaseIndex }
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
+ { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0 } } } },
+ { "sysenter", 0xf34, None, 2, 0,
+ { { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 } },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 },
{ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 } } } },
{ "sysexit", 0xf35, None, 2, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
+ { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0 } } } },
+ { "sysexit", 0xf35, None, 2, 0,
+ { { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 } },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 },
{ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 } } } },
{ "fxsave", 0xfae, 0x0, 2, 1,
operand = &mn10200_operands[*opindex_ptr];
- if ((operand->flags & MN10200_OPERAND_EXTENDED) != 0)
+ if ((operand->flags & MN10200_OPERAND_DREG) != 0
+ || (operand->flags & MN10200_OPERAND_AREG) != 0)
+ value = ((insn >> (operand->shift + extra_shift))
+ & ((1 << operand->bits) - 1));
+ else if ((operand->flags & MN10200_OPERAND_EXTENDED) != 0)
{
value = (insn & 0xffff) << 8;
value |= extension;
}
else
- {
- value = ((insn >> (operand->shift))
- & ((1L << operand->bits) - 1L));
- }
+ value = ((insn >> (operand->shift))
+ & ((1L << operand->bits) - 1L));
if ((operand->flags & MN10200_OPERAND_SIGNED) != 0)
value = ((long)(value << (32 - operand->bits))
nocomma = 0;
if ((operand->flags & MN10200_OPERAND_DREG) != 0)
- {
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "d%ld", value);
- }
+ (*info->fprintf_func) (info->stream, "d%ld", value);
else if ((operand->flags & MN10200_OPERAND_AREG) != 0)
- {
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "a%ld", value);
- }
+ (*info->fprintf_func) (info->stream, "a%ld", value);
else if ((operand->flags & MN10200_OPERAND_PSW) != 0)
(*info->fprintf_func) (info->stream, "psw");
if ((operand->flags & MN10300_OPERAND_PLUS) != 0)
nocomma = 1;
- if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
+ if ((operand->flags & MN10300_OPERAND_DREG) != 0
+ || (operand->flags & MN10300_OPERAND_AREG) != 0
+ || (operand->flags & MN10300_OPERAND_RREG) != 0
+ || (operand->flags & MN10300_OPERAND_XRREG) != 0)
+ value = ((insn >> (operand->shift + extra_shift))
+ & ((1 << operand->bits) - 1));
+ else if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
{
unsigned long temp;
nocomma = 0;
if ((operand->flags & MN10300_OPERAND_DREG) != 0)
- {
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "d%d", (int) value);
- }
+ (*info->fprintf_func) (info->stream, "d%d", (int) value);
else if ((operand->flags & MN10300_OPERAND_AREG) != 0)
- {
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "a%d", (int) value);
- }
+ (*info->fprintf_func) (info->stream, "a%d", (int) value);
else if ((operand->flags & MN10300_OPERAND_SP) != 0)
(*info->fprintf_func) (info->stream, "sp");
else if ((operand->flags & MN10300_OPERAND_RREG) != 0)
{
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
if (value < 8)
(*info->fprintf_func) (info->stream, "r%d", (int) value);
else if (value < 12)
else if ((operand->flags & MN10300_OPERAND_XRREG) != 0)
{
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
if (value == 0)
(*info->fprintf_func) (info->stream, "sp");
else
{
const struct tilegx_operand *op =
&tilegx_operands[opc->operands[pipe][i]];
- int raw_opval = op->extract (bits);
- long long opval;
+ unsigned int opval = op->extract (bits);
if (op->is_signed)
{
/* Sign-extend the operand. */
unsigned int sign = 1u << (op->num_bits - 1);
- raw_opval = ((raw_opval & (sign + sign - 1)) ^ sign) - sign;
+ opval = ((opval & (sign + sign - 1)) ^ sign) - sign;
}
/* Adjust PC-relative scaled branch offsets. */
if (op->type == TILEGX_OP_TYPE_ADDRESS)
- opval = (raw_opval * TILEGX_BUNDLE_SIZE_IN_BYTES) + pc;
- else
- opval = raw_opval;
+ opval = opval * TILEGX_BUNDLE_SIZE_IN_BYTES + pc;
/* Record the final value. */
d->operands[i] = op;
{
const struct tilepro_operand *op =
&tilepro_operands[opc->operands[pipe][i]];
- int opval = op->extract (bits);
+ unsigned int opval = op->extract (bits);
if (op->is_signed)
{
/* Adjust PC-relative scaled branch offsets. */
if (op->type == TILEPRO_OP_TYPE_ADDRESS)
- {
- opval *= TILEPRO_BUNDLE_SIZE_IN_BYTES;
- opval += (int)pc;
- }
+ opval = opval * TILEPRO_BUNDLE_SIZE_IN_BYTES + pc;
/* Record the final value. */
d->operands[i] = op;
{
int r;
- if (buf->n_fetch + n > (int)sizeof(buf->data))
+ if (buf->n_fetch + n > (int)sizeof (buf->data))
abort ();
r = info->read_memory_func (buf->base + buf->n_fetch,
{
struct tab_elt *p;
- if (fetch_data(buf, info, 1))
+ if (fetch_data (buf, info, 1))
{
- for (p = opc_ed; p->val != (buf->data[1] & p->mask) || !mach_inst(buf, p); ++p)
+ for (p = opc_ed; p->val != (buf->data[1] & p->mask) || !mach_inst (buf, p); ++p)
;
p->fp (buf, info, p->text);
}
}
static int
-ld_d_r(struct buffer *buf, disassemble_info * info, const char *txt)
+ld_d_r (struct buffer *buf, disassemble_info * info, const char *txt)
{
char mytxt[TXTSIZ];
signed char c;
}
static int
-ld_ii_ii(struct buffer *buf, disassemble_info * info, const char *txt)
+ld_ii_ii (struct buffer *buf, disassemble_info * info, const char *txt)
{
char mytxt[TXTSIZ];
signed char c;
int p;
static const char *ii[2] = { "ix", "iy" };
- p = (buf->data[buf->n_fetch - 2] == '\xdd') ? 0 : 1;
+ p = (buf->data[buf->n_fetch - 2] == (signed char) 0xdd) ? 0 : 1;
c = buf->data[buf->n_fetch - 1];
if ((c & 0x07) != 0x07)
p = 1 - p; /* 0 -> 1, 1 -> 0 */
if (! fetch_data (buf, info, 1))
return -1;
- for (p = opc_main; p->val != (buf->data[0] & p->mask) || !mach_inst(buf, p); ++p)
+ for (p = opc_main; p->val != (buf->data[0] & p->mask) || !mach_inst (buf, p); ++p)
;
p->fp (buf, info, p->text);