Allow for __gnu_lto_slim prefixed with extra "_"
authorAlan Modra <amodra@gmail.com>
Wed, 25 Oct 2017 05:02:52 +0000 (15:32 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 25 Oct 2017 05:02:52 +0000 (15:32 +1030)
Some targets prefix global symbols with "_".

bfd/
* archive.c (_bfd_compute_and_write_armap): Match "__gnu_lto_slim"
optionally prefixed with "_".
* linker.c (_bfd_generic_link_add_one_symbol): Likewise.
binutils/
* nm.c (filter_symbols): Match "__gnu_lto_slim" optionally prefixed
with "_".
gold/
* symtab.cc (Symbol_table::add_from_relobj): Match "__gnu_lto_slim"
optionally prefixed with "_".
ld/
* testsuite/ld-plugin/lto-3r.d: Match "__gnu_lto_v" optionally
prefixed with "_".
* testsuite/ld-plugin/lto-5r.d: Likewise.

bfd/ChangeLog
bfd/archive.c
bfd/linker.c
binutils/ChangeLog
binutils/nm.c
gold/ChangeLog
gold/symtab.cc
ld/ChangeLog
ld/testsuite/ld-plugin/lto-3r.d
ld/testsuite/ld-plugin/lto-5r.d

index 6f2f5e3f168e4cded12d7ce54fbfd5dd275539e3..ca780aaadd9a28ccbc1d6f3b41bacbd1e2dfa35a 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-25  Alan Modra  <amodra@gmail.com>
+
+       * archive.c (_bfd_compute_and_write_armap): Match "__gnu_lto_slim"
+       optionally prefixed with "_".
+       * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
+
 2017-10-24  Andrew Waterman  <andrew@sifive.com>
 
        * elfnn-riscv.c (_bfd_riscv_relax_lui): Don't relax to c.lui
index 1e8768564304a7d2d7c66abf5b92e88fdc0efeec..0b98df34430503fe9ef6a729e18ae919e43b8ada 100644 (file)
@@ -2411,7 +2411,11 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
                          map = new_map;
                        }
 
-                     if (strcmp (syms[src_count]->name, "__gnu_lto_slim") == 0)
+                     if (syms[src_count]->name[0] == '_'
+                         && syms[src_count]->name[1] == '_'
+                         && strcmp (syms[src_count]->name
+                                    + (syms[src_count]->name[2] == '_'),
+                                    "__gnu_lto_slim") == 0)
                        _bfd_error_handler
                          (_("%B: plugin needed to handle lto object"),
                           current);
index 72d5705e639beb4af631099bd54ffb1b342323fb..a96c6ed1dd085080b76a70ff5ea5e13203ca2b61 100644 (file)
@@ -1403,7 +1403,9 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
     {
       row = COMMON_ROW;
       if (!bfd_link_relocatable (info)
-         && strcmp (name, "__gnu_lto_slim") == 0)
+         && name[0] == '_'
+         && name[1] == '_'
+         && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
        _bfd_error_handler
          (_("%B: plugin needed to handle lto object"), abfd);
     }
index ee0b81eb5a846a80739e3d4dd3ae10384d425d12..ad9d33bb9921ae5c0b204e3fd062778713844ff3 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-25  Alan Modra  <amodra@gmail.com>
+
+       * nm.c (filter_symbols): Match "__gnu_lto_slim" optionally prefixed
+       with "_".
+
 2017-10-18  Eric Botcazou  <ebotcazou@adacore.com>
 
        * MAINTAINERS: Add myself as Visium maintainer.
index 3328812656f09261f9d023dff7f10e485350c591..5b421785e5e07817bc6806fb239d9fc608987a46 100644 (file)
@@ -478,7 +478,9 @@ filter_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
       if (sym == NULL)
        bfd_fatal (bfd_get_filename (abfd));
 
-      if (strcmp (sym->name, "__gnu_lto_slim") == 0)
+      if (sym->name[0] == '_'
+         && sym->name[1] == '_'
+         && strcmp (sym->name + (sym->name[2] == '_'), "__gnu_lto_slim") == 0)
        non_fatal (_("%s: plugin needed to handle lto object"),
                   bfd_get_filename (abfd));
 
index 2184e9ac3338745ae40795ed75c983a042e43f52..4ab533d5775f8b5a536b6a43906238620adc67dc 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-25  Alan Modra  <amodra@gmail.com>
+
+       * symtab.cc (Symbol_table::add_from_relobj): Match "__gnu_lto_slim"
+       optionally prefixed with "_".
+
 2017-10-20  Sriraman Tallam  <tmsriram@google.com>
 
        * options.h (-z,text_unlikely_segment): New option.
index 1555de6e5b3c3a9cef26ebfb23bd208105e0d9b5..7ebcd6b568253fca14d344066e9b34f29aa82c02 100644 (file)
@@ -1185,7 +1185,9 @@ Symbol_table::add_from_relobj(
       const char* name = sym_names + st_name;
 
       if (!parameters->options().relocatable()
-         && strcmp (name, "__gnu_lto_slim") == 0)
+         && name[0] == '_'
+         && name[1] == '_'
+         && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
         gold_info(_("%s: plugin needed to handle lto object"),
                  relobj->name().c_str());
 
index 368a496fdef918eff2a088f4288c41a55976d82f..27024b60fff6b91befc3e55b8618ae08fcf49a55 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-25  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/ld-plugin/lto-3r.d: Match "__gnu_lto_v" optionally
+       prefixed with "_".
+       * testsuite/ld-plugin/lto-5r.d: Likewise.
+
 2017-10-25  Hans-Peter Nilsson  <hp@axis.com>
 
        * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Fix typo for istarget.
index 1d1befe90f687a6bfd0cba38b9adb2f0c3d5f413..3726718f2a069059922dc91f05b44b700c47bc3e 100644 (file)
@@ -3,5 +3,5 @@
 #nm: -p
 
 #...
-[0-9a-f]+ C __gnu_lto_v.*
+[0-9a-f]+ C _?__gnu_lto_v.*
 #pass
index 43e9a5c5a3ca81778972f76292b78cd82b6d11d5..ad1da7047b9c5d0314ce50a7e5a12f15e91d1d50 100644 (file)
@@ -3,5 +3,5 @@
 #nm: -p
 
 #...
-[0-9a-f]+ C __gnu_lto_v.*
+[0-9a-f]+ C _?__gnu_lto_v.*
 #pass