[Bug ld/12548] anonymous version scripts no longer working with binutils 2.21

2015-12-22 Thread lionel at mamane dot lu
https://sourceware.org/bugzilla/show_bug.cgi?id=12548

--- Comment #20 from Lionel Elie Mamane  ---
(In reply to Nick Clifton from comment #19)
> Created attachment 8860 [details]
> Solaris specific version of previous patch

>   I think that the problem is that the original patch affects generic linker
> code, and in a way that is likely to be a regression for other OSes.

Bug 13406 has been marked as a duplicate of this patch, but is not a
Solaris-specific patch, so would not be solved by a Solaris-specific patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/12548] anonymous version scripts no longer working with binutils 2.21

2012-11-13 Thread lionel at mamane dot lu
http://sourceware.org/bugzilla/show_bug.cgi?id=12548

--- Comment #17 from Lionel Elie Mamane lionel at mamane dot lu 2012-11-13 
22:50:34 UTC ---
I confirm that patch in attachment 6734 solves bug 13406 for me (testcase:
attachment 6057)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/13406] version script: please allow anonymous tag to be combined with other tags

2011-11-14 Thread lionel at mamane dot lu
http://sourceware.org/bugzilla/show_bug.cgi?id=13406

--- Comment #1 from Lionel Elie Mamane lionel at mamane dot lu 2011-11-15 
04:42:08 UTC ---
Created attachment 6057
  -- http://sourceware.org/bugzilla/attachment.cgi?id=6057
minimal test-case

Here's a minimal test-case to reproduce:


$ make -j foo-abort  ./foo-abort; echo Return value: $?
(...)
*** glibc detected *** ./foo-abort: free(): invalid pointer: 0x7f953651c4a0
***
=== Backtrace: =
(...)
=== Memory map: 
(...)
Aborted
Return value: 134


After patching ld with my patch:

$ make -j foo-ok  ./foo-ok; echo Return value: $?
(...)
Return value: 0

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/13406] New: version script: please allow anonymous tag to be combined with other tags

2011-11-12 Thread lionel at mamane dot lu
http://sourceware.org/bugzilla/show_bug.cgi?id=13406

 Bug #: 13406
   Summary: version script: please allow anonymous tag to be
combined with other tags
   Product: binutils
   Version: 2.21
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: binutils
AssignedTo: unassig...@sourceware.org
ReportedBy: lio...@mamane.lu
Classification: Unclassified


Created attachment 6054
  -- http://sourceware.org/bugzilla/attachment.cgi?id=6054
patch to allow anonymous version tag combined with non-anonymous version tag

In a version script, currently one is not allowed to use an anonymous version
tag along with another tag. I'm not sure why that is,
http://cygwin.com/ml/binutils/2001-12/msg00182.html says per Ulrich's
request.

I would like that to be allowed.

My use case is within LibreOffice, which is structured as an executable that
(lazily, as the need my arise) dlopen()s various libraries, which themselves
lazily dlopen() the libraries they need, ... These libraries use version link
scripts along the lines of:


UDK_3_0_0 {
global:
_ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions
component_writeInfo;
component_getFactory;
local:
*;
};

In particular, they hide (not export) all symbols by default. This plays out
badly with an optimisation within libstdc++, which is that when an empty
std::string is created, it does not get memory allocated from the heap, but the
internal data pointer points to a unique static address allocated by the linker
via a unique symbol (_S_empty_rep_storage). The std::string destructor
special-cases that address to avoid calling heap deallocation on it.

The situation is that a library using such a version script (an internal
library of LibreOffice, mysqlc.uno.so; that is the native driver to MySQL for
LibreOffice) ldopen()s a library that does *not* use such a version script (a
library that is external to LibreOffice, libmysqlcppconn.so; that is the
official C++ API to MySQL: http://www.mysql.com/downloads/connector/cpp/).

The core of the problem is that because of the local: *; in the version
script of mysqlc.uno.so, mysqlc.uno.so and libmysqlcppconn.so have a
*different* _S_empty_rep_storage symbol; the linker does *not* merge them. So
when code in mysqlc.uno.so calls a function in libmysqlcppconn.so, gets an
empty std::string and that std::string goes out of scope:

1) The empty std::string is constructed within libmysqlcppconn.so, so its
internal data pointer points to libmysqlcppconn's _S_empty_rep_storage.

2) That std::string is destructed in mysqlc.uno.so, so (code equivalent to)
this is executed within mysqlc.uno.so:

if (the_string.pData != _S_empty_rep_storage)
   free(the_string.pData)

As it is compared to the address of mysqlc.uno's _S_empty_rep_storage, the test
evaluates to false, and heap deallocation is called on libmysqlcppconn.so's
_S_empty_rep_storage, which was not heap allocated, and all hell breaks loose
;-) In particular, in libstdc++ debug mode (compile with -D_GLIBCXX_DEBUG),
this immediately aborts the whole program.

To avoid that, I would like to add to mysqlc.uno.so's version link script:

{
global:
_ZNSs4_Rep20_S_empty_rep_storageE;
};

Patch is attached. Tested, works for me, solves the described problem within
LibreOffice.

This would also solve bug 12548 as a side-effect :)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/13406] version script: please allow anonymous tag to be combined with other tags

2011-11-12 Thread lionel at mamane dot lu
http://sourceware.org/bugzilla/show_bug.cgi?id=13406

Lionel Elie Mamane lionel at mamane dot lu changed:

   What|Removed |Added

   Attachment #6054|0   |1
   is patch||
   Attachment #6054|application/octet-stream|text/plain
  mime type||

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/12548] anonymous version scripts no longer working with binutils 2.21

2011-11-12 Thread lionel at mamane dot lu
http://sourceware.org/bugzilla/show_bug.cgi?id=12548

Lionel Elie Mamane lionel at mamane dot lu changed:

   What|Removed |Added

 CC||lionel at mamane dot lu

--- Comment #1 from Lionel Elie Mamane lionel at mamane dot lu 2011-11-12 
23:49:50 UTC ---
(In reply to comment #0)
 I upgraded our build system from binutils 2.20 and gcc 4.4.3 to binutils 2.21
 and gcc 4.5.2. This unfortunately broke support for anonymous version scripts.
 /usr/lib/gcc/sparc-sun-solaris2.10/4.5.2/../../../../sparc-sun-solaris2.10/bin/ld:
 anonymous version tag cannot be combined with other version tags

 The problem is specific to the Solaris/sparc backend.

 After some digging, I found that the problem is in ld/emultempl/solaris2.em,
 which is part of the new Solaris 2 ABI stuff. It tries to add a new version
 section for a bunch of symbols, which of course won't work when there is
 already an anonymous section from the command line.

 I'm not sure how to proceed here. I have to assume this version section is
 being added for a reason, so I can't just remove it. Perhaps the entries need
 to be merged with the existing section?

Or more prosaically, allow an anonymous version tag to cohabit with a named
version tag. I just requested that for different reasons in bug 13406.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils