Use ui_file_as_string in gdb/printcmd.c
[binutils-gdb.git] / bfd / elfxx-mips.c
index 65f1ee4ea3aa03df44b6db60e19ea953cf5f3210..e4fc0430402a227419a98db88d93c38b6b96ee83 100644 (file)
@@ -913,7 +913,7 @@ static bfd *reldyn_sorting_bfd;
     : 0x8f998010))                             /* lw t9,0x8010(gp) */
 #define STUB_MOVE 0x03e07825                   /* or t7,ra,zero */
 #define STUB_LUI(VAL) (0x3c180000 + (VAL))     /* lui t8,VAL */
-#define STUB_JALR 0x0320f809                   /* jalr t9,ra */
+#define STUB_JALR 0x0320f809                   /* jalr ra,t9 */
 #define STUB_ORI(VAL) (0x37180000 + (VAL))     /* ori t8,t8,VAL */
 #define STUB_LI16U(VAL) (0x34180000 + (VAL))   /* ori t8,zero,VAL unsigned */
 #define STUB_LI16S(abfd, VAL)                                          \
@@ -1808,6 +1808,7 @@ mips_elf_local_pic_function_p (struct mips_elf_link_hash_entry *h)
           || h->root.root.type == bfd_link_hash_defweak)
          && h->root.def_regular
          && !bfd_is_abs_section (h->root.root.u.def.section)
+         && !bfd_is_und_section (h->root.root.u.def.section)
          && (!ELF_ST_IS_MIPS16 (h->root.other)
              || (h->fn_stub && h->need_fn_stub))
          && (PIC_OBJECT_P (h->root.root.u.def.section->owner)
@@ -7117,6 +7118,7 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
          if (intopt.size < sizeof (Elf_External_Options))
            {
              _bfd_error_handler
+               /* xgettext:c-format */
                (_("%B: Warning: bad `%s' option size %u smaller than its header"),
                abfd, MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
              break;
@@ -7350,6 +7352,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
          if (intopt.size < sizeof (Elf_External_Options))
            {
              _bfd_error_handler
+               /* xgettext:c-format */
                (_("%B: Warning: bad `%s' option size %u smaller than its header"),
                abfd, MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
              break;
@@ -8120,6 +8123,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
       if (r_symndx == 0)
        {
          _bfd_error_handler
+           /* xgettext:c-format */
            (_("%B: Warning: cannot determine the target function for"
               " stub section `%s'"),
             abfd, name);
@@ -8245,6 +8249,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
       if (r_symndx == 0)
        {
          _bfd_error_handler
+           /* xgettext:c-format */
            (_("%B: Warning: cannot determine the target function for"
               " stub section `%s'"),
             abfd, name);
@@ -8376,6 +8381,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
       else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr))
        {
          _bfd_error_handler
+           /* xgettext:c-format */
            (_("%B: Malformed reloc detected for section %s"),
             abfd, name);
          bfd_set_error (bfd_error_bad_value);
@@ -8451,6 +8457,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
          if (htab->is_vxworks && !bfd_link_pic (info))
            {
              _bfd_error_handler
+               /* xgettext:c-format */
                (_("%B: GOT reloc at 0x%lx not expected in executables"),
                 abfd, (unsigned long) rel->r_offset);
              bfd_set_error (bfd_error_bad_value);
@@ -8588,6 +8595,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
          if (h == NULL)
            {
              _bfd_error_handler
+               /* xgettext:c-format */
                (_("%B: CALL16 reloc at 0x%lx not against global symbol"),
                 abfd, (unsigned long) rel->r_offset);
              bfd_set_error (bfd_error_bad_value);
@@ -8873,6 +8881,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
            case R_MICROMIPS_26_S1:
              howto = MIPS_ELF_RTYPE_TO_HOWTO (abfd, r_type, FALSE);
              _bfd_error_handler
+               /* xgettext:c-format */
                (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
                 abfd, howto->name,
                 (h) ? h->root.root.string : "a local symbol");
@@ -10278,6 +10287,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                                                 local_syms + r_symndx,
                                                 sec);
                      _bfd_error_handler
+                       /* xgettext:c-format */
                        (_("%B: Can't find matching LO16 reloc against `%s' for %s at 0x%lx in section `%A'"),
                         input_bfd, input_section, name, howto->name,
                         rel->r_offset);
@@ -10820,6 +10830,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
              if (gotpc_offset + 0x1000000 >= 0x2000000)
                {
                  _bfd_error_handler
+                   /* xgettext:c-format */
                    (_("%B: `%A' offset of %ld from `%A' "
                       "beyond the range of ADDIUPC"),
                     output_bfd,
@@ -11383,6 +11394,7 @@ mips_finish_exec_plt (bfd *output_bfd, struct bfd_link_info *info)
       if (gotpc_offset + 0x1000000 >= 0x2000000)
        {
          _bfd_error_handler
+           /* xgettext:c-format */
            (_("%B: `%A' offset of %ld from `%A' beyond the range of ADDIUPC"),
             output_bfd,
             htab->sgotplt->output_section,
@@ -14296,6 +14308,7 @@ update_mips_abiflags_isa (bfd *abfd, Elf_Internal_ABIFlags_v0 *abiflags)
     case E_MIPS_ARCH_64R6: new_isa = LEVEL_REV (64, 6); break;
     default:
       _bfd_error_handler
+       /* xgettext:c-format */
        (_("%B: Unknown architecture %s"),
         abfd, bfd_printable_name (abfd));
     }
@@ -14825,6 +14838,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
          else
            {
              _bfd_error_handler
+               /* xgettext:c-format */
                (_("%s: illegal section name `%s'"),
                 bfd_get_filename (abfd), o->name);
              bfd_set_error (bfd_error_nonrepresentable_section);
@@ -15063,8 +15077,9 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
    if there are conflicting settings.  */
 
 static bfd_boolean
-mips_elf_merge_obj_e_flags (bfd *ibfd, bfd *obfd)
+mips_elf_merge_obj_e_flags (bfd *ibfd, struct bfd_link_info *info)
 {
+  bfd *obfd = info->output_bfd;
   struct mips_elf_obj_tdata *out_tdata = mips_elf_tdata (obfd);
   flagword old_flags;
   flagword new_flags;
@@ -15150,6 +15165,7 @@ mips_elf_merge_obj_e_flags (bfd *ibfd, bfd *obfd)
        {
          /* The ISAs aren't compatible.  */
          _bfd_error_handler
+           /* xgettext:c-format */
            (_("%B: linking %s module with previous %s modules"),
             ibfd,
             bfd_printable_name (ibfd),
@@ -15173,6 +15189,7 @@ mips_elf_merge_obj_e_flags (bfd *ibfd, bfd *obfd)
              != elf_elfheader (obfd)->e_ident[EI_CLASS]))
        {
          _bfd_error_handler
+           /* xgettext:c-format */
            (_("%B: ABI mismatch: linking %s module with previous %s modules"),
             ibfd,
             elf_mips_abi_name (ibfd),
@@ -15197,6 +15214,7 @@ mips_elf_merge_obj_e_flags (bfd *ibfd, bfd *obfd)
       if (m16_mis || micro_mis)
        {
          _bfd_error_handler
+           /* xgettext:c-format */
            (_("%B: ASE mismatch: linking %s module with previous %s modules"),
             ibfd,
             m16_mis ? "MIPS16" : "microMIPS",
@@ -15213,6 +15231,7 @@ mips_elf_merge_obj_e_flags (bfd *ibfd, bfd *obfd)
   /* Compare NaN encodings.  */
   if ((new_flags & EF_MIPS_NAN2008) != (old_flags & EF_MIPS_NAN2008))
     {
+      /* xgettext:c-format */
       _bfd_error_handler (_("%B: linking %s module with previous %s modules"),
                          ibfd,
                          (new_flags & EF_MIPS_NAN2008
@@ -15227,6 +15246,7 @@ mips_elf_merge_obj_e_flags (bfd *ibfd, bfd *obfd)
   /* Compare FP64 state.  */
   if ((new_flags & EF_MIPS_FP64) != (old_flags & EF_MIPS_FP64))
     {
+      /* xgettext:c-format */
       _bfd_error_handler (_("%B: linking %s module with previous %s modules"),
                          ibfd,
                          (new_flags & EF_MIPS_FP64
@@ -15241,6 +15261,7 @@ mips_elf_merge_obj_e_flags (bfd *ibfd, bfd *obfd)
   /* Warn about any other mismatches */
   if (new_flags != old_flags)
     {
+      /* xgettext:c-format */
       _bfd_error_handler
        (_("%B: uses different e_flags (0x%lx) fields than previous modules "
           "(0x%lx)"),
@@ -15255,8 +15276,9 @@ mips_elf_merge_obj_e_flags (bfd *ibfd, bfd *obfd)
 /* Merge object attributes from IBFD into OBFD.  Raise an error if
    there are conflicting attributes.  */
 static bfd_boolean
-mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
+mips_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info)
 {
+  bfd *obfd = info->output_bfd;
   obj_attribute *in_attr;
   obj_attribute *out_attr;
   bfd *abi_fp_bfd;
@@ -15326,17 +15348,20 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
          in_string = _bfd_mips_fp_abi_string (in_fp);
          /* First warn about cases involving unrecognised ABIs.  */
          if (!out_string && !in_string)
+           /* xgettext:c-format */
            _bfd_error_handler
              (_("Warning: %B uses unknown floating point ABI %d "
                 "(set by %B), %B uses unknown floating point ABI %d"),
               obfd, abi_fp_bfd, ibfd, out_fp, in_fp);
          else if (!out_string)
            _bfd_error_handler
+             /* xgettext:c-format */
              (_("Warning: %B uses unknown floating point ABI %d "
                 "(set by %B), %B uses %s"),
               obfd, abi_fp_bfd, ibfd, out_fp, in_string);
          else if (!in_string)
            _bfd_error_handler
+             /* xgettext:c-format */
              (_("Warning: %B uses %s (set by %B), "
                 "%B uses unknown floating point ABI %d"),
               obfd, abi_fp_bfd, ibfd, out_string, in_fp);
@@ -15350,6 +15375,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
              else if (out_fp == Val_GNU_MIPS_ABI_FP_SOFT)
                in_string = "-mhard-float";
              _bfd_error_handler
+               /* xgettext:c-format */
                (_("Warning: %B uses %s (set by %B), %B uses %s"),
                 obfd, abi_fp_bfd, ibfd, out_string, in_string);
            }
@@ -15368,6 +15394,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
          {
          case Val_GNU_MIPS_ABI_MSA_128:
            _bfd_error_handler
+             /* xgettext:c-format */
              (_("Warning: %B uses %s (set by %B), "
                 "%B uses unknown MSA ABI %d"),
               obfd, abi_msa_bfd, ibfd,
@@ -15379,6 +15406,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
              {
              case Val_GNU_MIPS_ABI_MSA_128:
                _bfd_error_handler
+                 /* xgettext:c-format */
                  (_("Warning: %B uses unknown MSA ABI %d "
                     "(set by %B), %B uses %s"),
                     obfd, abi_msa_bfd, ibfd,
@@ -15387,6 +15415,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
 
              default:
                _bfd_error_handler
+                 /* xgettext:c-format */
                  (_("Warning: %B uses unknown MSA ABI %d "
                     "(set by %B), %B uses unknown MSA ABI %d"),
                   obfd, abi_msa_bfd, ibfd,
@@ -15398,7 +15427,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
     }
 
   /* Merge Tag_compatibility attributes and any common GNU ones.  */
-  return _bfd_elf_merge_object_attributes (ibfd, obfd);
+  return _bfd_elf_merge_object_attributes (ibfd, info);
 }
 
 /* Merge object ABI flags from IBFD into OBFD.  Raise an error if
@@ -15437,8 +15466,9 @@ mips_elf_merge_obj_abiflags (bfd *ibfd, bfd *obfd)
    object file when linking.  */
 
 bfd_boolean
-_bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+_bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 {
+  bfd *obfd = info->output_bfd;
   struct mips_elf_obj_tdata *out_tdata;
   struct mips_elf_obj_tdata *in_tdata;
   bfd_boolean null_input_bfd = TRUE;
@@ -15446,7 +15476,7 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
   bfd_boolean ok;
 
   /* Check if we have the same endianness.  */
-  if (! _bfd_generic_verify_endian_match (ibfd, obfd))
+  if (! _bfd_generic_verify_endian_match (ibfd, info))
     {
       _bfd_error_handler
        (_("%B: endianness incompatible with that of the selected emulation"),
@@ -15575,9 +15605,9 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
       ok = TRUE;
     }
   else
-    ok = mips_elf_merge_obj_e_flags (ibfd, obfd);
+    ok = mips_elf_merge_obj_e_flags (ibfd, info);
 
-  ok = mips_elf_merge_obj_attributes (ibfd, obfd) && ok;
+  ok = mips_elf_merge_obj_attributes (ibfd, info) && ok;
 
   ok = mips_elf_merge_obj_abiflags (ibfd, obfd) && ok;