This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_29-branch] Allow for __gnu_lto_slim prefixed with extra "_"


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e6b4adf53138eaf344802bc1ce41943d451d0430

commit e6b4adf53138eaf344802bc1ce41943d451d0430
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Oct 25 15:32:52 2017 +1030

    Allow for __gnu_lto_slim prefixed with extra "_"
    
    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.
    
    (cherry picked from commit e601d38b7cc222345d4128f45db18529b9fb477b)

Diff:
---
 bfd/ChangeLog                   | 8 ++++++++
 bfd/archive.c                   | 6 +++++-
 bfd/linker.c                    | 4 +++-
 binutils/ChangeLog              | 7 +++++++
 binutils/nm.c                   | 4 +++-
 gold/ChangeLog                  | 7 +++++++
 gold/symtab.cc                  | 4 +++-
 ld/ChangeLog                    | 8 ++++++++
 ld/testsuite/ld-plugin/lto-3r.d | 2 +-
 ld/testsuite/ld-plugin/lto-5r.d | 2 +-
 10 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cd0a8f2..320e3f5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2017-11-01  Alan Modra  <amodra@gmail.com>
+
+	Apply from master
+	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-05  Alan Modra  <amodra@gmail.com>
 
 	* elflink.c (elf_link_input_bfd): Correct ctor/dtor in init_array/
diff --git a/bfd/archive.c b/bfd/archive.c
index 885bf48..af964ad 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2405,7 +2405,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);
diff --git a/bfd/linker.c b/bfd/linker.c
index 72d5705..a96c6ed 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -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);
     }
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index ffb34fb..6856b61 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2017-11-01  Alan Modra  <amodra@gmail.com>
+
+	Apply from master
+	2017-10-25  Alan Modra  <amodra@gmail.com>
+	* nm.c (filter_symbols): Match "__gnu_lto_slim" optionally prefixed
+	with "_".
+
 2017-09-21  Maciej W. Rozycki  <macro@imgtec.com>
 
 	* readelf.c (get_machine_flags) <E_MIPS_MACH_5900>: New case.
diff --git a/binutils/nm.c b/binutils/nm.c
index 7ddcc8a..2d8866c 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -480,7 +480,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));
 
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 622a63a..c8633e4 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,10 @@
+2017-11-01  Alan Modra  <amodra@gmail.com>
+
+	Apply from master
+	2017-10-25  Alan Modra  <amodra@gmail.com>
+	* symtab.cc (Symbol_table::add_from_relobj): Match "__gnu_lto_slim"
+	optionally prefixed with "_".
+
 2017-10-18  Kyle Butt  <iteratee@google.com>
 	    Alan Modra  <amodra@gmail.com>
 
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 7e0a3f8..1b4810e 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -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());
 
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ba67e20..364b104 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2017-11-01  Alan Modra  <amodra@gmail.com>
+
+	Apply from master
+	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-09-28  Alan Modra  <amodra@gmail.com>
 
 	* testsuite/ld-plugin/pr22220.h,
diff --git a/ld/testsuite/ld-plugin/lto-3r.d b/ld/testsuite/ld-plugin/lto-3r.d
index 1d1befe..3726718 100644
--- a/ld/testsuite/ld-plugin/lto-3r.d
+++ b/ld/testsuite/ld-plugin/lto-3r.d
@@ -3,5 +3,5 @@
 #nm: -p
 
 #...
-[0-9a-f]+ C __gnu_lto_v.*
+[0-9a-f]+ C _?__gnu_lto_v.*
 #pass
diff --git a/ld/testsuite/ld-plugin/lto-5r.d b/ld/testsuite/ld-plugin/lto-5r.d
index 43e9a5c..ad1da70 100644
--- a/ld/testsuite/ld-plugin/lto-5r.d
+++ b/ld/testsuite/ld-plugin/lto-5r.d
@@ -3,5 +3,5 @@
 #nm: -p
 
 #...
-[0-9a-f]+ C __gnu_lto_v.*
+[0-9a-f]+ C _?__gnu_lto_v.*
 #pass


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]