This is the mail archive of the binutils@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]

Re: gold's script_test_4


From: David Miller <davem@davemloft.net>
Date: Mon, 18 Aug 2008 16:22:23 -0700 (PDT)

> Nevermind, I misread the make check log, it failed because of that old
> problem we've had for months on sparc which still hasn't been fixed:
> 
> g++ -W -Wall   -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -g -O2   -o ver_test_8_2.so -Bgcctestdir/ -shared -Wl,--version-script,../../../src/gold/testsuite/ver_test_8.script two_file_test_2_pic.o
> gcctestdir/ld: /usr/lib/gcc/sparc-linux-gnu/4.1.3/../../../../lib/crti.o: requires unsupported dynamic reloc; recompile with -fPIC
> gcctestdir/ld: /usr/lib/gcc/sparc-linux-gnu/4.1.3/crtbeginS.o: requires unsupported dynamic reloc; recompile with -fPIC
> gcctestdir/ld: two_file_test_2_pic.o: requires unsupported dynamic reloc; recompile with -fPIC
> gcctestdir/ld: /usr/lib/gcc/sparc-linux-gnu/4.1.3/crtendS.o: requires unsupported dynamic reloc; recompile with -fPIC
> collect2: ld returned 1 exit status

So I tried to whip up a quick patch which implements what
you seemed to be suggesting the first time this came up:

	http://sourceware.org/ml/binutils/2008-05/msg00162.html

But it doesn't seem to fix the testcase on sparc.

Perhaps I made some mistake or didn't implement everything necessary,
it is a very complicated area of the linker version handling.  :-)

Index: i386.cc
===================================================================
RCS file: /cvs/src/src/gold/i386.cc,v
retrieving revision 1.79
diff -u -u -r1.79 i386.cc
--- i386.cc	4 Aug 2008 22:22:13 -0000	1.79
+++ i386.cc	19 Aug 2008 07:05:53 -0000
@@ -454,7 +454,7 @@
 				    0, 0, elfcpp::STT_OBJECT,
 				    elfcpp::STB_LOCAL,
 				    elfcpp::STV_HIDDEN, 0,
-				    false, false);
+				    false, false, true);
     }
 
   return this->got_;
Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.112
diff -u -u -r1.112 layout.cc
--- layout.cc	13 Aug 2008 07:37:46 -0000	1.112
+++ layout.cc	19 Aug 2008 07:05:53 -0000
@@ -1008,7 +1008,7 @@
 
   symtab->define_in_output_data("_DYNAMIC", NULL, this->dynamic_section_, 0, 0,
 				elfcpp::STT_OBJECT, elfcpp::STB_LOCAL,
-				elfcpp::STV_HIDDEN, 0, false, false);
+				elfcpp::STV_HIDDEN, 0, false, false, false);
 
   this->dynamic_data_ =  new Output_data_dynamic(&this->dynpool_);
 
@@ -1048,7 +1048,8 @@
 					elfcpp::STV_DEFAULT,
 					0, // nonvis
 					false, // offset_is_from_end
-					true); // only_if_ref
+					true,  // only_if_ref
+					false); // def
 
 	  symtab->define_in_output_data(stop_name.c_str(),
 					NULL, // version
@@ -1060,7 +1061,8 @@
 					elfcpp::STV_DEFAULT,
 					0, // nonvis
 					true, // offset_is_from_end
-					true); // only_if_ref
+					true, // only_if_ref
+					false); // def
 	}
     }
 }
Index: powerpc.cc
===================================================================
RCS file: /cvs/src/src/gold/powerpc.cc,v
retrieving revision 1.6
diff -u -u -r1.6 powerpc.cc
--- powerpc.cc	4 Aug 2008 22:22:13 -0000	1.6
+++ powerpc.cc	19 Aug 2008 07:05:53 -0000
@@ -721,7 +721,7 @@
 				    0, 0, elfcpp::STT_OBJECT,
 				    elfcpp::STB_LOCAL,
 				    elfcpp::STV_HIDDEN, 0,
-				    false, false);
+				    false, false, true);
     }
 
   return this->got_;
@@ -935,7 +935,7 @@
 				    0, 0, elfcpp::STT_OBJECT,
 				    elfcpp::STB_LOCAL,
 				    elfcpp::STV_HIDDEN, 0,
-				    false, false);
+				    false, false, true);
     }
 
   this->plt_->add_entry(gsym);
@@ -1464,7 +1464,7 @@
 				  elfcpp::STT_OBJECT,
 				  elfcpp::STB_LOCAL,
 				  elfcpp::STV_HIDDEN, 0,
-				  false, false);
+				  false, false, true);
   }
 
   gold::scan_relocs<size, big_endian, Powerpc, elfcpp::SHT_RELA, Scan>(
Index: sparc.cc
===================================================================
RCS file: /cvs/src/src/gold/sparc.cc,v
retrieving revision 1.10
diff -u -u -r1.10 sparc.cc
--- sparc.cc	4 Aug 2008 22:22:13 -0000	1.10
+++ sparc.cc	19 Aug 2008 07:05:53 -0000
@@ -1015,7 +1015,7 @@
 				    0, 0, elfcpp::STT_OBJECT,
 				    elfcpp::STB_LOCAL,
 				    elfcpp::STV_HIDDEN, 0,
-				    false, false);
+				    false, false, true);
     }
 
   return this->got_;
@@ -1359,7 +1359,7 @@
 				    0, 0, elfcpp::STT_OBJECT,
 				    elfcpp::STB_LOCAL,
 				    elfcpp::STV_HIDDEN, 0,
-				    false, false);
+				    false, false, true);
     }
 
   this->plt_->add_entry(gsym);
Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.107
diff -u -u -r1.107 symtab.cc
--- symtab.cc	23 Jul 2008 23:44:02 -0000	1.107
+++ symtab.cc	19 Aug 2008 07:05:54 -0000
@@ -1260,13 +1260,14 @@
 template<int size, bool big_endian>
 Sized_symbol<size>*
 Symbol_table::define_special_symbol(const char** pname, const char** pversion,
-				    bool only_if_ref,
+				    bool only_if_ref, bool def,
                                     Sized_symbol<size>** poldsym)
 {
   Symbol* oldsym;
   Sized_symbol<size>* sym;
-  bool add_to_table = false;
+  bool add_to_table = false, add_to_table_2 = false;
   typename Symbol_table_type::iterator add_loc = this->table_.end();
+  typename Symbol_table_type::iterator add_loc_2;
 
   // If the caller didn't give us a version, see if we get one from
   // the version script.
@@ -1305,6 +1306,16 @@
 							  version_key),
 					   snull));
 
+      std::pair<typename Symbol_table_type::iterator, bool> insdef =
+	      std::make_pair(this->table_.end(), false);
+      if (def)
+      {
+	      const Stringpool::Key vnull_key = 0;
+	      insdef = this->table_.insert(std::make_pair(std::make_pair(name_key,
+									 vnull_key),
+							  snull));
+      }
+
       if (!ins.second)
 	{
 	  // We already have a symbol table entry for NAME/VERSION.
@@ -1317,6 +1328,11 @@
 	  gold_assert(ins.first->second == NULL);
           add_to_table = true;
           add_loc = ins.first;
+	  if (def)
+	    {
+	      add_to_table_2 = true;
+	      add_loc_2 = insdef.first;
+	    }
 	  oldsym = NULL;
 	}
     }
@@ -1337,7 +1353,11 @@
     }
 
   if (add_to_table)
-    add_loc->second = sym;
+    {
+      add_loc->second = sym;
+      if (add_to_table_2)
+	add_loc_2->second = sym;
+    }
   else
     gold_assert(oldsym != NULL);
 
@@ -1359,7 +1379,8 @@
 				    elfcpp::STV visibility,
 				    unsigned char nonvis,
 				    bool offset_is_from_end,
-				    bool only_if_ref)
+				    bool only_if_ref,
+				    bool def)
 {
   if (parameters->target().get_size() == 32)
     {
@@ -1368,7 +1389,7 @@
                                                 value, symsize, type, binding,
                                                 visibility, nonvis,
                                                 offset_is_from_end,
-                                                only_if_ref);
+                                                only_if_ref, def);
 #else
       gold_unreachable();
 #endif
@@ -1380,7 +1401,7 @@
                                                 value, symsize, type, binding,
                                                 visibility, nonvis,
                                                 offset_is_from_end,
-                                                only_if_ref);
+                                                only_if_ref, def);
 #else
       gold_unreachable();
 #endif
@@ -1404,7 +1425,8 @@
     elfcpp::STV visibility,
     unsigned char nonvis,
     bool offset_is_from_end,
-    bool only_if_ref)
+    bool only_if_ref,
+    bool def)
 {
   Sized_symbol<size>* sym;
   Sized_symbol<size>* oldsym;
@@ -1413,7 +1435,8 @@
     {
 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
       sym = this->define_special_symbol<size, true>(&name, &version,
-						    only_if_ref, &oldsym);
+						    only_if_ref, def,
+						    &oldsym);
 #else
       gold_unreachable();
 #endif
@@ -1422,7 +1445,8 @@
     {
 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
       sym = this->define_special_symbol<size, false>(&name, &version,
-						     only_if_ref, &oldsym);
+						     only_if_ref, def,
+						     &oldsym);
 #else
       gold_unreachable();
 #endif
@@ -1514,7 +1538,8 @@
     {
 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
       sym = this->define_special_symbol<size, true>(&name, &version,
-						    only_if_ref, &oldsym);
+						    only_if_ref, false,
+						    &oldsym);
 #else
       gold_unreachable();
 #endif
@@ -1523,7 +1548,8 @@
     {
 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
       sym = this->define_special_symbol<size, false>(&name, &version,
-						     only_if_ref, &oldsym);
+						     only_if_ref, false,
+						     &oldsym);
 #else
       gold_unreachable();
 #endif
@@ -1615,7 +1641,8 @@
     {
 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
       sym = this->define_special_symbol<size, true>(&name, &version,
-						    only_if_ref, &oldsym);
+						    only_if_ref, false,
+						    &oldsym);
 #else
       gold_unreachable();
 #endif
@@ -1624,7 +1651,8 @@
     {
 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
       sym = this->define_special_symbol<size, false>(&name, &version,
-						     only_if_ref, &oldsym);
+						     only_if_ref, false,
+						     &oldsym);
 #else
       gold_unreachable();
 #endif
@@ -1673,7 +1701,8 @@
 				    p->size, p->type, p->binding,
 				    p->visibility, p->nonvis,
 				    p->offset_is_from_end,
-				    only_if_ref || p->only_if_ref);
+				    only_if_ref || p->only_if_ref,
+				    false);
       else
 	this->define_as_constant(p->name, NULL, 0, p->size, p->type,
 				 p->binding, p->visibility, p->nonvis,
@@ -1735,7 +1764,7 @@
 			      posd, value, csym->symsize(),
 			      csym->type(), binding,
 			      csym->visibility(), csym->nonvis(),
-			      false, false);
+			      false, false, false);
 
   csym->set_is_copied_from_dynobj();
   csym->set_needs_dynsym_entry();
@@ -1823,7 +1852,8 @@
 	{
 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
 	  sym = this->define_special_symbol<size, true>(&name, &version,
-							false, &oldsym);
+							false, false,
+							&oldsym);
 #else
 	  gold_unreachable();
 #endif
@@ -1832,7 +1862,8 @@
 	{
 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
 	  sym = this->define_special_symbol<size, false>(&name, &version,
-							 false, &oldsym);
+							 false, false,
+							 &oldsym);
 #else
 	  gold_unreachable();
 #endif
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gold/symtab.h,v
retrieving revision 1.82
diff -u -u -r1.82 symtab.h
--- symtab.h	4 Aug 2008 22:22:13 -0000	1.82
+++ symtab.h	19 Aug 2008 07:05:54 -0000
@@ -1160,7 +1160,8 @@
 			Output_data*, uint64_t value, uint64_t symsize,
 			elfcpp::STT type, elfcpp::STB binding,
 			elfcpp::STV visibility, unsigned char nonvis,
-			bool offset_is_from_end, bool only_if_ref);
+			bool offset_is_from_end, bool only_if_ref,
+			bool def);
 
   // Define a special symbol based on an Output_segment.  It is a
   // multiple definition error if this symbol is already defined.
@@ -1377,7 +1378,8 @@
   template<int size, bool big_endian>
   Sized_symbol<size>*
   define_special_symbol(const char** pname, const char** pversion,
-			bool only_if_ref, Sized_symbol<size>** poldsym);
+			bool only_if_ref, bool def,
+			Sized_symbol<size>** poldsym);
 
   // Define a symbol in an Output_data, sized version.
   template<int size>
@@ -1387,7 +1389,8 @@
 			   typename elfcpp::Elf_types<size>::Elf_WXword ssize,
 			   elfcpp::STT type, elfcpp::STB binding,
 			   elfcpp::STV visibility, unsigned char nonvis,
-			   bool offset_is_from_end, bool only_if_ref);
+			   bool offset_is_from_end, bool only_if_ref,
+			   bool def);
 
   // Define a symbol in an Output_segment, sized version.
   template<int size>
Index: x86_64.cc
===================================================================
RCS file: /cvs/src/src/gold/x86_64.cc,v
retrieving revision 1.73
diff -u -u -r1.73 x86_64.cc
--- x86_64.cc	15 Aug 2008 04:57:46 -0000	1.73
+++ x86_64.cc	19 Aug 2008 07:05:54 -0000
@@ -463,7 +463,7 @@
 				    0, 0, elfcpp::STT_OBJECT,
 				    elfcpp::STB_LOCAL,
 				    elfcpp::STV_HIDDEN, 0,
-				    false, false);
+				    false, false, true);
     }
 
   return this->got_;


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