public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library
@ 2023-10-23 13:09 vincenzo.innocente at cern dot ch
  2023-10-23 13:23 ` [Bug libstdc++/111936] " vincenzo.innocente at cern dot ch
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-10-23 13:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

            Bug ID: 111936
           Summary: std::stacktrace cannot be used in a shared library
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch
  Target Milestone: ---

I would like to use std::stacktrace in a shared library to be preloaded...

when I try to build the library even for this minimal example
cat getStacktrace.cc
#include <stacktrace>

  std::string get_stacktrace() {
     std::string trace;
     for (auto & entry : std::stacktrace::current() ) trace +=
entry.description() + '#';
     return trace;
  }

it fails
 c++ -O3 -Wall -pthread -fPIC -shared getStacktrace.cc -std=c++23 -lstdc++exp
/usr/bin/ld:
/afs/cern.ch/work/i/innocent/public/w5/bin/../lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../lib64/libstdc++exp.a(std_stacktrace-fileline.o):
relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a
shared object; recompile with -fPIC
/usr/bin/ld:
/afs/cern.ch/work/i/innocent/public/w5/bin/../lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../lib64/libstdc++exp.a(std_stacktrace-posix.o):
relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a
shared object; recompile with -fPIC
/usr/bin/ld:
/afs/cern.ch/work/i/innocent/public/w5/bin/../lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../lib64/libstdc++exp.a(std_stacktrace-simple.o):
relocation R_X86_64_32 against `.text' can not be used when making a shared
object; recompile with -fPIC
/usr/bin/ld:
/afs/cern.ch/work/i/innocent/public/w5/bin/../lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../lib64/libstdc++exp.a(std_stacktrace-elf.o):
relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a
shared object; recompile with -fPIC
/usr/bin/ld:
/afs/cern.ch/work/i/innocent/public/w5/bin/../lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../lib64/libstdc++exp.a(std_stacktrace-mmap.o):
relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a
shared object; recompile with -fPIC
/usr/bin/ld:
/afs/cern.ch/work/i/innocent/public/w5/bin/../lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../lib64/libstdc++exp.a(std_stacktrace-mmapio.o):
relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a
shared object; recompile with -fPIC
/usr/bin/ld:
/afs/cern.ch/work/i/innocent/public/w5/bin/../lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../lib64/libstdc++exp.a(std_stacktrace-dwarf.o):
relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a
shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status


it silently compiles with
[innocent@patatrack01 ctest]$ c++ -O3 -Wall -pthread -fPIC -shared -std=c++23
-lstdc++exp getStacktrace.cc

but the symbols are undefined

[innocent@patatrack01 ctest]$ ldd ./a.out
        linux-vdso.so.1 (0x00007ffd50f73000)
        libstdc++.so.6 => /afs/cern.ch/user/i/innocent/w5/lib64/libstdc++.so.6
(0x00007fa9437f8000)
        libm.so.6 => /usr/lib64/libm.so.6 (0x00007fa943476000)
        libgcc_s.so.1 => /afs/cern.ch/user/i/innocent/w5/lib64/libgcc_s.so.1
(0x00007fa94324b000)
        libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fa94302b000)
        libc.so.6 => /usr/lib64/libc.so.6 (0x00007fa942c66000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fa943e68000)
[innocent@patatrack01 ctest]$ nm -C ./a.out | grep stack
0000000000000db0 T get_stacktrace[abi:cxx11]()
0000000000000be0 t get_stacktrace[abi:cxx11]() [clone .cold]
0000000000000d20 t std::basic_stacktrace<std::allocator<std::stacktrace_entry>
>::current(std::allocator<std::stacktrace_entry> const&) [clone .isra.0]
                 U std::stacktrace_entry::_Info::_M_populate(unsigned long)
0000000000001430 W std::stacktrace_entry::_Info::_S_set[abi:cxx11](void*, char
const*)
                 U std::__stacktrace_impl::_S_current(int (*)(void*, unsigned
long), void*, int)
0000000000001310 W std::basic_stacktrace<std::allocator<std::stacktrace_entry>
>::_M_prepare(unsigned short)::{lambda(void*, unsigned long)#1}::_FUN(void*,
unsigned long)


and at run time (not this example, my full application that invoke the
staketrace from a malloc hook) it (obviously fail)

[innocent@patatrack01 ctest]$ c++ -O3 -Wall -pthread -fPIC -shared -std=c++23
-lstdc++exp mallocWrapper.cc
[innocent@patatrack01 ctest]$ setenv LD_PRELOAD ./a.out ; ls ; unsetenv
LD_PRELOAD
Recoding structure constructed in a thread
ls: symbol lookup error: ./a.out: undefined symbol:
_ZNSt17__stacktrace_impl10_S_currentEPFiPvmES0_i

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
@ 2023-10-23 13:23 ` vincenzo.innocente at cern dot ch
  2023-10-23 14:28 ` redi at gcc dot gnu.org
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-10-23 13:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #1 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
here is a minimal malloc hook that I would like to use
[innocent@patatrack01 ctest]$ cat getStacktrace.cc
#include <stacktrace>

  std::string get_stacktrace() {
     std::string trace;
     for (auto & entry : std::stacktrace::current() ) trace +=
entry.description() + '#';
     return trace;
  }


#include <cstdlib>
#include <malloc.h>
#include <iostream>

extern "C"
void * myMallocHook(size_t size, void const * caller) {
  __malloc_hook = nullptr;
  auto p = malloc(size);
  std::cout << "asked " << size
            << " at " << get_stacktrace()
            << std::endl;
  __malloc_hook = myMallocHook;
  return p;
}

namespace {
struct Hook {
  Hook() {
  __malloc_hook = myMallocHook;
  }
};

  Hook hook;

}

compiled as
c++ -O3 -Wall -pthread -fPIC -shared -std=c++23 -lstdc++exp getStacktrace.cc

gives the undefined symbol

 setenv LD_PRELOAD ./a.out ; ls ; unsetenv LD_PRELOAD
ls: symbol lookup error: ./a.out: undefined symbol:
_ZNSt17__stacktrace_impl10_S_currentEPFiPvmES0_i

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
  2023-10-23 13:23 ` [Bug libstdc++/111936] " vincenzo.innocente at cern dot ch
@ 2023-10-23 14:28 ` redi at gcc dot gnu.org
  2023-10-23 14:32 ` redi at gcc dot gnu.org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-23 14:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to vincenzo Innocente from comment #0)
> it silently compiles with
> [innocent@patatrack01 ctest]$ c++ -O3 -Wall -pthread -fPIC -shared
> -std=c++23 -lstdc++exp getStacktrace.cc
> 
> but the symbols are undefined

This is simply because you need to list libraries after the files that depend
on them:
https://c-faq.com/lib/libsearch.html

When the linker sees -lstdc++exp there are no undefined references to any of
the symbols it provides, so the linker ignores it. Then it sees getStacktrace.o
which has undefined refs but it's too late, the archive has already been
processed.

The library should be compiled as PIC though, which is a separate issue.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
  2023-10-23 13:23 ` [Bug libstdc++/111936] " vincenzo.innocente at cern dot ch
  2023-10-23 14:28 ` redi at gcc dot gnu.org
@ 2023-10-23 14:32 ` redi at gcc dot gnu.org
  2023-10-23 14:32 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-23 14:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The problem is that libstdc++_libbacktrace.a is not compiled with -fPIC

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (2 preceding siblings ...)
  2023-10-23 14:32 ` redi at gcc dot gnu.org
@ 2023-10-23 14:32 ` redi at gcc dot gnu.org
  2023-10-23 16:13 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-23 14:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |link-failure
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Target Milestone|---                         |13.3
   Last reconfirmed|                            |2023-10-23

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (3 preceding siblings ...)
  2023-10-23 14:32 ` redi at gcc dot gnu.org
@ 2023-10-23 16:13 ` redi at gcc dot gnu.org
  2023-10-24 10:04 ` vincenzo.innocente at cern dot ch
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-23 16:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Testing a patch:

--- a/libstdc++-v3/src/libbacktrace/Makefile.am
+++ b/libstdc++-v3/src/libbacktrace/Makefile.am
@@ -49,9 +49,13 @@ WARN_FLAGS = -W -Wall -Wwrite-strings
-Wmissing-format-attribute \
             -Wcast-qual
 C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -Wno-unused-but-set-variable
 CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
-AM_CFLAGS = $(C_WARN_FLAGS)
+AM_CFLAGS = \
+       $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+       $(C_WARN_FLAGS)
 AM_CFLAGS += $(EXTRA_CFLAGS)
-AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
+AM_CXXFLAGS = \
+       $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+       $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
 AM_CXXFLAGS += $(EXTRA_CXXFLAGS)

 obj_prefix = std_stacktrace

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (4 preceding siblings ...)
  2023-10-23 16:13 ` redi at gcc dot gnu.org
@ 2023-10-24 10:04 ` vincenzo.innocente at cern dot ch
  2023-10-24 12:27 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-10-24 10:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #5 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
My bad, long time I'm not using archive libraries and forgot about the order
rule. 

The issue is indeed missing -fPIC.
Thanks for the fast action.

I applied the patch but it seems not sufficient.

If I well understood this is where the ar lib is built
ar  rc .libs/libstdc++_libbacktrace.a  std_stacktrace-atomic.o
std_stacktrace-backtrace.o std_stacktrace-dwarf.o std_stacktrace-fileline.o
std_stacktrace-posix.o std_stacktrace-sort.o std_stacktrace-simple.o std_sta
cktrace-state.o std_stacktrace-cp-demangle.o std_stacktrace-elf.o
std_stacktrace-mmapio.o std_stacktrace-mmap.o

but those are the file compiled w/o -fPIC
those with fPIC are under .libs itself...

so I did manually
```
ar rc .libs/libstdc++_libbacktrace.a .libs/*.o ../c++23/stacktrace.o

```

and then locally
c++ -O3 -pthread -fPIC -shared -std=c++23 getStacktrace.cc
/data/user/innocent/gcc_build/x86_64-pc-linux-gnu/libstdc++-v3/src/libbacktrace/.libs/libstdc++_libbacktrace.a
-g -o mallocHook.so


and runs
setenv LD_PRELOAD ./mallocHook.so ; ./a.out ; unsetenv LD_PRELOAD
asked 4 at ###std::__new_allocator<int>::allocate(unsigned long, void
const*)#std::allocator_traits<std::allocator<int>
>::allocate(std::allocator<int>&, unsigned long)#void std::vector<int,
std::allocator<int> >::_M_realloc_insert<int
const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>
> >, int const&)#std::vector<int, std::allocator<int> >::push_back(int
const&)#go(int)#main##_start##
asked 8 at ###std::__new_allocator<int>::allocate(unsigned long, void
const*)#std::allocator_traits<std::allocator<int>
>::allocate(std::allocator<int>&, unsigned long)#void std::vector<int,
std::allocator<int> >::_M_realloc_insert<int
const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>
> >, int const&)#std::vector<int, std::allocator<int> >::push_back(int
const&)#go(int)#main##_start##
asked 16 at ###std::__new_allocator<int>::allocate(unsigned long, void
const*)#std::allocator_traits<std::allocator<int>
>::allocate(std::allocator<int>&, unsigned long)#void std::vector<int,
std::allocator<int> >::_M_realloc_insert<int
const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>
> >, int const&)#std::vector<int, std::allocator<int> >::push_back(int
const&)#go(int)#main##_start##
asked 32 at ###std::__new_allocator<int>::allocate(unsigned long, void
const*)#std::allocator_traits<std::allocator<int>
>::allocate(std::allocator<int>&, unsigned long)#void std::vector<int,
std::allocator<int> >::_M_realloc_insert<int
const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>
> >, int const&)#std::vector<int, std::allocator<int> >::push_back(int
const&)#go(int)#main##_start##
asked 64 at ###std::__new_allocator<int>::allocate(unsigned long, void
const*)#std::allocator_traits<std::allocator<int>
>::allocate(std::allocator<int>&, unsigned long)#void std::vector<int,
std::allocator<int> >::_M_realloc_insert<int
const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>
> >, int const&)#std::vector<int, std::allocator<int> >::push_back(int
const&)#go(int)#main##_start##
asked 128 at ###std::__new_allocator<int>::allocate(unsigned long, void
const*)#std::allocator_traits<std::allocator<int>
>::allocate(std::allocator<int>&, unsigned long)#void std::vector<int,
std::allocator<int> >::_M_realloc_insert<int
const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>
> >, int const&)#std::vector<int, std::allocator<int> >::push_back(int
const&)#go(int)#main##_start##
asked 256 at ###std::__new_allocator<int>::allocate(unsigned long, void
const*)#std::allocator_traits<std::allocator<int>
>::allocate(std::allocator<int>&, unsigned long)#void std::vector<int,
std::allocator<int> >::_M_realloc_insert<int
const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>
> >, int const&)#std::vector<int, std::allocator<int> >::push_back(int
const&)#go(int)#main##_start##
asked 512 at ###std::__new_allocator<int>::allocate(unsigned long, void
const*)#std::allocator_traits<std::allocator<int>
>::allocate(std::allocator<int>&, unsigned long)#void std::vector<int,
std::allocator<int> >::_M_realloc_insert<int
const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>
> >, int const&)#std::vector<int, std::allocator<int> >::push_back(int
const&)#go(int)#main##_start##

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (5 preceding siblings ...)
  2023-10-24 10:04 ` vincenzo.innocente at cern dot ch
@ 2023-10-24 12:27 ` redi at gcc dot gnu.org
  2023-10-24 12:38 ` vincenzo.innocente at cern dot ch
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-24 12:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The patch works for me. Did you regenerate the Makefile.in files?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (6 preceding siblings ...)
  2023-10-24 12:27 ` redi at gcc dot gnu.org
@ 2023-10-24 12:38 ` vincenzo.innocente at cern dot ch
  2023-10-24 15:55 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-10-24 12:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #7 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
not explicitly in the src tree.
only run configure in the build directory.
what I need to run in the src tree?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (7 preceding siblings ...)
  2023-10-24 12:38 ` vincenzo.innocente at cern dot ch
@ 2023-10-24 15:55 ` redi at gcc dot gnu.org
  2023-10-24 16:27 ` vincenzo.innocente at cern dot ch
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-24 15:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Run autoreconf in the libstdc++-v3 dir, but you need the right versions of
automake and autoconf. The effect of doing that would be this additional patch,
which I didn't show (because it's just a generated file and our usual
convention is to not include changes to generated files in patches, because it
can be regenerated):

--- a/libstdc++-v3/src/libbacktrace/Makefile.in
+++ b/libstdc++-v3/src/libbacktrace/Makefile.in
@@ -472,9 +472,10 @@ libstdc___libbacktrace_la_CPPFLAGS = \

 C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -Wno-unused-but-set-variable
 CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
-AM_CFLAGS = $(C_WARN_FLAGS) $(EXTRA_CFLAGS)
-AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions \
-       $(EXTRA_CXXFLAGS)
+AM_CFLAGS = $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+       $(C_WARN_FLAGS) $(EXTRA_CFLAGS)
+AM_CXXFLAGS = $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+       $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions $(EXTRA_CXXFLAGS)
 obj_prefix = std_stacktrace

 # Each FILE.c in SOURCES will be compiled to SHORTNAME-FILE.o

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (8 preceding siblings ...)
  2023-10-24 15:55 ` redi at gcc dot gnu.org
@ 2023-10-24 16:27 ` vincenzo.innocente at cern dot ch
  2023-10-24 16:28 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-10-24 16:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #9 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
Thanks for the second patch.
I was indeed struggling with autoconf versions (1.15 vd 1.16)


Any chance to backport to gcc12 (our current production version)?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (9 preceding siblings ...)
  2023-10-24 16:27 ` vincenzo.innocente at cern dot ch
@ 2023-10-24 16:28 ` redi at gcc dot gnu.org
  2023-10-25 10:28 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-24 16:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.3                        |12.4

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, it will be backported to all releases with std::stacktrace.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (10 preceding siblings ...)
  2023-10-24 16:28 ` redi at gcc dot gnu.org
@ 2023-10-25 10:28 ` cvs-commit at gcc dot gnu.org
  2023-10-25 14:21 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-25 10:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:f32c1e1e96ffef6512ce025942b51f3967a3e7f2

commit r14-4922-gf32c1e1e96ffef6512ce025942b51f3967a3e7f2
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Oct 24 16:56:30 2023 +0100

    libstdc++: Build libstdc++_libbacktrace.a as PIC [PR111936]

    In order for std::stacktrace to be used in a shared library, the
    libbacktrace symbols need to be built with -fPIC. Add the libtool
    -prefer-pic flag to the commands in src/libbacktrace/Makefile so that
    the archive contains PIC objects.

    libstdc++-v3/ChangeLog:

            PR libstdc++/111936
            * src/libbacktrace/Makefile.am: Add -prefer-pic to libtool
            compile commands.
            * src/libbacktrace/Makefile.in: Regenerate.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (11 preceding siblings ...)
  2023-10-25 10:28 ` cvs-commit at gcc dot gnu.org
@ 2023-10-25 14:21 ` cvs-commit at gcc dot gnu.org
  2023-10-25 14:35 ` cvs-commit at gcc dot gnu.org
  2023-10-25 14:36 ` redi at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-25 14:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:13ad7b1603f31b65e181780a29ada3f9a331bf8f

commit r13-7982-g13ad7b1603f31b65e181780a29ada3f9a331bf8f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Oct 24 16:56:30 2023 +0100

    libstdc++: Build libstdc++_libbacktrace.a as PIC [PR111936]

    In order for std::stacktrace to be used in a shared library, the
    libbacktrace symbols need to be built with -fPIC. Add the libtool
    -prefer-pic flag to the commands in src/libbacktrace/Makefile so that
    the archive contains PIC objects.

    libstdc++-v3/ChangeLog:

            PR libstdc++/111936
            * src/libbacktrace/Makefile.am: Add -prefer-pic to libtool
            compile commands.
            * src/libbacktrace/Makefile.in: Regenerate.

    (cherry picked from commit f32c1e1e96ffef6512ce025942b51f3967a3e7f2)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (12 preceding siblings ...)
  2023-10-25 14:21 ` cvs-commit at gcc dot gnu.org
@ 2023-10-25 14:35 ` cvs-commit at gcc dot gnu.org
  2023-10-25 14:36 ` redi at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-25 14:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:7804e65ed78b5529635934ca06fbf68521aad32d

commit r12-9942-g7804e65ed78b5529635934ca06fbf68521aad32d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Oct 24 16:56:30 2023 +0100

    libstdc++: Build libstdc++_libbacktrace.a as PIC [PR111936]

    In order for std::stacktrace to be used in a shared library, the
    libbacktrace symbols need to be built with -fPIC. Add the libtool
    -prefer-pic flag to the commands in src/libbacktrace/Makefile so that
    the archive contains PIC objects.

    libstdc++-v3/ChangeLog:

            PR libstdc++/111936
            * src/libbacktrace/Makefile.am: Add -prefer-pic to libtool
            compile commands.
            * src/libbacktrace/Makefile.in: Regenerate.

    (cherry picked from commit f32c1e1e96ffef6512ce025942b51f3967a3e7f2)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/111936] std::stacktrace cannot be used in a shared library
  2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
                   ` (13 preceding siblings ...)
  2023-10-25 14:35 ` cvs-commit at gcc dot gnu.org
@ 2023-10-25 14:36 ` redi at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-25 14:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on all relevant branches now - thanks for the report.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-10-25 14:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-23 13:09 [Bug libstdc++/111936] New: std::stacktrace cannot be used in a shared library vincenzo.innocente at cern dot ch
2023-10-23 13:23 ` [Bug libstdc++/111936] " vincenzo.innocente at cern dot ch
2023-10-23 14:28 ` redi at gcc dot gnu.org
2023-10-23 14:32 ` redi at gcc dot gnu.org
2023-10-23 14:32 ` redi at gcc dot gnu.org
2023-10-23 16:13 ` redi at gcc dot gnu.org
2023-10-24 10:04 ` vincenzo.innocente at cern dot ch
2023-10-24 12:27 ` redi at gcc dot gnu.org
2023-10-24 12:38 ` vincenzo.innocente at cern dot ch
2023-10-24 15:55 ` redi at gcc dot gnu.org
2023-10-24 16:27 ` vincenzo.innocente at cern dot ch
2023-10-24 16:28 ` redi at gcc dot gnu.org
2023-10-25 10:28 ` cvs-commit at gcc dot gnu.org
2023-10-25 14:21 ` cvs-commit at gcc dot gnu.org
2023-10-25 14:35 ` cvs-commit at gcc dot gnu.org
2023-10-25 14:36 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).