]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - binutils/readelf.c
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / binutils / readelf.c
index c3cbd2cb235584d8aa4f4f74874e03d3097c152f..f6945d9552f88a8300a29328a036a19530764ea1 100644 (file)
@@ -1,5 +1,5 @@
 /* readelf.c -- display contents of an ELF format file
-   Copyright (C) 1998-2020 Free Software Foundation, Inc.
+   Copyright (C) 1998-2021 Free Software Foundation, Inc.
 
    Originally developed by Eric Youngdale <eric@andante.jic.com>
    Modifications by Nick Clifton <nickc@redhat.com>
@@ -61,6 +61,7 @@
 #include "elfcomm.h"
 #include "dwarf.h"
 #include "ctf-api.h"
+#include "demangle.h"
 
 #include "elf/common.h"
 #include "elf/external.h"
@@ -215,6 +216,7 @@ static bfd_boolean show_name = FALSE;
 static bfd_boolean do_dynamic = FALSE;
 static bfd_boolean do_syms = FALSE;
 static bfd_boolean do_dyn_syms = FALSE;
+static bfd_boolean do_lto_syms = FALSE;
 static bfd_boolean do_reloc = FALSE;
 static bfd_boolean do_sections = FALSE;
 static bfd_boolean do_section_groups = FALSE;
@@ -235,6 +237,8 @@ static bfd_boolean check_all = FALSE;
 static bfd_boolean is_32bit_elf = FALSE;
 static bfd_boolean decompress_dumps = FALSE;
 static bfd_boolean do_not_show_symbol_truncation = FALSE;
+static bfd_boolean do_demangle = FALSE;        /* Pretty print C++ symbol names.  */
+static int demangle_flags = DMGL_ANSI | DMGL_PARAMS;
 
 static char *dump_ctf_parent_name;
 static char *dump_ctf_symtab_name;
@@ -331,11 +335,19 @@ static const char * get_symbol_version_string
 
 #define UNKNOWN -1
 
-#define SECTION_NAME(X)                                                \
-  ((X) == NULL ? _("<none>")                                   \
-   : filedata->string_table == NULL ? _("<no-strings>")                \
-   : ((X)->sh_name >= filedata->string_table_length ? _("<corrupt>")   \
-  : filedata->string_table + (X)->sh_name))
+#define SECTION_NAME(X) \
+  (filedata->string_table + (X)->sh_name)
+
+#define SECTION_NAME_VALID(X) \
+  ((X) != NULL                                                         \
+   && filedata->string_table != NULL                                   \
+   && (X)->sh_name < filedata->string_table_length)
+
+#define SECTION_NAME_PRINT(X) \
+  ((X) == NULL ? _("<none>")                                           \
+   : filedata->string_table == NULL ? _("<no-strings>")                        \
+   : (X)->sh_name >= filedata->string_table_length ? _("<corrupt>")    \
+   : filedata->string_table + (X)->sh_name)
 
 #define DT_VERSIONTAGIDX(tag)  (DT_VERNEEDNUM - (tag)) /* Reverse order!  */
 
@@ -552,6 +564,7 @@ print_symbol (signed int width, const char * symbol)
   mbstate_t state;
 #endif
   unsigned int width_remaining;
+  const void * alloced_symbol = NULL;
 
   if (width < 0)
     {
@@ -584,6 +597,14 @@ print_symbol (signed int width, const char * symbol)
   memset (& state, 0, sizeof (state));
 #endif
 
+  if (do_demangle && *symbol)
+    {
+      const char * res = cplus_demangle (symbol, demangle_flags);
+
+      if (res != NULL)
+       alloced_symbol = symbol = res;
+    }
+
   while (width_remaining)
     {
       size_t  n;
@@ -643,6 +664,7 @@ print_symbol (signed int width, const char * symbol)
       num_printed = width;
     }
 
+  free ((void *) alloced_symbol);
   return num_printed;
 }
 
@@ -655,7 +677,7 @@ printable_section_name (Filedata * filedata, const Elf_Internal_Shdr * sec)
 {
 #define MAX_PRINT_SEC_NAME_LEN 128
   static char  sec_name_buf [MAX_PRINT_SEC_NAME_LEN + 1];
-  const char * name = SECTION_NAME (sec);
+  const char * name = SECTION_NAME_PRINT (sec);
   char *       buf = sec_name_buf;
   char         c;
   unsigned int remaining = MAX_PRINT_SEC_NAME_LEN;
@@ -717,7 +739,8 @@ find_section (Filedata * filedata, const char * name)
     return NULL;
 
   for (i = 0; i < filedata->file_header.e_shnum; i++)
-    if (streq (SECTION_NAME (filedata->section_headers + i), name))
+    if (SECTION_NAME_VALID (filedata->section_headers + i)
+       && streq (SECTION_NAME (filedata->section_headers + i), name))
       return filedata->section_headers + i;
 
   return NULL;
@@ -783,7 +806,8 @@ find_section_in_set (Filedata * filedata, const char * name, unsigned int * set)
          if (i >= filedata->file_header.e_shnum)
            continue; /* FIXME: Should we issue an error message ?  */
 
-         if (streq (SECTION_NAME (filedata->section_headers + i), name))
+         if (SECTION_NAME_VALID (filedata->section_headers + i)
+             && streq (SECTION_NAME (filedata->section_headers + i), name))
            return filedata->section_headers + i;
        }
     }
@@ -1268,32 +1292,10 @@ dump_relocations (Filedata *          filedata,
        }
       else
        {
-#if BFD_HOST_64BIT_LONG
          printf (do_wide
-                 ? "%16.16lx  %16.16lx "
-                 : "%12.12lx  %12.12lx ",
+                 ? "%16.16" BFD_VMA_FMT "x  %16.16" BFD_VMA_FMT "x "
+                 : "%12.12" BFD_VMA_FMT "x  %12.12" BFD_VMA_FMT "x ",
                  offset, inf);
-#elif BFD_HOST_64BIT_LONG_LONG
-#ifndef __MSVCRT__
-         printf (do_wide
-                 ? "%16.16llx  %16.16llx "
-                 : "%12.12llx  %12.12llx ",
-                 offset, inf);
-#else
-         printf (do_wide
-                 ? "%16.16I64x  %16.16I64x "
-                 : "%12.12I64x  %12.12I64x ",
-                 offset, inf);
-#endif
-#else
-         printf (do_wide
-                 ? "%8.8lx%8.8lx  %8.8lx%8.8lx "
-                 : "%4.4lx%8.8lx  %4.4lx%8.8lx ",
-                 _bfd_int64_high (offset),
-                 _bfd_int64_low (offset),
-                 _bfd_int64_high (inf),
-                 _bfd_int64_low (inf));
-#endif
        }
 
       switch (filedata->file_header.e_machine)
@@ -1737,7 +1739,8 @@ dump_relocations (Filedata *          filedata,
                  if (ELF_ST_TYPE (psym->st_info) == STT_SECTION)
                    {
                      if (psym->st_shndx < filedata->file_header.e_shnum)
-                       sec_name = SECTION_NAME (filedata->section_headers + psym->st_shndx);
+                       sec_name = SECTION_NAME_PRINT (filedata->section_headers
+                                                      + psym->st_shndx);
                      else if (psym->st_shndx == SHN_ABS)
                        sec_name = "ABS";
                      else if (psym->st_shndx == SHN_COMMON)
@@ -2229,6 +2232,7 @@ get_dynamic_type (Filedata * filedata, unsigned long type)
     case DT_GNU_LIBLIST: return "GNU_LIBLIST";
     case DT_GNU_LIBLISTSZ: return "GNU_LIBLISTSZ";
     case DT_GNU_HASH:  return "GNU_HASH";
+    case DT_GNU_FLAGS_1: return "GNU_FLAGS_1";
 
     default:
       if ((type >= DT_LOPROC) && (type <= DT_HIPROC))
@@ -2560,10 +2564,26 @@ get_machine_name (unsigned e_machine)
     case EM_FT32:               return "FTDI Chip FT32";
     case EM_MOXIE:              return "Moxie";
     case EM_AMDGPU:            return "AMD GPU";
+      /* 230 (all reserved) */
+      /* 240 */
     case EM_RISCV:             return "RISC-V";
     case EM_LANAI:             return "Lanai 32-bit processor";
+    case EM_CEVA:              return "CEVA Processor Architecture Family";
+    case EM_CEVA_X2:           return "CEVA X2 Processor Family";
     case EM_BPF:               return "Linux BPF";
+    case EM_GRAPHCORE_IPU:     return "Graphcore Intelligent Processing Unit";
+    case EM_IMG1:              return "Imagination Technologies";
+      /* 250 */
     case EM_NFP:               return "Netronome Flow Processor";
+    case EM_VE:                        return "NEC Vector Engine";
+    case EM_CSKY:              return "C-SKY";
+    case EM_ARC_COMPACT3_64:   return "Synopsys ARCv2.3 64-bit";
+    case EM_MCS6502:           return "MOS Technology MCS 6502 processor";
+    case EM_ARC_COMPACT3:      return "Synopsys ARCv2.3 32-bit";
+    case EM_KVX:               return "Kalray VLIW core of the MPPA processor family";
+    case EM_65816:             return "WDC 65816/65C816";
+    case EM_LOONGARCH:         return "Loongson Loongarch";
+    case EM_KF32:              return "ChipON KungFu32";
 
       /* Large numbers...  */
     case EM_MT:                 return "Morpho Techologies MT processor";
@@ -2578,7 +2598,6 @@ get_machine_name (unsigned e_machine)
     case EM_ADAPTEVA_EPIPHANY: return "Adapteva EPIPHANY";
     case EM_CYGNUS_FRV:                return "Fujitsu FR-V";
     case EM_S12Z:               return "Freescale S12Z";
-    case EM_CSKY:              return "C-SKY";
 
     default:
       snprintf (buff, sizeof (buff), _("<unknown>: 0x%x"), e_machine);
@@ -4039,6 +4058,10 @@ get_segment_type (Filedata * filedata, unsigned long p_type)
     case PT_GNU_RELRO:  return "GNU_RELRO";
     case PT_GNU_PROPERTY: return "GNU_PROPERTY";
 
+    case PT_OPENBSD_RANDOMIZE: return "OPENBSD_RANDOMIZE";
+    case PT_OPENBSD_WXNEEDED: return "OPENBSD_WXNEEDED";
+    case PT_OPENBSD_BOOTDATA: return "OPENBSD_BOOTDATA";
+
     default:
       if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
        {
@@ -4272,7 +4295,7 @@ get_tic6x_section_type_name (unsigned int sh_type)
 }
 
 static const char *
-get_msp430x_section_type_name (unsigned int sh_type)
+get_msp430_section_type_name (unsigned int sh_type)
 {
   switch (sh_type)
     {
@@ -4319,6 +4342,16 @@ get_riscv_section_type_name (unsigned int sh_type)
     }
 }
 
+static const char *
+get_csky_section_type_name (unsigned int sh_type)
+{
+  switch (sh_type)
+    {
+    case SHT_CSKY_ATTRIBUTES:  return "CSKY_ATTRIBUTES";
+    default:  return NULL;
+    }
+}
+
 static const char *
 get_section_type_name (Filedata * filedata, unsigned int sh_type)
 {
@@ -4389,7 +4422,7 @@ get_section_type_name (Filedata * filedata, unsigned int sh_type)
              result = get_tic6x_section_type_name (sh_type);
              break;
            case EM_MSP430:
-             result = get_msp430x_section_type_name (sh_type);
+             result = get_msp430_section_type_name (sh_type);
              break;
            case EM_NFP:
              result = get_nfp_section_type_name (sh_type);
@@ -4402,6 +4435,9 @@ get_section_type_name (Filedata * filedata, unsigned int sh_type)
            case EM_RISCV:
              result = get_riscv_section_type_name (sh_type);
              break;
+           case EM_CSKY:
+             result = get_csky_section_type_name (sh_type);
+             break;
            default:
              result = NULL;
              break;
@@ -4471,67 +4507,78 @@ get_section_type_name (Filedata * filedata, unsigned int sh_type)
     }
 }
 
-#define OPTION_DEBUG_DUMP      512
-#define OPTION_DYN_SYMS                513
-#define OPTION_DWARF_DEPTH     514
-#define OPTION_DWARF_START     515
-#define OPTION_DWARF_CHECK     516
-#define OPTION_CTF_DUMP                517
-#define OPTION_CTF_PARENT      518
-#define OPTION_CTF_SYMBOLS     519
-#define OPTION_CTF_STRINGS     520
+enum long_option_values
+{
+  OPTION_DEBUG_DUMP = 512,
+  OPTION_DYN_SYMS,
+  OPTION_LTO_SYMS,
+  OPTION_DWARF_DEPTH,
+  OPTION_DWARF_START,
+  OPTION_DWARF_CHECK,
+  OPTION_CTF_DUMP,
+  OPTION_CTF_PARENT,
+  OPTION_CTF_SYMBOLS,
+  OPTION_CTF_STRINGS,
+  OPTION_WITH_SYMBOL_VERSIONS,
+  OPTION_RECURSE_LIMIT,
+  OPTION_NO_RECURSE_LIMIT,
+  OPTION_NO_DEMANGLING
+};
 
 static struct option options[] =
 {
+ /* Note - This table is alpha-sorted on the 'val'
+    field in order to make adding new options easier.  */
+  {"arch-specific",    no_argument, 0, 'A'},
   {"all",             no_argument, 0, 'a'},
-  {"file-header",      no_argument, 0, 'h'},
-  {"program-headers",  no_argument, 0, 'l'},
+  {"demangle",         optional_argument, 0, 'C'},
+  {"archive-index",    no_argument, 0, 'c'},
+  {"use-dynamic",      no_argument, 0, 'D'},
+  {"dynamic",         no_argument, 0, 'd'},
   {"headers",         no_argument, 0, 'e'},
+  {"section-groups",   no_argument, 0, 'g'},
+  {"help",            no_argument, 0, 'H'},
+  {"file-header",      no_argument, 0, 'h'},
   {"histogram",               no_argument, 0, 'I'},
+  {"lint",             no_argument, 0, 'L'},
+  {"enable-checks",    no_argument, 0, 'L'},
+  {"program-headers",  no_argument, 0, 'l'},
   {"segments",        no_argument, 0, 'l'},
-  {"sections",        no_argument, 0, 'S'},
-  {"section-headers",  no_argument, 0, 'S'},
-  {"section-groups",   no_argument, 0, 'g'},
-  {"section-details",  no_argument, 0, 't'},
   {"full-section-name",no_argument, 0, 'N'},
+  {"notes",           no_argument, 0, 'n'},
+  {"string-dump",      required_argument, 0, 'p'},
+  {"relocated-dump",   required_argument, 0, 'R'},
+  {"relocs",          no_argument, 0, 'r'},
+  {"section-headers",  no_argument, 0, 'S'},
+  {"sections",        no_argument, 0, 'S'},
   {"symbols",         no_argument, 0, 's'},
   {"syms",            no_argument, 0, 's'},
-  {"dyn-syms",        no_argument, 0, OPTION_DYN_SYMS},
-  {"relocs",          no_argument, 0, 'r'},
-  {"notes",           no_argument, 0, 'n'},
-  {"dynamic",         no_argument, 0, 'd'},
-  {"lint",             no_argument, 0, 'L'},
-  {"enable-checks",    no_argument, 0, 'L'},
-  {"arch-specific",    no_argument, 0, 'A'},
-  {"version-info",     no_argument, 0, 'V'},
-  {"use-dynamic",      no_argument, 0, 'D'},
+  {"silent-truncation",no_argument, 0, 'T'},
+  {"section-details",  no_argument, 0, 't'},
   {"unwind",          no_argument, 0, 'u'},
-  {"archive-index",    no_argument, 0, 'c'},
+  {"version-info",     no_argument, 0, 'V'},
+  {"version",         no_argument, 0, 'v'},
+  {"wide",            no_argument, 0, 'W'},
   {"hex-dump",        required_argument, 0, 'x'},
-  {"relocated-dump",   required_argument, 0, 'R'},
-  {"string-dump",      required_argument, 0, 'p'},
   {"decompress",       no_argument, 0, 'z'},
-#ifdef SUPPORT_DISASSEMBLY
-  {"instruction-dump", required_argument, 0, 'i'},
-#endif
-  {"debug-dump",       optional_argument, 0, OPTION_DEBUG_DUMP},
 
+  {"no-demangle",      no_argument, 0, OPTION_NO_DEMANGLING},
+  {"recurse-limit",    no_argument, NULL, OPTION_RECURSE_LIMIT},
+  {"no-recurse-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
+  {"no-recursion-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
+  {"dyn-syms",        no_argument, 0, OPTION_DYN_SYMS},
+  {"lto-syms",         no_argument, 0, OPTION_LTO_SYMS},
+  {"debug-dump",       optional_argument, 0, OPTION_DEBUG_DUMP},
   {"dwarf-depth",      required_argument, 0, OPTION_DWARF_DEPTH},
   {"dwarf-start",      required_argument, 0, OPTION_DWARF_START},
   {"dwarf-check",      no_argument, 0, OPTION_DWARF_CHECK},
-
 #ifdef ENABLE_LIBCTF
   {"ctf",             required_argument, 0, OPTION_CTF_DUMP},
-
   {"ctf-symbols",      required_argument, 0, OPTION_CTF_SYMBOLS},
   {"ctf-strings",      required_argument, 0, OPTION_CTF_STRINGS},
   {"ctf-parent",       required_argument, 0, OPTION_CTF_PARENT},
 #endif
 
-  {"version",         no_argument, 0, 'v'},
-  {"wide",            no_argument, 0, 'W'},
-  {"silent-truncation",no_argument, 0, 'T'},
-  {"help",            no_argument, 0, 'H'},
   {0,                 no_argument, 0, 0}
 };
 
@@ -4553,6 +4600,14 @@ usage (FILE * stream)
   -s --syms              Display the symbol table\n\
      --symbols           An alias for --syms\n\
      --dyn-syms          Display the dynamic symbol table\n\
+     --lto-syms          Display LTO symbol tables\n\
+  -C --demangle[=STYLE]  Decode low-level symbol names into user-level names\n\
+                          The STYLE, if specified, can be `auto' (the default),\n\
+                          `gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n\
+                          or `gnat'\n\
+     --no-demangle       Do not demangle low-level symbol names.  (This is the default)\n\
+     --recurse-limit     Enable a demangling recursion limit.  (This is the default)\n\
+     --no-recurse-limit  Disable a demangling recursion limit\n\
   -n --notes             Display the core notes (if present)\n\
   -r --relocs            Display the relocations (if present)\n\
   -u --unwind            Display the unwind info (if present)\n\
@@ -4693,7 +4748,7 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
     usage (stderr);
 
   while ((c = getopt_long
-         (argc, argv, "ADHILNR:STVWacdeghi:lnp:rstuvw::x:z", options, NULL)) != EOF)
+         (argc, argv, "ACDHILNR:STVWacdeghi:lnp:rstuvw::x:z", options, NULL)) != EOF)
     {
       switch (c)
        {
@@ -4718,6 +4773,7 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
          do_arch = TRUE;
          do_notes = TRUE;
          break;
+
        case 'g':
          do_section_groups = TRUE;
          break;
@@ -4784,7 +4840,7 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
          break;
        case 'w':
          do_dump = TRUE;
-         if (optarg == 0)
+         if (optarg == NULL)
            {
              do_debugging = TRUE;
              dwarf_select_sections_all ();
@@ -4797,7 +4853,7 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
          break;
        case OPTION_DEBUG_DUMP:
          do_dump = TRUE;
-         if (optarg == 0)
+         if (optarg == NULL)
            do_debugging = TRUE;
          else
            {
@@ -4841,6 +4897,9 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
        case OPTION_DYN_SYMS:
          do_dyn_syms = TRUE;
          break;
+       case OPTION_LTO_SYMS:
+         do_lto_syms = TRUE;
+         break;
 #ifdef SUPPORT_DISASSEMBLY
        case 'i':
          request_dump (dumpdata, DISASS_DUMP);
@@ -4858,6 +4917,32 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
        case 'T':
          do_not_show_symbol_truncation = TRUE;
          break;
+       case 'C':
+         do_demangle = TRUE;
+         if (optarg != NULL)
+           {
+             enum demangling_styles style;
+
+             style = cplus_demangle_name_to_style (optarg);
+             if (style == unknown_demangling)
+               error (_("unknown demangling style `%s'"), optarg);
+
+             cplus_demangle_set_style (style);
+           }
+         break;
+       case OPTION_NO_DEMANGLING:
+         do_demangle = FALSE;
+         break;
+       case OPTION_RECURSE_LIMIT:
+         demangle_flags &= ~ DMGL_NO_RECURSE_LIMIT;
+         break;
+       case OPTION_NO_RECURSE_LIMIT:
+         demangle_flags |= DMGL_NO_RECURSE_LIMIT;
+         break;
+       case OPTION_WITH_SYMBOL_VERSIONS:
+         /* Ignored for backward compatibility.  */
+         break;
+
        default:
          /* xgettext:c-format */
          error (_("Invalid option '-%c'\n"), c);
@@ -4871,7 +4956,7 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
       && !do_segments && !do_header && !do_dump && !do_version
       && !do_histogram && !do_debugging && !do_arch && !do_notes
       && !do_section_groups && !do_archive_index
-      && !do_dyn_syms)
+      && !do_dyn_syms && !do_lto_syms)
     {
       if (do_checks)
        {
@@ -4880,6 +4965,7 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
          do_segments = do_header = do_dump = do_version = TRUE;
          do_histogram = do_debugging = do_arch = do_notes = TRUE;
          do_section_groups = do_archive_index = do_dyn_syms = TRUE;
+         do_lto_syms = TRUE;
        }
       else
        usage (stderr);
@@ -5926,6 +6012,8 @@ get_elf_section_flags (Filedata * filedata, bfd_vma sh_flags)
       /* 24 */ { STRING_COMMA_LEN ("GNU_MBIND") },
       /* VLE specific.  */
       /* 25 */ { STRING_COMMA_LEN ("VLE") },
+      /* GNU specific.  */
+      /* 26 */ { STRING_COMMA_LEN ("GNU_RETAIN") },
     };
 
   if (do_section_details)
@@ -5958,7 +6046,6 @@ get_elf_section_flags (Filedata * filedata, bfd_vma sh_flags)
            case SHF_TLS:               sindex = 9; break;
            case SHF_EXCLUDE:           sindex = 18; break;
            case SHF_COMPRESSED:        sindex = 20; break;
-           case SHF_GNU_MBIND:         sindex = 24; break;
 
            default:
              sindex = -1;
@@ -6010,10 +6097,28 @@ get_elf_section_flags (Filedata * filedata, bfd_vma sh_flags)
                  if (flag == SHF_PPC_VLE)
                    sindex = 25;
                  break;
+               default:
+                 break;
+               }
 
+             switch (filedata->file_header.e_ident[EI_OSABI])
+               {
+               case ELFOSABI_GNU:
+               case ELFOSABI_FREEBSD:
+                 if (flag == SHF_GNU_RETAIN)
+                   sindex = 26;
+                 /* Fall through */
+               case ELFOSABI_NONE:
+                 if (flag == SHF_GNU_MBIND)
+                   /* We should not recognize SHF_GNU_MBIND for
+                      ELFOSABI_NONE, but binutils as of 2019-07-23 did
+                      not set the EI_OSABI header byte.  */
+                   sindex = 24;
+                 break;
                default:
                  break;
                }
+             break;
            }
 
          if (sindex != -1)
@@ -6056,7 +6161,6 @@ get_elf_section_flags (Filedata * filedata, bfd_vma sh_flags)
            case SHF_TLS:               *p = 'T'; break;
            case SHF_EXCLUDE:           *p = 'E'; break;
            case SHF_COMPRESSED:        *p = 'C'; break;
-           case SHF_GNU_MBIND:         *p = 'D'; break;
 
            default:
              if ((filedata->file_header.e_machine == EM_X86_64
@@ -6066,14 +6170,37 @@ get_elf_section_flags (Filedata * filedata, bfd_vma sh_flags)
                *p = 'l';
              else if (filedata->file_header.e_machine == EM_ARM
                       && flag == SHF_ARM_PURECODE)
-                 *p = 'y';
+               *p = 'y';
              else if (filedata->file_header.e_machine == EM_PPC
                       && flag == SHF_PPC_VLE)
-                 *p = 'v';
+               *p = 'v';
              else if (flag & SHF_MASKOS)
                {
-                 *p = 'o';
-                 sh_flags &= ~ SHF_MASKOS;
+                 switch (filedata->file_header.e_ident[EI_OSABI])
+                   {
+                   case ELFOSABI_GNU:
+                   case ELFOSABI_FREEBSD:
+                     if (flag == SHF_GNU_RETAIN)
+                       {
+                         *p = 'R';
+                         break;
+                       }
+                     /* Fall through */
+                   case ELFOSABI_NONE:
+                     if (flag == SHF_GNU_MBIND)
+                       {
+                         /* We should not recognize SHF_GNU_MBIND for
+                            ELFOSABI_NONE, but binutils as of 2019-07-23 did
+                            not set the EI_OSABI header byte.  */
+                         *p = 'D';
+                         break;
+                       }
+                     /* Fall through */
+                   default:
+                     *p = 'o';
+                     sh_flags &= ~SHF_MASKOS;
+                     break;
+                   }
                }
              else if (flag & SHF_MASKPROC)
                {
@@ -6335,7 +6462,7 @@ process_section_headers (Filedata * filedata)
        i < filedata->file_header.e_shnum;
        i++, section++)
     {
-      char * name = SECTION_NAME (section);
+      char * name = SECTION_NAME_PRINT (section);
 
       /* Run some sanity checks on the headers and
         possibly fill in some file data as well.  */
@@ -6671,7 +6798,7 @@ process_section_headers (Filedata * filedata)
       if (do_section_details)
        printf ("%s\n      ", printable_section_name (filedata, section));
       else
-       print_symbol (-17, SECTION_NAME (section));
+       print_symbol (-17, SECTION_NAME_PRINT (section));
 
       printf (do_wide ? " %-15s " : " %-15.15s ",
              get_section_type_name (filedata, section->sh_type));
@@ -7068,7 +7195,8 @@ process_section_groups (Filedata * filedata)
                  continue;
                }
 
-             group_name = SECTION_NAME (filedata->section_headers + sym->st_shndx);
+             group_name = SECTION_NAME_PRINT (filedata->section_headers
+                                              + sym->st_shndx);
              strtab_sec = NULL;
              free (strtab);
              strtab = NULL;
@@ -7996,7 +8124,8 @@ ia64_process_unwind (Filedata * filedata)
                {
                  sec = filedata->section_headers + g->section_index;
 
-                 if (streq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info))
+                 if (SECTION_NAME_VALID (sec)
+                     && streq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info))
                    break;
                }
 
@@ -8004,14 +8133,19 @@ ia64_process_unwind (Filedata * filedata)
                i = filedata->file_header.e_shnum;
            }
        }
-      else if (strneq (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind_once, len))
+      else if (SECTION_NAME_VALID (unwsec)
+              && strneq (SECTION_NAME (unwsec),
+                         ELF_STRING_ia64_unwind_once, len))
        {
          /* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.ia64unwi.FOO.  */
          len2 = sizeof (ELF_STRING_ia64_unwind_info_once) - 1;
          suffix = SECTION_NAME (unwsec) + len;
-         for (i = 0, sec = filedata->section_headers; i < filedata->file_header.e_shnum;
+         for (i = 0, sec = filedata->section_headers;
+              i < filedata->file_header.e_shnum;
               ++i, ++sec)
-           if (strneq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info_once, len2)
+           if (SECTION_NAME_VALID (sec)
+               && strneq (SECTION_NAME (sec),
+                          ELF_STRING_ia64_unwind_info_once, len2)
                && streq (SECTION_NAME (sec) + len2, suffix))
              break;
        }
@@ -8022,11 +8156,14 @@ ia64_process_unwind (Filedata * filedata)
          len = sizeof (ELF_STRING_ia64_unwind) - 1;
          len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
          suffix = "";
-         if (strneq (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind, len))
+         if (SECTION_NAME_VALID (unwsec)
+             && strneq (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind, len))
            suffix = SECTION_NAME (unwsec) + len;
-         for (i = 0, sec = filedata->section_headers; i < filedata->file_header.e_shnum;
+         for (i = 0, sec = filedata->section_headers;
+              i < filedata->file_header.e_shnum;
               ++i, ++sec)
-           if (strneq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info, len2)
+           if (SECTION_NAME_VALID (sec)
+               && strneq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info, len2)
                && streq (SECTION_NAME (sec) + len2, suffix))
              break;
        }
@@ -8409,7 +8546,8 @@ hppa_process_unwind (Filedata * filedata)
                           &aux.strtab, &aux.strtab_size))
            return FALSE;
        }
-      else if (streq (SECTION_NAME (sec), ".PARISC.unwind"))
+      else if (SECTION_NAME_VALID (sec)
+              && streq (SECTION_NAME (sec), ".PARISC.unwind"))
        unwsec = sec;
     }
 
@@ -8418,7 +8556,8 @@ hppa_process_unwind (Filedata * filedata)
 
   for (i = 0, sec = filedata->section_headers; i < filedata->file_header.e_shnum; ++i, ++sec)
     {
-      if (streq (SECTION_NAME (sec), ".PARISC.unwind"))
+      if (SECTION_NAME_VALID (sec)
+         && streq (SECTION_NAME (sec), ".PARISC.unwind"))
        {
          unsigned long num_unwind = sec->sh_size / 16;
 
@@ -9747,20 +9886,29 @@ dynamic_section_parisc_val (Elf_Internal_Dyn * entry)
 
 #define VMS_EPOCH_OFFSET 35067168000000000LL
 #define VMS_GRANULARITY_FACTOR 10000000
+#ifndef INT64_MIN
+#define INT64_MIN (-9223372036854775807LL - 1)
+#endif
 
 /* Display a VMS time in a human readable format.  */
 
 static void
 print_vms_time (bfd_int64_t vmstime)
 {
-  struct tm *tm;
+  struct tm *tm = NULL;
   time_t unxtime;
 
-  unxtime = (vmstime - VMS_EPOCH_OFFSET) / VMS_GRANULARITY_FACTOR;
-  tm = gmtime (&unxtime);
-  printf ("%04u-%02u-%02uT%02u:%02u:%02u",
-          tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
-          tm->tm_hour, tm->tm_min, tm->tm_sec);
+  if (vmstime >= INT64_MIN + VMS_EPOCH_OFFSET)
+    {
+      vmstime = (vmstime - VMS_EPOCH_OFFSET) / VMS_GRANULARITY_FACTOR;
+      unxtime = vmstime;
+      if (unxtime == vmstime)
+       tm = gmtime (&unxtime);
+    }
+  if (tm != NULL)
+    printf ("%04u-%02u-%02uT%02u:%02u:%02u",
+           tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+           tm->tm_hour, tm->tm_min, tm->tm_sec);
 }
 #endif /* BFD64 */
 
@@ -10944,6 +11092,28 @@ the .dynstr section doesn't match the DT_STRTAB and DT_STRSZ tags\n"));
            }
          break;
 
+       case DT_GNU_FLAGS_1:
+         if (do_dynamic)
+           {
+             printf (_("Flags:"));
+             if (entry->d_un.d_val == 0)
+               printf (_(" None\n"));
+             else
+               {
+                 unsigned long int val = entry->d_un.d_val;
+
+                 if (val & DF_GNU_1_UNIQUE)
+                   {
+                     printf (" UNIQUE");
+                     val ^= DF_GNU_1_UNIQUE;
+                   }
+                 if (val != 0)
+                   printf (" %lx", val);
+                 puts ("");
+               }
+           }
+         break;
+
        default:
          if ((entry->d_tag >= DT_VERSYM) && (entry->d_tag <= DT_VERNEEDNUM))
            filedata->version_info[DT_VERSIONTAGIDX (entry->d_tag)]
@@ -12057,7 +12227,7 @@ print_dynamic_symbol (Filedata *filedata, unsigned long si,
   enum versioned_symbol_info sym_info;
   unsigned short vna_other;
   Elf_Internal_Sym *psym = symtab + si;
-  
+
   printf ("%6ld: ", si);
   print_vma (psym->st_value, LONG_HEX);
   putchar (' ');
@@ -12089,7 +12259,7 @@ print_dynamic_symbol (Filedata *filedata, unsigned long si,
                                  || section->sh_type == SHT_DYNSYM),
                                 strtab, strtab_size, si,
                                 psym, &sym_info, &vna_other);
-  
+
   int len_avail = 21;
   if (! do_wide && version_string != NULL)
     {
@@ -12104,7 +12274,7 @@ print_dynamic_symbol (Filedata *filedata, unsigned long si,
     }
 
   print_symbol (len_avail, sstr);
-    
+
   if (version_string)
     {
       if (sym_info == symbol_undefined)
@@ -12128,7 +12298,257 @@ print_dynamic_symbol (Filedata *filedata, unsigned long si,
          si, printable_section_name (filedata, section), section->sh_info);
 }
 
+static const char *
+get_lto_kind (unsigned int kind)
+{
+  switch (kind)
+    {
+    case 0: return "DEF";
+    case 1: return "WEAKDEF";
+    case 2: return "UNDEF";
+    case 3: return "WEAKUNDEF";
+    case 4: return "COMMON";
+    default:
+      break;
+    }
+
+  static char buffer[30];
+  error (_("Unknown LTO symbol definition encountered: %u\n"), kind);
+  sprintf (buffer, "<unknown: %u>", kind);
+  return buffer;
+}
+
+static const char *
+get_lto_visibility (unsigned int visibility)
+{
+  switch (visibility)
+    {
+    case 0: return "DEFAULT";
+    case 1: return "PROTECTED";
+    case 2: return "INTERNAL";
+    case 3: return "HIDDEN";
+    default:
+      break;
+    }
+
+  static char buffer[30];
+  error (_("Unknown LTO symbol visibility encountered: %u\n"), visibility);
+  sprintf (buffer, "<unknown: %u>", visibility);
+  return buffer;
+}
+
+static const char *
+get_lto_sym_type (unsigned int sym_type)
+{
+  switch (sym_type)
+    {
+    case 0: return "UNKNOWN";
+    case 1: return "FUNCTION";
+    case 2: return "VARIABLE";
+    default:
+      break;
+    }
+
+  static char buffer[30];
+  error (_("Unknown LTO symbol type encountered: %u\n"), sym_type);
+  sprintf (buffer, "<unknown: %u>", sym_type);
+  return buffer;
+}
+
+/* Display an LTO format symbol table.
+   FIXME: The format of LTO symbol tables is not formalized.
+   So this code could need changing in the future.  */
+
+static bfd_boolean
+display_lto_symtab (Filedata *           filedata,
+                   Elf_Internal_Shdr *  section)
+{
+  if (section->sh_size == 0)
+    {
+      printf (_("\nLTO Symbol table '%s' is empty!\n"),
+             printable_section_name (filedata, section));
+      return TRUE;
+    }
+
+  if (section->sh_size > filedata->file_size)
+    {
+      error (_("Section %s has an invalid sh_size of 0x%lx\n"),
+            printable_section_name (filedata, section),
+            (unsigned long) section->sh_size);
+      return FALSE;
+    }
+
+  void * alloced_data = get_data (NULL, filedata, section->sh_offset,
+                                 section->sh_size, 1, _("LTO symbols"));
+  if (alloced_data == NULL)
+    return FALSE;
+
+  /* Look for extended data for the symbol table.  */
+  Elf_Internal_Shdr * ext;
+  void * ext_data_orig = NULL;
+  char * ext_data = NULL;
+  char * ext_data_end = NULL;
+  char * ext_name = NULL;
+
+  if (asprintf (& ext_name, ".gnu.lto_.ext_symtab.%s",
+               SECTION_NAME (section) + sizeof (".gnu.lto_.symtab.") - 1) > 0
+      && ext_name != NULL /* Paranoia.  */
+      && (ext = find_section (filedata, ext_name)) != NULL)
+    {
+      if (ext->sh_size < 3)
+       error (_("LTO Symbol extension table '%s' is empty!\n"),
+              printable_section_name (filedata, ext));
+      else
+       {
+         ext_data_orig = ext_data = get_data (NULL, filedata, ext->sh_offset,
+                                              ext->sh_size, 1,
+                                              _("LTO ext symbol data"));
+         if (ext_data != NULL)
+           {
+             ext_data_end = ext_data + ext->sh_size;
+             if (* ext_data++ != 1)
+               error (_("Unexpected version number in symbol extension table\n"));
+           }
+       }
+    }
+
+  const unsigned char * data = (const unsigned char *) alloced_data;
+  const unsigned char * end = data + section->sh_size;
+
+  if (ext_data_orig != NULL)
+    {
+      if (do_wide)
+       printf (_("\nLTO Symbol table '%s' and extension table '%s' contain:\n"),
+               printable_section_name (filedata, section),
+               printable_section_name (filedata, ext));
+      else
+       {
+         printf (_("\nLTO Symbol table '%s'\n"),
+                 printable_section_name (filedata, section));
+         printf (_(" and extension table '%s' contain:\n"),
+                 printable_section_name (filedata, ext));
+       }
+    }
+  else
+    printf (_("\nLTO Symbol table '%s' contains:\n"),
+           printable_section_name (filedata, section));
+
+
+  /* FIXME: Add a wide version.  */
+  if (ext_data_orig != NULL)
+    printf (_("  Comdat_Key       Kind  Visibility     Size      Slot      Type  Section Name\n"));
+  else
+    printf (_("  Comdat_Key       Kind  Visibility     Size      Slot Name\n"));
+
+  /* FIXME: We do not handle style prefixes.  */
+
+  while (data < end)
+    {
+      const unsigned char * sym_name = data;
+      data += strnlen ((const char *) sym_name, end - data) + 1;
+      if (data >= end)
+       goto fail;
+
+      const unsigned char * comdat_key = data;
+      data += strnlen ((const char *) comdat_key, end - data) + 1;
+      if (data >= end)
+       goto fail;
+
+      if (data + 2 + 8 + 4 > end)
+       goto fail;
+
+      unsigned int kind = *data++;
+      unsigned int visibility = *data++;
+
+      elf_vma size = byte_get (data, 8);
+      data += 8;
+
+      elf_vma slot = byte_get (data, 4);
+      data += 4;
+
+      if (ext_data != NULL)
+       {
+         if (ext_data < (ext_data_end - 1))
+           {
+             unsigned int sym_type = * ext_data ++;
+             unsigned int sec_kind = * ext_data ++;
+
+             printf ("  %10s %10s %11s %08lx  %08lx %9s %08lx _",
+                     * comdat_key == 0 ? "-" : (char *) comdat_key,
+                     get_lto_kind (kind),
+                     get_lto_visibility (visibility),
+                     (long) size,
+                     (long) slot,
+                     get_lto_sym_type (sym_type),
+                     (long) sec_kind);
+             print_symbol (6, (const char *) sym_name);
+           }
+         else
+           {
+             error (_("Ran out of LTO symbol extension data\n"));
+             ext_data = NULL;
+             /* FIXME: return FAIL result ?  */
+           }
+       }
+      else
+       {
+         printf ("  %10s %10s %11s %08lx  %08lx _",
+                 * comdat_key == 0 ? "-" : (char *) comdat_key,
+                 get_lto_kind (kind),
+                 get_lto_visibility (visibility),
+                 (long) size,
+                 (long) slot);
+         print_symbol (21, (const char *) sym_name);
+       }
+      putchar ('\n');
+    }
+
+  if (ext_data != NULL && ext_data < ext_data_end)
+    {
+      error (_("Data remains in the LTO symbol extension table\n"));
+      goto fail;
+    }
+
+  free (alloced_data);
+  free (ext_data_orig);
+  free (ext_name);
+  return TRUE;
+
+ fail:
+  error (_("Buffer overrun encountered whilst decoding LTO symbol table\n"));
+  free (alloced_data);
+  free (ext_data_orig);
+  free (ext_name);
+  return FALSE;
+}
+
+/* Display LTO symbol tables.  */
+
+static bfd_boolean
+process_lto_symbol_tables (Filedata * filedata)
+{
+  Elf_Internal_Shdr * section;
+  unsigned int i;
+  bfd_boolean res = TRUE;
+
+  if (!do_lto_syms)
+    return TRUE;
+
+  if (filedata->section_headers == NULL)
+    return TRUE;
+
+  for (i = 0, section = filedata->section_headers;
+       i < filedata->file_header.e_shnum;
+       i++, section++)
+    if (SECTION_NAME_VALID (section)
+       && CONST_STRNEQ (SECTION_NAME (section), ".gnu.lto_.symtab."))
+      res &= display_lto_symtab (filedata, section);
+
+  return res;
+}
+
 /* Dump the symbol table.  */
+
 static bfd_boolean
 process_symbol_table (Filedata * filedata)
 {
@@ -12535,10 +12955,12 @@ target_specific_reloc_handling (Filedata *           filedata,
        switch (reloc_type)
          {
          case 10: /* R_MSP430_SYM_DIFF */
+         case 12: /* R_MSP430_GNU_SUB_ULEB128 */
            if (uses_msp430x_relocs (filedata))
              break;
            /* Fall through.  */
          case 21: /* R_MSP430X_SYM_DIFF */
+         case 23: /* R_MSP430X_GNU_SUB_ULEB128 */
            /* PR 21139.  */
            if (sym_index >= num_syms)
              error (_("MSP430 SYM_DIFF reloc contains invalid symbol index %lu\n"),
@@ -12553,12 +12975,14 @@ target_specific_reloc_handling (Filedata *           filedata,
 
          case 5: /* R_MSP430_16_BYTE */
          case 9: /* R_MSP430_8 */
+         case 11: /* R_MSP430_GNU_SET_ULEB128 */
            if (uses_msp430x_relocs (filedata))
              break;
            goto handle_sym_diff;
 
          case 2: /* R_MSP430_ABS16 */
          case 15: /* R_MSP430X_ABS16 */
+         case 22: /* R_MSP430X_GNU_SET_ULEB128 */
            if (! uses_msp430x_relocs (filedata))
              break;
            goto handle_sym_diff;
@@ -12566,10 +12990,30 @@ target_specific_reloc_handling (Filedata *           filedata,
          handle_sym_diff:
            if (saved_sym != NULL)
              {
-               int reloc_size = reloc_type == 1 ? 4 : 2;
                bfd_vma value;
+               unsigned int reloc_size = 0;
+               int leb_ret = 0;
+               switch (reloc_type)
+                 {
+                 case 1: /* R_MSP430_32 or R_MSP430_ABS32 */
+                   reloc_size = 4;
+                   break;
+                 case 11: /* R_MSP430_GNU_SET_ULEB128 */
+                 case 22: /* R_MSP430X_GNU_SET_ULEB128 */
+                   if (reloc->r_offset < (size_t) (end - start))
+                     read_leb128 (start + reloc->r_offset, end, FALSE,
+                                  &reloc_size, &leb_ret);
+                   break;
+                 default:
+                   reloc_size = 2;
+                   break;
+                 }
 
-               if (sym_index >= num_syms)
+               if (leb_ret != 0 || reloc_size == 0 || reloc_size > 8)
+                 error (_("MSP430 ULEB128 field at 0x%lx contains invalid "
+                          "ULEB128 value\n"),
+                        (long) reloc->r_offset);
+               else if (sym_index >= num_syms)
                  error (_("MSP430 reloc contains invalid symbol index %lu\n"),
                         sym_index);
                else
@@ -13929,18 +14373,12 @@ dump_section_as_strings (Elf_Internal_Shdr * section, Filedata * filedata)
            }
          else
            {
-#ifndef __MSVCRT__
-             /* PR 11128: Use two separate invocations in order to work
-                around bugs in the Solaris 8 implementation of printf.  */
-             printf ("  [%6tx]  ", data - start);
-#else
-             printf ("  [%6Ix]  ", (size_t) (data - start));
-#endif
+             printf ("  [%6lx]  ", (unsigned long) (data - start));
            }
 
          if (maxlen > 0)
            {
-             char c;
+             char c = 0;
 
              while (maxlen)
                {
@@ -14182,7 +14620,7 @@ dump_section_as_bytes (Elf_Internal_Shdr *  section,
 static ctf_sect_t *
 shdr_to_ctf_sect (ctf_sect_t *buf, Elf_Internal_Shdr *shdr, Filedata *filedata)
 {
-  buf->cts_name = SECTION_NAME (shdr);
+  buf->cts_name = SECTION_NAME_PRINT (shdr);
   buf->cts_size = shdr->sh_size;
   buf->cts_entsize = shdr->sh_entsize;
 
@@ -14205,17 +14643,38 @@ dump_ctf_indent_lines (ctf_sect_names_t sect ATTRIBUTE_UNUSED,
   return new_s;
 }
 
+/* Dump CTF errors/warnings.  */
+static void
+dump_ctf_errs (ctf_dict_t *fp)
+{
+  ctf_next_t *it = NULL;
+  char *errtext;
+  int is_warning;
+  int err;
+
+  /* Dump accumulated errors and warnings.  */
+  while ((errtext = ctf_errwarning_next (fp, &it, &is_warning, &err)) != NULL)
+    {
+      error (_("%s: %s"), is_warning ? _("warning"): _("error"),
+            errtext);
+      free (errtext);
+    }
+  if (err != ECTF_NEXT_END)
+    error (_("CTF error: cannot get CTF errors: `%s'"), ctf_errmsg (err));
+}
+
 /* Dump one CTF archive member.  */
 
 static int
-dump_ctf_archive_member (ctf_file_t *ctf, const char *name, void *arg)
+dump_ctf_archive_member (ctf_dict_t *ctf, const char *name, void *arg)
 {
-  ctf_file_t *parent = (ctf_file_t *) arg;
+  ctf_dict_t *parent = (ctf_dict_t *) arg;
   const char *things[] = {"Header", "Labels", "Data objects",
                          "Function objects", "Variables", "Types", "Strings",
                          ""};
   const char **thing;
   size_t i;
+  int err = 0;
 
   /* Only print out the name of non-default-named archive members.
      The name .ctf appears everywhere, even for things that aren't
@@ -14248,10 +14707,14 @@ dump_ctf_archive_member (ctf_file_t *ctf, const char *name, void *arg)
        {
          error (_("Iteration failed: %s, %s\n"), *thing,
                 ctf_errmsg (ctf_errno (ctf)));
-         return 1;
+         err = 1;
+         goto out;
        }
     }
-  return 0;
+
+ out:
+  dump_ctf_errs (ctf);
+  return err;
 }
 
 static bfd_boolean
@@ -14269,7 +14732,7 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
   ctf_sect_t *        strsectp = NULL;
   ctf_archive_t *      ctfa = NULL;
   ctf_archive_t *      parenta = NULL, *lookparent;
-  ctf_file_t *         parent = NULL;
+  ctf_dict_t *         parent = NULL;
 
   int err;
   bfd_boolean ret = FALSE;
@@ -14279,10 +14742,10 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
   ctfsect.cts_data = data;
 
   if (!dump_ctf_symtab_name)
-    dump_ctf_symtab_name = strdup (".symtab");
+    dump_ctf_symtab_name = strdup (".dynsym");
 
   if (!dump_ctf_strtab_name)
-    dump_ctf_strtab_name = strdup (".strtab");
+    dump_ctf_strtab_name = strdup (".dynstr");
 
   if (dump_ctf_symtab_name && dump_ctf_symtab_name[0] != 0)
     {
@@ -14337,15 +14800,20 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
 
   if ((ctfa = ctf_arc_bufopen (&ctfsect, symsectp, strsectp, &err)) == NULL)
     {
+      dump_ctf_errs (NULL);
       error (_("CTF open failure: %s\n"), ctf_errmsg (err));
       goto fail;
     }
 
+  ctf_arc_symsect_endianness (ctfa, filedata->file_header.e_ident[EI_DATA]
+                             != ELFDATA2MSB);
+
   if (parentdata)
     {
       if ((parenta = ctf_arc_bufopen (&parentsect, symsectp, strsectp,
                                      &err)) == NULL)
        {
+         dump_ctf_errs (NULL);
          error (_("CTF open failure: %s\n"), ctf_errmsg (err));
          goto fail;
        }
@@ -14357,8 +14825,9 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
   /* Assume that the applicable parent archive member is the default one.
      (This is what all known implementations are expected to do, if they
      put CTFs and their parents in archives together.)  */
-  if ((parent = ctf_arc_open_by_name (lookparent, NULL, &err)) == NULL)
+  if ((parent = ctf_dict_open (lookparent, NULL, &err)) == NULL)
     {
+      dump_ctf_errs (NULL);
       error (_("CTF open failure: %s\n"), ctf_errmsg (err));
       goto fail;
     }
@@ -14368,11 +14837,15 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
   printf (_("\nDump of CTF section '%s':\n"),
          printable_section_name (filedata, section));
 
-  if (ctf_archive_iter (ctfa, dump_ctf_archive_member, parent) != 0)
-    ret = FALSE;
+  if ((err = ctf_archive_iter (ctfa, dump_ctf_archive_member, parent)) != 0)
+    {
+      dump_ctf_errs (NULL);
+      error (_("CTF member open failure: %s\n"), ctf_errmsg (err));
+      ret = FALSE;
+    }
 
  fail:
-  ctf_file_close (parent);
+  ctf_dict_close (parent);
   ctf_close (ctfa);
   ctf_close (parenta);
   free (parentdata);
@@ -14717,7 +15190,7 @@ free_debug_section (enum dwarf_section_display_enum debug)
 static bfd_boolean
 display_debug_section (int shndx, Elf_Internal_Shdr * section, Filedata * filedata)
 {
-  char * name = SECTION_NAME (section);
+  char * name = SECTION_NAME_VALID (section) ? SECTION_NAME (section) : "";
   const char * print_name = printable_section_name (filedata, section);
   bfd_size_type length;
   bfd_boolean result = TRUE;
@@ -14806,7 +15279,8 @@ initialise_dumps_byname (Filedata * filedata)
       bfd_boolean any = FALSE;
 
       for (i = 0; i < filedata->file_header.e_shnum; i++)
-       if (streq (SECTION_NAME (filedata->section_headers + i), cur->name))
+       if (SECTION_NAME_VALID (filedata->section_headers + i)
+           && streq (SECTION_NAME (filedata->section_headers + i), cur->name))
          {
            request_dump_bynumber (&filedata->dump, i, cur->type);
            any = TRUE;
@@ -15143,77 +15617,77 @@ typedef struct
   const char * name;
   /* 0 = special, 1 = string, 2 = uleb123, > 0x80 == table lookup.  */
   unsigned int type;
-  const char *table;
+  const char *const *table;
 } arm_attr_public_tag;
 
-static const char * arm_attr_tag_CPU_arch[] =
+static const char *const arm_attr_tag_CPU_arch[] =
   {"Pre-v4", "v4", "v4T", "v5T", "v5TE", "v5TEJ", "v6", "v6KZ", "v6T2",
    "v6K", "v7", "v6-M", "v6S-M", "v7E-M", "v8", "v8-R", "v8-M.baseline",
    "v8-M.mainline", "", "", "", "v8.1-M.mainline"};
-static const char * arm_attr_tag_ARM_ISA_use[] = {"No", "Yes"};
-static const char * arm_attr_tag_THUMB_ISA_use[] =
+static const char *const arm_attr_tag_ARM_ISA_use[] = {"No", "Yes"};
+static const char *const arm_attr_tag_THUMB_ISA_use[] =
   {"No", "Thumb-1", "Thumb-2", "Yes"};
-static const char * arm_attr_tag_FP_arch[] =
+static const char *const arm_attr_tag_FP_arch[] =
   {"No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16", "VFPv4", "VFPv4-D16",
    "FP for ARMv8", "FPv5/FP-D16 for ARMv8"};
-static const char * arm_attr_tag_WMMX_arch[] = {"No", "WMMXv1", "WMMXv2"};
-static const char * arm_attr_tag_Advanced_SIMD_arch[] =
+static const char *const arm_attr_tag_WMMX_arch[] = {"No", "WMMXv1", "WMMXv2"};
+static const char *const arm_attr_tag_Advanced_SIMD_arch[] =
   {"No", "NEONv1", "NEONv1 with Fused-MAC", "NEON for ARMv8",
    "NEON for ARMv8.1"};
-static const char * arm_attr_tag_PCS_config[] =
+static const char *const arm_attr_tag_PCS_config[] =
   {"None", "Bare platform", "Linux application", "Linux DSO", "PalmOS 2004",
    "PalmOS (reserved)", "SymbianOS 2004", "SymbianOS (reserved)"};
-static const char * arm_attr_tag_ABI_PCS_R9_use[] =
+static const char *const arm_attr_tag_ABI_PCS_R9_use[] =
   {"V6", "SB", "TLS", "Unused"};
-static const char * arm_attr_tag_ABI_PCS_RW_data[] =
+static const char *const arm_attr_tag_ABI_PCS_RW_data[] =
   {"Absolute", "PC-relative", "SB-relative", "None"};
-static const char * arm_attr_tag_ABI_PCS_RO_data[] =
+static const char *const arm_attr_tag_ABI_PCS_RO_data[] =
   {"Absolute", "PC-relative", "None"};
-static const char * arm_attr_tag_ABI_PCS_GOT_use[] =
+static const char *const arm_attr_tag_ABI_PCS_GOT_use[] =
   {"None", "direct", "GOT-indirect"};
-static const char * arm_attr_tag_ABI_PCS_wchar_t[] =
+static const char *const arm_attr_tag_ABI_PCS_wchar_t[] =
   {"None", "??? 1", "2", "??? 3", "4"};
-static const char * arm_attr_tag_ABI_FP_rounding[] = {"Unused", "Needed"};
-static const char * arm_attr_tag_ABI_FP_denormal[] =
+static const char *const arm_attr_tag_ABI_FP_rounding[] = {"Unused", "Needed"};
+static const char *const arm_attr_tag_ABI_FP_denormal[] =
   {"Unused", "Needed", "Sign only"};
-static const char * arm_attr_tag_ABI_FP_exceptions[] = {"Unused", "Needed"};
-static const char * arm_attr_tag_ABI_FP_user_exceptions[] = {"Unused", "Needed"};
-static const char * arm_attr_tag_ABI_FP_number_model[] =
+static const char *const arm_attr_tag_ABI_FP_exceptions[] = {"Unused", "Needed"};
+static const char *const arm_attr_tag_ABI_FP_user_exceptions[] = {"Unused", "Needed"};
+static const char *const arm_attr_tag_ABI_FP_number_model[] =
   {"Unused", "Finite", "RTABI", "IEEE 754"};
-static const char * arm_attr_tag_ABI_enum_size[] =
+static const char *const arm_attr_tag_ABI_enum_size[] =
   {"Unused", "small", "int", "forced to int"};
-static const char * arm_attr_tag_ABI_HardFP_use[] =
+static const char *const arm_attr_tag_ABI_HardFP_use[] =
   {"As Tag_FP_arch", "SP only", "Reserved", "Deprecated"};
-static const char * arm_attr_tag_ABI_VFP_args[] =
+static const char *const arm_attr_tag_ABI_VFP_args[] =
   {"AAPCS", "VFP registers", "custom", "compatible"};
-static const char * arm_attr_tag_ABI_WMMX_args[] =
+static const char *const arm_attr_tag_ABI_WMMX_args[] =
   {"AAPCS", "WMMX registers", "custom"};
-static const char * arm_attr_tag_ABI_optimization_goals[] =
+static const char *const arm_attr_tag_ABI_optimization_goals[] =
   {"None", "Prefer Speed", "Aggressive Speed", "Prefer Size",
     "Aggressive Size", "Prefer Debug", "Aggressive Debug"};
-static const char * arm_attr_tag_ABI_FP_optimization_goals[] =
+static const char *const arm_attr_tag_ABI_FP_optimization_goals[] =
   {"None", "Prefer Speed", "Aggressive Speed", "Prefer Size",
     "Aggressive Size", "Prefer Accuracy", "Aggressive Accuracy"};
-static const char * arm_attr_tag_CPU_unaligned_access[] = {"None", "v6"};
-static const char * arm_attr_tag_FP_HP_extension[] =
+static const char *const arm_attr_tag_CPU_unaligned_access[] = {"None", "v6"};
+static const char *const arm_attr_tag_FP_HP_extension[] =
   {"Not Allowed", "Allowed"};
-static const char * arm_attr_tag_ABI_FP_16bit_format[] =
+static const char *const arm_attr_tag_ABI_FP_16bit_format[] =
   {"None", "IEEE 754", "Alternative Format"};
-static const char * arm_attr_tag_DSP_extension[] =
+static const char *const arm_attr_tag_DSP_extension[] =
   {"Follow architecture", "Allowed"};
-static const char * arm_attr_tag_MPextension_use[] =
+static const char *const arm_attr_tag_MPextension_use[] =
   {"Not Allowed", "Allowed"};
-static const char * arm_attr_tag_DIV_use[] =
+static const char *const arm_attr_tag_DIV_use[] =
   {"Allowed in Thumb-ISA, v7-R or v7-M", "Not allowed",
     "Allowed in v7-A with integer division extension"};
-static const char * arm_attr_tag_T2EE_use[] = {"Not Allowed", "Allowed"};
-static const char * arm_attr_tag_Virtualization_use[] =
+static const char *const arm_attr_tag_T2EE_use[] = {"Not Allowed", "Allowed"};
+static const char *const arm_attr_tag_Virtualization_use[] =
   {"Not Allowed", "TrustZone", "Virtualization Extensions",
     "TrustZone and Virtualization Extensions"};
-static const char * arm_attr_tag_MPextension_use_legacy[] =
+static const char *const arm_attr_tag_MPextension_use_legacy[] =
   {"Not Allowed", "Allowed"};
 
-static const char * arm_attr_tag_MVE_arch[] =
+static const char *const arm_attr_tag_MVE_arch[] =
   {"No MVE", "MVE Integer only", "MVE Integer and FP"};
 
 #define LOOKUP(id, name) \
@@ -16114,7 +16588,7 @@ display_raw_attribute (unsigned char * p, unsigned char const * const end)
 }
 
 static unsigned char *
-display_msp430x_attribute (unsigned char * p,
+display_msp430_attribute (unsigned char * p,
                           const unsigned char * const end)
 {
   unsigned int val;
@@ -16298,6 +16772,110 @@ display_riscv_attribute (unsigned char *p,
   return p;
 }
 
+static unsigned char *
+display_csky_attribute (unsigned char * p,
+                       const unsigned char * const end)
+{
+  unsigned int tag;
+  unsigned int val;
+  READ_ULEB (tag, p, end);
+
+  if (tag >= Tag_CSKY_MAX)
+    {
+      return display_tag_value (-1, p, end);
+    }
+
+  switch (tag)
+    {
+    case Tag_CSKY_ARCH_NAME:
+      printf ("  Tag_CSKY_ARCH_NAME:\t\t");
+      return display_tag_value (-1, p, end);
+    case Tag_CSKY_CPU_NAME:
+      printf ("  Tag_CSKY_CPU_NAME:\t\t");
+      return display_tag_value (-1, p, end);
+
+    case Tag_CSKY_ISA_FLAGS:
+      printf ("  Tag_CSKY_ISA_FLAGS:\t\t");
+      return display_tag_value (0, p, end);
+    case Tag_CSKY_ISA_EXT_FLAGS:
+      printf ("  Tag_CSKY_ISA_EXT_FLAGS:\t");
+      return display_tag_value (0, p, end);
+
+    case Tag_CSKY_DSP_VERSION:
+      printf ("  Tag_CSKY_DSP_VERSION:\t\t");
+      READ_ULEB (val, p, end);
+      if (val == VAL_CSKY_DSP_VERSION_EXTENSION)
+       printf ("DSP Extension\n");
+      else if (val == VAL_CSKY_DSP_VERSION_2)
+       printf ("DSP 2.0\n");
+      break;
+
+    case Tag_CSKY_VDSP_VERSION:
+      printf ("  Tag_CSKY_VDSP_VERSION:\t");
+      READ_ULEB (val, p, end);
+      printf ("VDSP Version %d\n", val);
+      break;
+
+    case Tag_CSKY_FPU_VERSION:
+      printf ("  Tag_CSKY_FPU_VERSION:\t\t");
+      READ_ULEB (val, p, end);
+      if (val == VAL_CSKY_FPU_VERSION_1)
+       printf ("ABIV1 FPU Version 1\n");
+      else if (val == VAL_CSKY_FPU_VERSION_2)
+       printf ("FPU Version 2\n");
+      break;
+
+    case Tag_CSKY_FPU_ABI:
+      printf ("  Tag_CSKY_FPU_ABI:\t\t");
+      READ_ULEB (val, p, end);
+      if (val == VAL_CSKY_FPU_ABI_HARD)
+       printf ("Hard\n");
+      else if (val == VAL_CSKY_FPU_ABI_SOFTFP)
+       printf ("SoftFP\n");
+      else if (val == VAL_CSKY_FPU_ABI_SOFT)
+       printf ("Soft\n");
+      break;
+    case Tag_CSKY_FPU_ROUNDING:
+      READ_ULEB (val, p, end);
+      if (val == 1) {
+       printf ("  Tag_CSKY_FPU_ROUNDING:\t");
+       printf ("Needed\n");
+      }
+      break;
+    case Tag_CSKY_FPU_DENORMAL:
+      READ_ULEB (val, p, end);
+      if (val == 1) {
+       printf ("  Tag_CSKY_FPU_DENORMAL:\t");
+       printf ("Needed\n");
+      }
+      break;
+    case Tag_CSKY_FPU_Exception:
+      READ_ULEB (val, p, end);
+      if (val == 1) {
+       printf ("  Tag_CSKY_FPU_Exception:\t");
+       printf ("Needed\n");
+      }
+      break;
+    case Tag_CSKY_FPU_NUMBER_MODULE:
+      printf ("  Tag_CSKY_FPU_NUMBER_MODULE:\t");
+      return display_tag_value (-1, p, end);
+    case Tag_CSKY_FPU_HARDFP:
+      printf ("  Tag_CSKY_FPU_HARDFP:\t\t");
+      READ_ULEB (val, p, end);
+      if (val & VAL_CSKY_FPU_HARDFP_HALF)
+       printf (" Half");
+      if (val & VAL_CSKY_FPU_HARDFP_SINGLE)
+       printf (" Single");
+      if (val & VAL_CSKY_FPU_HARDFP_DOUBLE)
+       printf (" Double");
+      printf ("\n");
+      break;
+    default:
+      return display_tag_value (tag, p, end);
+     }
+  return p;
+}
+
 static bfd_boolean
 process_attributes (Filedata * filedata,
                    const char * public_name,
@@ -17507,7 +18085,10 @@ process_mips_specific (Filedata * filedata)
       data = (unsigned char *) get_data (NULL, filedata, offset, end - mips_pltgot,
                                          1, _("Procedure Linkage Table data"));
       if (data == NULL)
-       return FALSE;
+       {
+         free (rels);
+         return FALSE;
+       }
 
       printf ("\nPLT GOT:\n\n");
       printf (_(" Reserved entries:\n"));
@@ -17753,6 +18334,8 @@ get_note_type (Filedata * filedata, unsigned e_type)
        return _("NT_386_IOPERM (x86 I/O permissions)");
       case NT_X86_XSTATE:
        return _("NT_X86_XSTATE (x86 XSAVE extended state)");
+      case NT_X86_CET:
+       return _("NT_X86_CET (x86 CET state)");
       case NT_S390_HIGH_GPRS:
        return _("NT_S390_HIGH_GPRS (s390 upper register halves)");
       case NT_S390_TIMER:
@@ -18022,7 +18605,7 @@ decode_x86_compat_isa (unsigned int bitmask)
 }
 
 static void
-decode_x86_isa (unsigned int bitmask)
+decode_x86_compat_2_isa (unsigned int bitmask)
 {
   if (!bitmask)
     {
@@ -18037,79 +18620,79 @@ decode_x86_isa (unsigned int bitmask)
       bitmask &= ~ bit;
       switch (bit)
        {
-       case GNU_PROPERTY_X86_ISA_1_CMOV:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_CMOV:
          printf ("CMOV");
          break;
-       case GNU_PROPERTY_X86_ISA_1_SSE:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE:
          printf ("SSE");
          break;
-       case GNU_PROPERTY_X86_ISA_1_SSE2:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE2:
          printf ("SSE2");
          break;
-       case GNU_PROPERTY_X86_ISA_1_SSE3:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE3:
          printf ("SSE3");
          break;
-       case GNU_PROPERTY_X86_ISA_1_SSSE3:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSSE3:
          printf ("SSSE3");
          break;
-       case GNU_PROPERTY_X86_ISA_1_SSE4_1:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE4_1:
          printf ("SSE4_1");
          break;
-       case GNU_PROPERTY_X86_ISA_1_SSE4_2:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE4_2:
          printf ("SSE4_2");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX:
          printf ("AVX");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX2:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX2:
          printf ("AVX2");
          break;
-       case GNU_PROPERTY_X86_ISA_1_FMA:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_FMA:
          printf ("FMA");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512F:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512F:
          printf ("AVX512F");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512CD:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512CD:
          printf ("AVX512CD");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512ER:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512ER:
          printf ("AVX512ER");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512PF:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512PF:
          printf ("AVX512PF");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512VL:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512VL:
          printf ("AVX512VL");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512DQ:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512DQ:
          printf ("AVX512DQ");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512BW:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512BW:
          printf ("AVX512BW");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512_4FMAPS:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_4FMAPS:
          printf ("AVX512_4FMAPS");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512_4VNNIW:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_4VNNIW:
          printf ("AVX512_4VNNIW");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512_BITALG:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_BITALG:
          printf ("AVX512_BITALG");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512_IFMA:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_IFMA:
          printf ("AVX512_IFMA");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512_VBMI:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_VBMI:
          printf ("AVX512_VBMI");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512_VBMI2:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_VBMI2:
          printf ("AVX512_VBMI2");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512_VNNI:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_VNNI:
          printf ("AVX512_VNNI");
          break;
-       case GNU_PROPERTY_X86_ISA_1_AVX512_BF16:
+       case GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_BF16:
          printf ("AVX512_BF16");
          break;
        default:
@@ -18121,6 +18704,37 @@ decode_x86_isa (unsigned int bitmask)
     }
 }
 
+static void
+decode_x86_isa (unsigned int bitmask)
+{
+  while (bitmask)
+    {
+      unsigned int bit = bitmask & (- bitmask);
+
+      bitmask &= ~ bit;
+      switch (bit)
+       {
+       case GNU_PROPERTY_X86_ISA_1_BASELINE:
+         printf ("x86-64-baseline");
+         break;
+       case GNU_PROPERTY_X86_ISA_1_V2:
+         printf ("x86-64-v2");
+         break;
+       case GNU_PROPERTY_X86_ISA_1_V3:
+         printf ("x86-64-v3");
+         break;
+       case GNU_PROPERTY_X86_ISA_1_V4:
+         printf ("x86-64-v4");
+         break;
+       default:
+         printf (_("<unknown: %x>"), bit);
+         break;
+       }
+      if (bitmask)
+       printf (", ");
+    }
+}
+
 static void
 decode_x86_feature_1 (unsigned int bitmask)
 {
@@ -18143,6 +18757,12 @@ decode_x86_feature_1 (unsigned int bitmask)
        case GNU_PROPERTY_X86_FEATURE_1_SHSTK:
          printf ("SHSTK");
          break;
+       case GNU_PROPERTY_X86_FEATURE_1_LAM_U48:
+         printf ("LAM_U48");
+         break;
+       case GNU_PROPERTY_X86_FEATURE_1_LAM_U57:
+         printf ("LAM_U57");
+         break;
        default:
          printf (_("<unknown: %x>"), bit);
          break;
@@ -18189,6 +18809,9 @@ decode_x86_feature_2 (unsigned int bitmask)
        case GNU_PROPERTY_X86_FEATURE_2_TMM:
          printf ("TMM");
          break;
+       case GNU_PROPERTY_X86_FEATURE_2_MASK:
+         printf ("MASK");
+         break;
        case GNU_PROPERTY_X86_FEATURE_2_FXSR:
          printf ("FXSR");
          break;
@@ -18367,6 +18990,28 @@ print_gnu_property_note (Filedata * filedata, Elf_Internal_Note * pnote)
                    }
                  goto next;
 
+               case GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED:
+                 if (datasz != 4)
+                   printf (_("x86 ISA used: <corrupt length: %#x> "),
+                           datasz);
+                 else
+                   {
+                     printf ("x86 ISA used: ");
+                     decode_x86_compat_2_isa (bitmask);
+                   }
+                 goto next;
+
+               case GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED:
+                 if (datasz != 4)
+                   printf (_("x86 ISA needed: <corrupt length: %#x> "),
+                           datasz);
+                 else
+                   {
+                     printf ("x86 ISA needed: ");
+                     decode_x86_compat_2_isa (bitmask);
+                   }
+                 goto next;
+
                default:
                  break;
                }
@@ -19485,7 +20130,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
 
        while (bytes --)
          {
-           unsigned long byte = (* name ++) & 0xff;
+           unsigned long long byte = *name++ & 0xff;
 
            val |= byte << shift;
            shift += 8;
@@ -20050,7 +20695,7 @@ process_arch_specific (Filedata * filedata)
 
     case EM_MSP430:
      return process_attributes (filedata, "mspabi", SHT_MSP430_ATTRIBUTES,
-                               display_msp430x_attribute,
+                               display_msp430_attribute,
                                display_msp430_gnu_attribute);
 
     case EM_RISCV:
@@ -20086,6 +20731,10 @@ process_arch_specific (Filedata * filedata)
                                 display_tic6x_attribute,
                                 display_generic_attribute);
 
+    case EM_CSKY:
+      return process_attributes (filedata, "csky", SHT_CSKY_ATTRIBUTES,
+                                display_csky_attribute, NULL);
+
     default:
       return process_attributes (filedata, "gnu", SHT_GNU_ATTRIBUTES,
                                 display_public_gnu_attributes,
@@ -20338,6 +20987,9 @@ process_object (Filedata * filedata)
   if (! process_symbol_table (filedata))
     res = FALSE;
 
+  if (! process_lto_symbol_tables (filedata))
+    res = FALSE;
+
   if (! process_syminfo (filedata))
     res = FALSE;