]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60731 (dynamic library not getting reinitialized on multiple calls to dlopen())
authorJason Merrill <jason@redhat.com>
Fri, 13 Jun 2014 16:39:37 +0000 (12:39 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 13 Jun 2014 16:39:37 +0000 (12:39 -0400)
PR c++/60731
* common.opt (-fno-gnu-unique): Add.
* config/elfos.h (USE_GNU_UNIQUE_OBJECT): Check it.

From-SVN: r211648

gcc/ChangeLog
gcc/common.opt
gcc/config/elfos.h
gcc/doc/invoke.texi

index 250fb001d50c02d63b6f0f345a0adf388488b51b..c950ee7e6df4f2b4255349970a38fc3e341dcdb4 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-13  Jason Merrill  <jason@redhat.com>
+
+       PR c++/60731
+       * common.opt (-fno-gnu-unique): Add.
+       * config/elfos.h (USE_GNU_UNIQUE_OBJECT): Check it.
+
 2014-06-12  Georg-Johann Lay  <avr@gjlay.de>
 
        Backport from 2014-05-09 trunk r210272
index bdbd3b6cd9ea549490137779d29e53cfdb0d7fe0..ec4cafc448bfb969485f92faddc612bd54c432d0 100644 (file)
@@ -1226,6 +1226,10 @@ fgnu-tm
 Common Report Var(flag_tm)
 Enable support for GNU transactional memory
 
+fgnu-unique
+Common Report Var(flag_gnu_unique) Init(1)
+Use STB_GNU_UNIQUE if supported by the assembler
+
 floop-flatten
 Common Ignore
 Does nothing. Preserved for backward compatibility.
index 438302345cf1138bd3d805b6b8180ccce470e2f4..43aab7362f3d517e142c8738f4642ae5d050d0cd 100644 (file)
@@ -287,7 +287,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 /* Write the extra assembler code needed to declare an object properly.  */
 
 #ifdef HAVE_GAS_GNU_UNIQUE_OBJECT
-#define USE_GNU_UNIQUE_OBJECT 1
+#define USE_GNU_UNIQUE_OBJECT flag_gnu_unique
 #else
 #define USE_GNU_UNIQUE_OBJECT 0
 #endif
index c39192b7fb1e2c38b85c10ded260bd64af76f8e7..dcb3d776731abd49ad56184e9113ba14afea34a3 100644 (file)
@@ -1009,6 +1009,7 @@ See S/390 and zSeries Options.
 -ffixed-@var{reg}  -fexceptions @gol
 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
 -fasynchronous-unwind-tables @gol
+-fno-gnu-unique @gol
 -finhibit-size-directive  -finstrument-functions @gol
 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
@@ -20357,6 +20358,20 @@ Generate unwind table in DWARF 2 format, if supported by target machine.  The
 table is exact at each instruction boundary, so it can be used for stack
 unwinding from asynchronous events (such as debugger or garbage collector).
 
+@item -fno-gnu-unique
+@opindex fno-gnu-unique
+On systems with recent GNU assembler and C library, the C++ compiler
+uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
+of template static data members and static local variables in inline
+functions are unique even in the presence of @code{RTLD_LOCAL}; this
+is necessary to avoid problems with a library used by two different
+@code{RTLD_LOCAL} plugins depending on a definition in one of them and
+therefore disagreeing with the other one about the binding of the
+symbol.  But this causes @code{dlclose} to be ignored for affected
+DSOs; if your program relies on reinitialization of a DSO via
+@code{dlclose} and @code{dlopen}, you can use
+@option{-fno-gnu-unique}.
+
 @item -fpcc-struct-return
 @opindex fpcc-struct-return
 Return ``short'' @code{struct} and @code{union} values in memory like