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]

One and a half bugs plus some hacks


Hi all,

I have been building KDE using gold for about a week now - with a
slightly patched version of gold that I want to put up for discussion.
The issues that I found are:
-when "copying" a symbol from a dynamic library to the output file
gold will not change the visibility. This is broken for symbols with
protected visibility in the source. As hidden symbols will be ignored
anyway it's safe to always give those symbols default (=="public")
visibility. This mattered when linking the xine multimedia libraries
which contain protected and exported symbols.
 -gold does not ignore almost completely unimportant options. Or maybe
I just want it to compile my stuff without tinkering with the
buildsystem too much :)
-gold aborts with an error message about "undefined symbol version
OPENSSL_0.9.8" (paraphrased) in one instance when linking against
openssl.

The following patch makes gold link KDE without modifications to KDE.
It contains things that very obviously don't belong into gold CVS but
have a look. The first issue seems to be a clear bug, not sure about
the third.
 The first hunk of the patch "fixes" the third issue for me.
One more thing: What about the seemingly unnecessary TEXTREL thingies
that gold does not remove? Would that be just too slow to do or has
just nobody gotten around to doing it? FWIW, the size and runtime
impact seem to be quite small anyway.
 The sorting issue was just resolved which is cool :)

-------------------------snip--------------------------
 Index: dynobj.cc
===================================================================
RCS file: /cvs/src/src/gold/dynobj.cc,v
retrieving revision 1.38
diff -u -r1.38 dynobj.cc
--- dynobj.cc 19 Apr 2008 18:30:58 -0000 1.38

+++ dynobj.cc 3 May 2008 18:56:16 -0000
@@ -1387,7 +1387,7 @@
 // If we are creating a shared object, it is an error to
 // find a definition of a symbol with a version which is not
 // in the version script.

- if (parameters->options().shared())
+ if (parameters->options().shared() && false) //for kopete's libgadu
 {
 gold_error(_("symbol %s has undefined version %s"),
 sym->demangled_name().c_str(), version);

Index: options.cc
===================================================================
RCS file: /cvs/src/src/gold/options.cc,v
retrieving revision 1.71
diff -u -r1.71 options.cc
--- options.cc 17 Apr 2008 22:45:47 -0000 1.71

+++ options.cc 3 May 2008 18:56:18 -0000
@@ -357,6 +357,12 @@
 cmdline->inputs().end_group();
 }

+void
+General_options::parse_no_undefined(const char*, const char*, Command_line*)
+{
+ this->set_defs(true);

+}
+
 } // End namespace gold.

 namespace
@@ -907,6 +913,9 @@
 }
 if (option)
 return new_i;
+ else if (!strcmp(argv[i], "-Bsymbolic-functions")
+ || !strcmp(argv[i], "--fatal-warnings")) //### ignore, don't fail

+ return i + 1;

 // I guess it's neither a long option nor a short option.
 usage(_("unknown option"), argv[i]);
Index: options.h
===================================================================

RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.72
diff -u -r1.72 options.h
--- options.h 17 Apr 2008 22:45:47 -0000 1.72
+++ options.h 3 May 2008 18:56:20 -0000
@@ -706,6 +706,11 @@
 DEFINE_bool(defs, options::DASH_Z, '\0', false,

 N_("Report undefined symbols (even with --shared)"),
 NULL);
+ // --no-undefined is an alias for "-z defs"; the special parser function
+ // also modifies the boolean "defs".

+ DEFINE_special(no_undefined, options::TWO_DASHES, '\0',
+ N_("Report undefined symbols (even with --shared)"),
+ NULL);
 DEFINE_bool(execstack, options::DASH_Z, '\0', false,

 N_("Mark output as requiring executable stack"), NULL);
 DEFINE_uint64(max_page_size, options::DASH_Z, '\0', 0,
Index: symtab.cc
===================================================================

RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.95
diff -u -r1.95 symtab.cc
--- symtab.cc 1 May 2008 00:25:33 -0000 1.95
+++ symtab.cc 3 May 2008 18:56:25 -0000
@@ -1043,6 +1043,11 @@
 }

 }

+ // A symbol protected in its (dynamic library) source must be
+ // resolved from source in the destination thus it may *NOT*
+ // be protected in the destination.
+ res->set_visibility_default(); //for phonon_xine.so and general sanity

+
 // Note that it is possible that RES was overridden by an
 // earlier object, in which case it can't be aliased here.
 if (st_shndx != elfcpp::SHN_UNDEF
Index: symtab.h
===================================================================

RCS file: /cvs/src/src/gold/symtab.h,v
retrieving revision 1.75
diff -u -r1.75 symtab.h
--- symtab.h 19 Apr 2008 18:30:58 -0000 1.75
+++ symtab.h 3 May 2008 18:56:36 -0000
@@ -203,6 +203,11 @@
 visibility() const

 { return this->visibility_; }

+ // Set the symbol visibility to STV_DEFAULT.
+ void
+ set_visibility_default()
+ { this->visibility_ = elfcpp::STV_DEFAULT; }
+
 // Return the non-visibility part of the st_other field.

 unsigned char
 nonvis() const

-------------------------snip--------------------------



Cheers,
Andreas


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