Stop the MIPS assembler from accepting ifunc symbols.
authorNick Clifton <nickc@redhat.com>
Thu, 16 Apr 2020 17:02:10 +0000 (18:02 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 16 Apr 2020 17:02:10 +0000 (18:02 +0100)
PR 25803
gas * config/obj-elf.c (obj_elf_type): Reject ifunc symbols on MIPS
targets.
* testsuite/gas/elf/elf.exp: Add MIPS targets to the list to skip
for the type-2 test.
* testsuite/gas/elf/type-noifunc.e: Update to allow for MIPS
targets running this test.

bfd * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Replace an
abort with a more helpful error message.

bfd/ChangeLog
bfd/elfxx-mips.c
gas/ChangeLog
gas/config/obj-elf.c
gas/testsuite/gas/elf/elf.exp
gas/testsuite/gas/elf/type-noifunc.e

index bb6b9f2261c226d29fbbecb8894114243765e013..7f361d7fb1823762842a2a307680a77709c46594 100644 (file)
@@ -1,3 +1,9 @@
+2020-04-16  Nick Clifton  <nickc@redhat.com>
+
+       PR 25803
+       * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Replace an
+       abort with a more helpful error message.
+
 2020-04-16  Alan Modra  <amodra@gmail.com>
 
        PR 25827
index ae8478270efc37b0227e81f5e8bceb53e28d953d..2f26d7ae832a5d1f05f69af35dd1142cbe3ebf49 100644 (file)
@@ -9311,12 +9311,21 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   hmips = (struct mips_elf_link_hash_entry *) h;
 
   /* Make sure we know what is going on here.  */
-  BFD_ASSERT (dynobj != NULL
-             && (h->needs_plt
-                 || h->is_weakalias
-                 || (h->def_dynamic
-                     && h->ref_regular
-                     && !h->def_regular)));
+  if (dynobj == NULL
+      || (! h->needs_plt
+         && ! h->is_weakalias
+         && (! h->def_dynamic
+             || ! h->ref_regular
+             || h->def_regular)))
+    {
+      if (h->type == STT_GNU_IFUNC)
+       _bfd_error_handler (_("IFUNC symbol %s in dynamic symbol table - IFUNCS are not supported"),
+                           h->root.root.string);
+      else
+       _bfd_error_handler (_("non-dynamic symbol %s in dynamic symbol table"),
+                           h->root.root.string);
+      return TRUE;
+    }
 
   hmips = (struct mips_elf_link_hash_entry *) h;
 
index 09ad599c5c914a99986ee9a9fa86e9f8bfea8bf1..e0c51ebcc5a054e3d083797e514da35ecac24eed 100644 (file)
@@ -1,3 +1,14 @@
+2020-04-16  Gagan Singh Sidhu  <broly@mac.com>
+           Nick Clifton  <nickc@redhat.com>
+
+       PR 25803
+       * config/obj-elf.c (obj_elf_type): Reject ifunc symbols on MIPS
+       targets.
+       * testsuite/gas/elf/elf.exp: Add MIPS targets to the list to skip
+       for the type-2 test.
+       * testsuite/gas/elf/type-noifunc.e: Update to allow for MIPS
+       targets running this test.
+
 2020-02-16  David Faust  <david.faust@oracle.com>
 
        * testsuite/gas/bpf/bpf.exp: Run jump32 tests.
index a6dcdaf4a7e4c21f73ec659f72a3bffccf53e90a..5e7e8f0877963107b367965eda2ab5288b20900a 100644 (file)
@@ -2177,6 +2177,10 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
               && bed->elf_osabi != ELFOSABI_FREEBSD)
        as_bad (_("symbol type \"%s\" is supported only by GNU "
                  "and FreeBSD targets"), type_name);
+      /* MIPS targets do not support IFUNCS.  */
+      else if (bed->target_id == MIPS_ELF_DATA)
+       as_bad (_("symbol type \"%s\" is not supported by "
+                    "MIPS targets"), type_name);
       elf_tdata (stdoutput)->has_gnu_osabi |= elf_gnu_osabi_ifunc;
       type = BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION;
     }
index c80175cc51d7947a5b17385e52ea2e974c06e2e2..31026e4148e229d2996cf03b68e0fed51140432e 100644 (file)
@@ -220,8 +220,9 @@ if { [is_elf_format] } then {
     # in the symbol type test.
     # We also need to exclude targets that do not support unique objects.
     if {    [istarget "*-*-hpux*"]
-        || [istarget "arm*-*-*"]
-        || [istarget "msp*-*-*"]
+        || [istarget "arm*-*-*"]       
+         || [istarget "mips*-*-*"]
+         || [istarget "msp*-*-*"]
         || [istarget "visium-*-*"]
         || ![supports_gnu_unique]
      } then {
index ddeadd7d3a2b1f3f5091c6cf8abdf2e3b439f04b..76a42d09b2438275cdc47b59d957e1082ea2a4d1 100644 (file)
@@ -1,5 +1,5 @@
  +.: 0+0 +1 +FUNC +LOCAL +DEFAULT +. function
  +.: 0+0 +1 +OBJECT +LOCAL +DEFAULT +. object
- +.: 0+1 +1 +TLS +LOCAL +DEFAULT +. tls_object
+ +[0-9]+: 0+1 +1 +TLS +LOCAL +DEFAULT +. tls_object
  +..: 0+2 +1 +NOTYPE +LOCAL +DEFAULT +. notype
  +..: 0+1 +1 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(ANSI_|)COM common
This page took 0.033632 seconds and 4 git commands to generate.