This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ver_test_8_2.so
- From: Ian Lance Taylor <iant at google dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: binutils at sourceware dot org
- Date: Mon, 19 May 2008 23:17:07 -0700
- Subject: Re: ver_test_8_2.so
- References: <20080519.230715.153896907.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> The command line that builds this in the testsuite fails on sparc
> because it tries to link CRT files into a shared library. That
> doesn't work because R_SPARC_PC22 et al. are not valid dynamic
> relocations.
>
> I suspect that bringing the CRT files into this shared library
> link is unintentional, and that we need to add something like
> "-nostartfiles" to the gold testsuite build command lines for
> such testcases.
I don't understand this. The command to generate ver_test_8_2.so
doesn't look much different from the command to generate any other
shared library in the testsuite. The -shared option should get gcc to
link in the right set of CRT files.
> But even with that fixed, two_file_test_2_pic.o also has relocations
> that cannot end up being dynamic on sparc. It's the same problem as
> that hit in the CRT files, R_SPARC_PC22 relocs against
> _GLOBAL_OFFSET_TABLE_
two_file_test_2_pic.o is compiled with -fpic, so how could it have a
reloc which can't be dynamic?
Hmmmm, I bet the problem is the version script used with
ver_test_8_2.so. That version script makes everything global--which
is not a good idea, but was the only way I could find to recreate the
problem report with the openssl libraries with KDE. Does something
like this patch fix the problem?
Ian
Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.98
diff -u -p -r1.98 symtab.cc
--- symtab.cc 8 May 2008 18:44:33 -0000 1.98
+++ symtab.cc 20 May 2008 06:16:48 -0000
@@ -1382,7 +1382,9 @@ Symbol_table::do_define_in_output_data(
if (binding == elfcpp::STB_LOCAL
|| this->version_script_.symbol_is_local(name))
this->force_local(sym);
- else if (version != NULL)
+ else if (version != NULL
+ && binding != elfcpp::STB_LOCAL
+ && visibility == elfcpp::STV_DEFAULT)
sym->set_is_default();
return sym;
}