Merge branch 'master' into merge-job
authorJenkins as Icarus Sparry <icarus.sparry@amd.com>
Fri, 10 Jan 2020 15:18:12 +0000 (15:18 +0000)
committerJenkins as Icarus Sparry <icarus.sparry@amd.com>
Fri, 10 Jan 2020 15:18:12 +0000 (15:18 +0000)
59 files changed:
ChangeLog
bfd/ChangeLog
bfd/bfd.c
bfd/coff-alpha.c
bfd/elf32-arm.c
bfd/elfnn-aarch64.c
bfd/version.h
binutils/ChangeLog
binutils/Makefile.am
binutils/Makefile.in
binutils/NEWS
binutils/config.in
binutils/configure
binutils/configure.ac
binutils/doc/Makefile.in
binutils/doc/binutils.texi
binutils/dwarf.c
binutils/dwarf.h
binutils/objcopy.c
binutils/objdump.c
binutils/po/zh_TW.po
binutils/readelf.c
binutils/testsuite/binutils-all/linkdebug.s
config/debuginfod.m4 [new file with mode: 0644]
configure
configure.ac
gas/ChangeLog
gas/config/tc-i386.c
gas/config/tc-z80.c
gas/testsuite/gas/elf/pr14891.s
gas/testsuite/gas/elf/pr21661.d
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/x86-64-sysenter-amd.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-sysenter-amd.l [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-sysenter-amd.s [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-sysenter-intel.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-sysenter-mixed.d [new file with mode: 0644]
gdb/ChangeLog
gdb/gdbsupport/common-defs.h
gdb/symtab.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/skip.exp
gdb/testsuite/gdb.tui/basic.exp
gdb/testsuite/gdb.tui/tui-layout-asm.exp [new file with mode: 0644]
gdb/testsuite/lib/tuiterm.exp
gdb/thread.c
gdb/tui/tui-source.c
gdb/tui/tui.c
include/ChangeLog
include/opcode/spu.h
opcodes/ChangeLog
opcodes/i386-dis.c
opcodes/i386-opc.tbl
opcodes/i386-tbl.h
opcodes/m10200-dis.c
opcodes/m10300-dis.c
opcodes/tilegx-opc.c
opcodes/tilepro-opc.c
opcodes/z80-dis.c

index 2eeac2751086eec8da619663319f399b5fc099e7..00a224473b5175dc851d47937a37a193fd0a331e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
index 306f2e651243f809f1522bfb8158a8bfd209fdd5..00d6cd810b38fca970f7d24a091a654c95a425ce 100644 (file)
@@ -1,3 +1,25 @@
+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
index d590e0a4e912769edeb5207b25a32e94710333c7..b1050626b68194e60c55b6780bb1244873e94083 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -2768,7 +2768,7 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
       || 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;
@@ -2782,11 +2782,17 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
   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
@@ -2803,6 +2809,12 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
 
       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;
index 0baac2a24a2d54dadea44abd96571b564fc9ffcc..4b39bcc999dc0d49d3747bc9df5e80f5360a9fb8 100644 (file)
@@ -423,7 +423,7 @@ alpha_ecoff_object_p (bfd *abfd)
        {
          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))
index 2bf355a331222bc3c2d1c54ee704cfddbd11443f..faf8376f2006f9c8f8da977fd5341741af84ecd5 100644 (file)
@@ -11578,8 +11578,7 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
                  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
                    {
@@ -16452,8 +16451,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
               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)
index 756ffeb6bdad04ce7fc466e7f3c23c462c6a806a..5fabcd8f6462730aef10ec942b594d589759994e 100644 (file)
@@ -3177,10 +3177,6 @@ _bfd_aarch64_create_stub_section (asection *section,
   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);
index 36097cbc34190601ad0825ef72c3065b43409a68..a7060135c1234cf946528f6f1d5e196bc104a33d 100644 (file)
@@ -16,7 +16,7 @@
 
    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@
index ecc4e1adb96fa4b0dce3bbd56cb6ec0210ae99ce..b3c499d466e9502ea4b6a2018528701188c373e0 100644 (file)
@@ -1,3 +1,40 @@
+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
index cc23012064981dbaba5c661118fa52efbc16e93e..f1f3907b0bf9820a6603ee78c819ff2a235c4a3e 100644 (file)
@@ -53,6 +53,8 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
 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
@@ -245,7 +247,7 @@ 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)
@@ -256,7 +258,7 @@ 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)
 
 objdump.@OBJEXT@:objdump.c
 if am__fastdepCC
index 91dfe257f24f8d6c6611d3acf7b85c0e90b1dacb..39f08563f960751347d17ae7b86e06eca1c17e45 100644 (file)
@@ -138,7 +138,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
        $(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 \
@@ -449,6 +451,7 @@ LDFLAGS = @LDFLAGS@
 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@
@@ -706,14 +709,14 @@ size_SOURCES = size.c $(BULIBS)
 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)
index e5e0056d662e1f77c77629e4fa317459676a4176..72a964424e2c7992b95f92e0bbe9e87a5c935644 100644 (file)
@@ -1,5 +1,14 @@
 -*- 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.
 
index 72ead4eb61288714b8144c807b9ad2ec072aedf6..703f7b15e7571df9a8ce8c779a01018e6659ee3b 100644 (file)
 /* 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
 
index 50f8d5b1a2c9e48f95a0de78d571f4070cda0640..aa91e1b395e68a31278061b76b127b608b636f02 100755 (executable)
@@ -684,6 +684,7 @@ WARN_WRITE_STRINGS
 NO_WERROR
 WARN_CFLAGS_FOR_BUILD
 WARN_CFLAGS
+LIBDEBUGINFOD
 OTOOL64
 OTOOL
 LIPO
@@ -813,6 +814,7 @@ enable_largefile
 enable_targets
 enable_deterministic_archives
 enable_default_strings_all
+with_debuginfod
 enable_werror
 enable_build_warnings
 enable_nls
@@ -1483,6 +1485,8 @@ Optional Packages:
   --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
@@ -1932,6 +1936,52 @@ $as_echo "$ac_res" >&6; }
 
 } # 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
@@ -2168,52 +2218,6 @@ $as_echo "$ac_res" >&6; }
   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.
@@ -11523,7 +11527,7 @@ else
   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
@@ -11629,7 +11633,7 @@ else
   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
index d77161f95db2db980da92a23a2a5891a6684a121..385ab01a26c8ef2bbde8518b0df43e9d289447bf 100644 (file)
@@ -18,6 +18,7 @@ dnl <http://www.gnu.org/licenses/>.
 dnl
 
 m4_include([../bfd/version.m4])
+m4_include([../config/debuginfod.m4])
 AC_INIT([binutils], BFD_VERSION)
 AC_CONFIG_SRCDIR(ar.c)
 
@@ -63,6 +64,8 @@ else
   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?])
 
index 52c39ba2eb54850dbb4f17b065eaeec0b1f65532..b0e7b7b6c8969f6b5162fc101d4802e62c4bfa49 100644 (file)
@@ -127,7 +127,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
        $(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)
@@ -284,6 +286,7 @@ LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDEBUGINFOD = @LIBDEBUGINFOD@
 LIBICONV = @LIBICONV@
 LIBINTL = @LIBINTL@
 LIBINTL_DEP = @LIBINTL_DEP@
index f938e7437abc2b7b06f3fae0f4e2aca842acce25..71af6c5fcfb1b39ee5320eb4585a6b2fdfb261b7 100644 (file)
@@ -154,6 +154,7 @@ in the section entitled ``GNU Free Documentation License''.
 * 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
@@ -5201,6 +5202,23 @@ Ways to specify:
 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
index 130ba10be3eb6be7fbf22a3e4a2a4ea90ab7c9f3..9c96f471f858bca92c83a4807fd0f73b5b38025c 100644 (file)
 #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))
@@ -10128,12 +10132,83 @@ add_separate_debug_file (const char * filename, void * handle)
   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;
@@ -10235,6 +10310,23 @@ load_separate_debug_info (const char *            main_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);
@@ -10264,6 +10356,16 @@ load_separate_debug_info (const char *            main_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;
@@ -10410,7 +10512,8 @@ load_separate_debug_files (void * file, const char * filename)
                                & 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))
@@ -10421,7 +10524,8 @@ load_separate_debug_files (void * file, const char * filename)
                                & debug_displays[gnu_debuglink].section,
                                parse_gnu_debuglink,
                                check_gnu_debuglink,
-                               & crc32);
+                               & crc32,
+                               file);
     }
 
   if (first_separate_info != NULL)
index 333585836eac40cfd74d2c865ca6d17ecf55865a..69566926769b35a1565d5ccf95b3ab90831d99ac 100644 (file)
@@ -256,6 +256,10 @@ extern bfd_boolean reloc_at (struct dwarf_section *, dwarf_vma);
 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)
 {
index 61b33c7e40517d937b24bf8353453a1b7d76df17..ef3b693be4916106d4afd132f50ec90b10b125dc 100644 (file)
@@ -68,7 +68,7 @@ struct addsym_node
   long      symval;
   flagword  flags;
   char *    section;
-  char *    othersym;
+  const char *  othersym;
 };
 
 typedef struct section_rename
@@ -808,7 +808,7 @@ parse_flags (const char *s)
    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;
@@ -1453,6 +1453,9 @@ is_hidden_symbol (asymbol *sym)
   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)
 {
@@ -1464,10 +1467,12 @@ 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;
        }
@@ -1695,7 +1700,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
        {
          if (ptr->othersym)
            {
-             if (strcmp (ptr->othersym, ""))
+             if (ptr->othersym != empty_name)
                fatal (_("'before=%s' not found"), ptr->othersym);
            }
          else
index 210b67e79b221441e98a9f0d107b0f6f1f60b048..27b0fb6039404f8a3fe4266d155bbb47b4bce7f6 100644 (file)
@@ -2945,6 +2945,33 @@ open_debug_file (const char * pathname)
   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)
index d3ef5e0e701d91195083f50691d515bb7ad1e0dc..38d60290c13de98cfdb7745906e310d9a416d23c 100644 (file)
@@ -10,16 +10,16 @@ msgstr ""
 "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
@@ -949,7 +949,7 @@ msgstr "「%s」不是一般的檔案\n"
 #: 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"
@@ -7608,7 +7608,7 @@ msgstr ""
 #: 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
@@ -11919,333 +11919,3 @@ msgstr "stab_int_type:錯誤大小 %u"
 #, 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"
index 0ca8aabe7e843281c86fd172b23987453a5d89c2..960ed196cbb966425b2fe421239efedcd15d65db 100644 (file)
@@ -14230,6 +14230,138 @@ load_specific_debug_section (enum dwarf_section_display_enum  debug,
   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;
index a13a4c6346dada66de9ea84e542fd0e81a42201d..518f0ce5a5e6b0d02f493c7cbe31e2ab57281a96 100644 (file)
        
 /* 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.
diff --git a/config/debuginfod.m4 b/config/debuginfod.m4
new file mode 100644 (file)
index 0000000..9979abe
--- /dev/null
@@ -0,0 +1,38 @@
+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
+])
index 6a9719f60911b43a61f13bb2a267cf21941ebd84..e02123c36f488d3cda075f335563506d2dd2fb14 100755 (executable)
--- a/configure
+++ b/configure
@@ -690,6 +690,7 @@ extra_mpc_gmp_configure_flags
 extra_mpfr_configure_flags
 gmpinc
 gmplibs
+LIBDEBUGINFOD
 do_compare
 GNATMAKE
 GNATBIND
@@ -790,6 +791,7 @@ enable_libssp
 enable_libstdcxx
 enable_liboffloadmic
 enable_bootstrap
+with_debuginfod
 with_mpc
 with_mpc_include
 with_mpc_lib
@@ -1553,6 +1555,8 @@ Optional Packages:
   --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
@@ -1921,6 +1925,52 @@ fi
   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.
@@ -5433,6 +5483,92 @@ gmplibs="-lmpc -lmpfr -lgmp"
 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.
 
@@ -5587,8 +5723,7 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
   # 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
index 7433badc217f06710d5aa4ebaf580a0b2d00e5ce..544fab3d2097cb1e6bc572cc8c060baa9ec108b6 100644 (file)
@@ -23,6 +23,7 @@ m4_include(config/acx.m4)
 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])
@@ -1363,6 +1364,9 @@ gmplibs="-lmpc -lmpfr -lgmp"
 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,
index bed8292aff09b558a2df09cf9babc183aefd6240..245bd743634b5ce74e95874b0f8235857e20859b 100644 (file)
@@ -1,3 +1,42 @@
+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
index d0b8f2624a1885d83d2595474bfd78ae844f48f2..2c087e42e0de4486ce1b89d6c2d1b1d36ded1a9e 100644 (file)
@@ -3990,13 +3990,13 @@ optimize_encoding (void)
   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)))
     {
@@ -4009,20 +4009,20 @@ optimize_encoding (void)
          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
@@ -4031,9 +4031,8 @@ optimize_encoding (void)
                     && 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
@@ -4045,13 +4044,11 @@ optimize_encoding (void)
               || (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
@@ -4092,6 +4089,7 @@ optimize_encoding (void)
     }
   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
@@ -4575,6 +4573,7 @@ md_assemble (char *line)
          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 "
@@ -4593,7 +4592,7 @@ md_assemble (char *line)
   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++)
@@ -4602,6 +4601,7 @@ md_assemble (char *line)
            && (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;
          }
index a93b579b62eb0c1af036a521745400a2f0a4016a..28b0f2b3f528c7c5133f5b34f9edd009fa1770cb 100644 (file)
@@ -168,13 +168,13 @@ str_to_float48 (char *litP, int *sizeP);
 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;
 }
@@ -256,11 +256,11 @@ md_parse_option (int c, const char* arg)
       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:
@@ -443,11 +443,11 @@ md_begin (void)
             {
               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, &reg);
+              symbolS * psym = symbol_find_or_make (buf);
+             S_SET_SEGMENT (psym, reg_section);
+             symbol_set_value_expression (psym, &reg);
             }
         }
     }
@@ -586,7 +586,7 @@ z80_start_line_hook (void)
       c = get_symbol_name (&name);
       rest = input_line_pointer + 1;
 
-      if (ISSPACE(c) && colonless_labels)
+      if (ISSPACE (c) && colonless_labels)
         {
           if (c == '\n')
             {
@@ -613,7 +613,7 @@ z80_start_line_hook (void)
        len = 4;
       else
        len = 0;
-      if (len && (!ISALPHA(rest[len]) ) )
+      if (len && (!ISALPHA (rest[len])))
        {
          /* Handle assignment here.  */
          if (line_start[-1] == '\n')
@@ -722,7 +722,7 @@ static void
 wrong_mach (int ins_type)
 {
   if (ins_type & ins_err)
-    ill_op();
+    ill_op ();
   else
     as_warn (_("undocumented instruction"));
 }
@@ -781,17 +781,18 @@ is_indir (const char *s)
 
 /* 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.  */
@@ -851,17 +852,17 @@ parse_exp_not_indexed (const char *s, expressionS *op)
 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;
@@ -869,10 +870,11 @@ unify_indexed (expressionS *op)
       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;
@@ -881,7 +883,7 @@ unify_indexed (expressionS *op)
       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;
@@ -891,7 +893,7 @@ unify_indexed (expressionS *op)
   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)
 {
@@ -900,11 +902,11 @@ 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;
@@ -1048,14 +1050,14 @@ emit_data_val (expressionS * val, int size)
 
   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)
@@ -1106,9 +1108,9 @@ emit_byte (expressionS * val, bfd_reloc_code_real_type r_type)
     }
   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))
     {
@@ -1306,7 +1308,7 @@ emit_s (char prefix, char opcode, const char *args)
   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);
     }
@@ -1890,9 +1892,10 @@ emit_rst (char prefix ATTRIBUTE_UNUSED, char opcode, const char * args)
   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;
@@ -1921,9 +1924,10 @@ emit_ld_m_n(expressionS *dst, expressionS *src)
   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;
@@ -1980,12 +1984,13 @@ emit_ld_m_r(expressionS *dst, expressionS *src)
     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)
@@ -2007,15 +2012,15 @@ emit_ld_m_rr(expressionS *dst, expressionS *src)
         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;
@@ -2165,8 +2170,8 @@ emit_ld_r_r (expressionS *dst, expressionS *src)
 { /* 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)
@@ -2296,14 +2301,14 @@ emit_ld_r_r (expressionS *dst, expressionS *src)
             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;
@@ -2325,7 +2330,7 @@ emit_ld_r_r (expressionS *dst, expressionS *src)
         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:;
@@ -2341,8 +2346,8 @@ static void
 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 */
@@ -2364,15 +2369,15 @@ emit_ld_rr_m (expressionS *dst, expressionS *src)
         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;
@@ -2405,8 +2410,8 @@ static void
 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:
@@ -2489,7 +2494,7 @@ emit_lddldi (char prefix, char opcode, const char * args)
   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++ != ',')
@@ -2561,7 +2566,7 @@ emit_ldh (char prefix ATTRIBUTE_UNUSED, char opcode ATTRIBUTE_UNUSED,
               *q = 0xE2;
             }
           else
-            ill_op();
+            ill_op ();
         }
       else
         {
@@ -2643,10 +2648,10 @@ emit_lea (char prefix, char opcode, const char * args)
   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);
@@ -2693,7 +2698,7 @@ emit_pea (char prefix, char opcode, const char * args)
   /* 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;
@@ -2710,9 +2715,9 @@ static const char *
 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 *
@@ -2727,7 +2732,7 @@ emit_tst (char prefix, char opcode, const char *args)
   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);
     }
@@ -2776,7 +2781,7 @@ emit_tstio (char prefix, char opcode, const char *args)
   q = frag_more (2);
   *q++ = prefix;
   *q = opcode;
-  emit_byte(& arg, BFD_RELOC_8);
+  emit_byte (& arg, BFD_RELOC_8);
 
   return p;
 }
@@ -2878,7 +2883,7 @@ assume (int arg ATTRIBUTE_UNUSED)
 
   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;
@@ -2990,12 +2995,12 @@ assemble_suffix (const char **suffix)
 
   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;
@@ -3026,7 +3031,7 @@ assemble_suffix (const char **suffix)
         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;
@@ -3252,7 +3257,7 @@ md_assemble (char *str)
     {
       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;
@@ -3267,7 +3272,7 @@ md_assemble (char *str)
       if (!insp || (insp->inss && !(insp->inss & ins_ok)))
         {
           as_bad (_("Unknown instruction '%s'"), buf);
-          *frag_more(1) = 0;
+          *frag_more (1) = 0;
         }
       else
        {
@@ -3466,21 +3471,21 @@ str_to_broken_float (bfd_boolean *signP, bfd_uint64_t *mantissaP, int *expP)
   *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)
        {
@@ -3491,15 +3496,15 @@ str_to_broken_float (bfd_boolean *signP, bfd_uint64_t *mantissaP, int *expP)
       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)
                {
@@ -3510,7 +3515,7 @@ str_to_broken_float (bfd_boolean *signP, bfd_uint64_t *mantissaP, int *expP)
              mantissa = mantissa * 10 + (*p - '0');
            }
        }
-      for (; ISDIGIT(*p); ++p)
+      for (; ISDIGIT (*p); ++p)
        ;
     }
   if (*p == 'e' || *p == 'E')
@@ -3521,14 +3526,14 @@ str_to_broken_float (bfd_boolean *signP, bfd_uint64_t *mantissaP, int *expP)
       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)
@@ -3540,10 +3545,8 @@ str_to_broken_float (bfd_boolean *signP, bfd_uint64_t *mantissaP, int *expP)
   /* 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 */
index f8e1832ad104561f49c7bdc0520b29bdccb7cc47..1924abf7e751207cdc39faebb41dceadf83ca7cd 100644 (file)
@@ -1,6 +1,6 @@
 
 foo:
-.section foo, "a"
+ .section foo, "a"
 
-.section bar, "a"
+ .section bar, "a"
 bar:
index 081f3af11c8aa95d14c8d8f5afc18b9512a6f980..979e3ddfa1a956a4bdc8f7390d9bd759295af9d2 100644 (file)
@@ -1,2 +1,3 @@
 #name: unsupported .symver with common symbol
+#notarget: *-*-hpux*
 #error_output: pr21661.l
index 6ee486f38a921f5dfc0fbb377005c258a6c71bc0..4c886d56a1f3aaae51a4418dabf3aa5c8aa655ca 100644 (file)
@@ -724,6 +724,10 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
     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"
diff --git a/gas/testsuite/gas/i386/x86-64-sysenter-amd.d b/gas/testsuite/gas/i386/x86-64-sysenter-amd.d
new file mode 100644 (file)
index 0000000..5b2fc37
--- /dev/null
@@ -0,0 +1,14 @@
+#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
diff --git a/gas/testsuite/gas/i386/x86-64-sysenter-amd.l b/gas/testsuite/gas/i386/x86-64-sysenter-amd.l
new file mode 100644 (file)
index 0000000..faa2562
--- /dev/null
@@ -0,0 +1,5 @@
+.*: Assembler messages:
+.*:2: Error: .*
+.*:3: Error: .*
+.*:6: Error: .*
+.*:7: Error: .*
diff --git a/gas/testsuite/gas/i386/x86-64-sysenter-amd.s b/gas/testsuite/gas/i386/x86-64-sysenter-amd.s
new file mode 100644 (file)
index 0000000..b6d31f9
--- /dev/null
@@ -0,0 +1,7 @@
+       .text
+       sysenter
+       sysexit
+
+       .intel_syntax noprefix
+       sysenter
+       sysexit
diff --git a/gas/testsuite/gas/i386/x86-64-sysenter-intel.d b/gas/testsuite/gas/i386/x86-64-sysenter-intel.d
new file mode 100644 (file)
index 0000000..ffd5e3e
--- /dev/null
@@ -0,0 +1,15 @@
+#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
diff --git a/gas/testsuite/gas/i386/x86-64-sysenter-mixed.d b/gas/testsuite/gas/i386/x86-64-sysenter-mixed.d
new file mode 100644 (file)
index 0000000..034f1cb
--- /dev/null
@@ -0,0 +1,6 @@
+#as: -mintel64
+#objdump: -dw
+#name: x86-64 sysenter (Intel64/Default)
+#source: x86-64-sysenter-amd.s
+#dump: x86-64-sysenter-intel.d
+
index b10989a410d877aaf760780db55a7464b0ba0cb7..425bafa9b26a55133a020a31fca8649511490ec3 100644 (file)
@@ -1,3 +1,33 @@
+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)
index 88b05ef723c6d609a1eeb964381687d73d6e355e..214bca1ee17e10d22b73143c641f0c03df10003e 100644 (file)
    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
 
index 5274b88f7ab538fe1d918c40b5021d46a94de557..cdd9f2e4c12c737b74f1a7eda33111039e8a8769 100644 (file)
@@ -892,6 +892,16 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
           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.
@@ -914,15 +924,9 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
       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
index 3f243641b8b02df6327ee6ef4d56c3526718a037..536a9649595535c5f60c723f99442c18c48d99b5 100644 (file)
@@ -1,3 +1,37 @@
+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.
index d7dd3cedbecc79ab19b10e74f0324a9c50fa062c..513c9fcc82eabca70f621c8449c2acfa0b798dc8 100644 (file)
@@ -144,7 +144,8 @@ with_test_prefix "step after disabling 3" {
     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"
 }
@@ -265,7 +266,8 @@ with_test_prefix "step using -fu for baz" {
     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"
 }
@@ -282,7 +284,8 @@ with_test_prefix "step using -rfu for baz" {
     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"
 }
index c3a3fdd4f5e45490b802ce94725e1df2dbd35a51..34e60384c4ede1fbf235173b97119ccd1daf1422 100644 (file)
@@ -35,6 +35,46 @@ gdb_assert {![string match "No Source Available" $text]} \
 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"
diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm.exp b/gdb/testsuite/gdb.tui/tui-layout-asm.exp
new file mode 100644 (file)
index 0000000..cec2735
--- /dev/null
@@ -0,0 +1,34 @@
+# 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>"
index 6f3d41f1ccba93e407ae98d3b13f2b77b6394bfd..7adaf1b71ab8a8ee4da1f7217ef01d1324cd7988 100644 (file)
@@ -388,8 +388,10 @@ namespace eval Term {
        _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
@@ -424,7 +426,7 @@ namespace eval Term {
                timeout {
                    # Assume a timeout means we somehow missed the
                    # expected result, and carry on.
-                   return
+                   return 0
                }
            }
 
@@ -443,6 +445,8 @@ namespace eval Term {
                set wait_for $prompt_wait_for
            }
        }
+
+       return 1
     }
 
     # Like ::clean_restart, but ensures that gdb starts in an
@@ -462,15 +466,25 @@ namespace eval Term {
        }
     }
 
-    # 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
     }
@@ -480,7 +494,7 @@ namespace eval Term {
     # 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
@@ -590,15 +604,46 @@ namespace eval Term {
        }
     }
 
+    # 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]"
        }
     }
 
@@ -641,14 +686,14 @@ namespace eval Term {
        # 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
     }
 }
index f171e2e3b634de110768981d0a1fa133998470c3..4959f938c7f33dd4fc5328803db8e8dc9c838f23 100644 (file)
@@ -1090,85 +1090,85 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
 
     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
index 1503cd4c63608f3db23965e36488280e5a4762da..912eaa4544018b44988a55373149d561500c4fb1 100644 (file)
@@ -136,26 +136,31 @@ tui_source_window::do_scroll_vertical (int num_to_scroll)
 {
   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);
     }
 }
 
index 7ff5825ece223eaa354c312d721331923e07abf5..99d30a55a153338e64399410da7461a11633f3ae 100644 (file)
@@ -489,10 +489,6 @@ tui_enable (void)
      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 ();
 
@@ -513,6 +509,12 @@ tui_enable (void)
   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);
 
index cd0410494d89400358d7d0758fff132e318ac2bd..91765c5be61c29352e4509b3a0b19942660ef1f9 100644 (file)
@@ -1,3 +1,12 @@
+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'.
index 50dce8a9003fa9bf64adcc7a90e377d3a15487d9..d8505ef6da35ae46f908a73554d7d5ef2270cc86 100644 (file)
@@ -87,39 +87,42 @@ struct spu_opcode
    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))
 
index 011943d55a8ded64d63094e1836b3f79bd062168..68538bd0392ab38058a9a64f1dc5304131d48b4f 100644 (file)
@@ -1,3 +1,36 @@
+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
index ce27e0e0b89249edda9841364834b8090a8185da..5d24fb5cecf42ef5d4b28d2845d13b862e99933d 100644 (file)
@@ -107,6 +107,7 @@ static void OP_3DNowSuffix (int, int);
 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);
@@ -412,6 +413,7 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr)
 #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 }
@@ -2713,8 +2715,8 @@ static const struct dis386 dis386_twobyte[] = {
   { "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 */
@@ -11316,7 +11318,7 @@ static char scale_char;
 
 enum x86_64_isa
 {
-  amd64 = 0,
+  amd64 = 1,
   intel64
 };
 
@@ -14829,12 +14831,12 @@ OP_J (int bytemode, int sizeflag)
        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
@@ -14852,7 +14854,7 @@ OP_J (int bytemode, int sizeflag)
                       & ~((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:
@@ -15602,6 +15604,18 @@ REP_Fixup (int bytemode, int sizeflag)
     }
 }
 
+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".  */
 
index 07c5a6457867681347dc1a712ba58bf9301b3197..4b39c7a38edd68b82aaba2488786cc5d1749a442 100644 (file)
@@ -904,8 +904,10 @@ rdmsr, 0, 0xf32, None, 2, Cpu586, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldS
 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 }
index 7af7a79f5a16f06ad3114ff66f8615a11fb507dd..0af5119f67ed9c94a1deeb462f41659c82173d0c 100644 (file)
@@ -7805,7 +7805,19 @@ const insn_template i386_optab[] =
         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,
@@ -7817,7 +7829,19 @@ const insn_template i386_optab[] =
         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,
index 4f5006a4e9441d17c0c1e1076e28699d4414f784..537ce46ae02d736652c75ca2055c3925469524ee 100644 (file)
@@ -83,16 +83,18 @@ disassemble (bfd_vma memaddr,
 
              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))
@@ -106,18 +108,10 @@ disassemble (bfd_vma memaddr,
              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");
index 2362518b6234df018c5ee404ab0542399468ecc3..00210c25cd359a67c3316d72a832fbe360efbc92 100644 (file)
@@ -318,7 +318,13 @@ disassemble (bfd_vma memaddr,
              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;
 
@@ -410,18 +416,10 @@ disassemble (bfd_vma memaddr,
              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");
@@ -434,8 +432,6 @@ disassemble (bfd_vma memaddr,
 
              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)
@@ -446,8 +442,6 @@ disassemble (bfd_vma memaddr,
 
              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
index f49dae5de39c6e092613740752167f9ff33ad039..a122f49abc92ceea2363cbf137d4b4b92ec10484 100644 (file)
@@ -8096,21 +8096,18 @@ parse_insn_tilegx (tilegx_bundle_bits bits,
        {
          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;
index 6449945aa4f4388d5cb973452030b180ccee5e62..dbe0605e0c6e4d9960cc473758a5588a972961e0 100644 (file)
@@ -10215,7 +10215,7 @@ parse_insn_tilepro (tilepro_bundle_bits bits,
        {
          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)
            {
@@ -10226,10 +10226,7 @@ parse_insn_tilepro (tilepro_bundle_bits bits,
 
          /* 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;
index 581d4f4871249aaf883ddf771c775bebfc7acb55..b6f0606a17a21edd7d0ea22ec36a3b424d1ba987 100644 (file)
@@ -82,7 +82,7 @@ fetch_data (struct buffer *buf, disassemble_info * info, int n)
 {
   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,
@@ -470,9 +470,9 @@ pref_ed (struct buffer *buf, disassemble_info *info,
 {
   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);
     }
@@ -585,7 +585,7 @@ ld_r_d (struct buffer *buf, disassemble_info * info, const char *txt)
 }
 
 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;
@@ -596,14 +596,14 @@ ld_d_r(struct buffer *buf, disassemble_info * info, const char *txt)
 }
 
 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 */
@@ -858,7 +858,7 @@ print_insn_z80_buf (struct buffer *buf, disassemble_info *info)
   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);
 
This page took 0.093412 seconds and 4 git commands to generate.