public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/112551] New: Incompatibility of libstdc++ liked statically and -Bsymbolic-functions
@ 2023-11-15 16:54 serge.guelton@telecom-bretagne.eu
  2023-11-16  7:30 ` [Bug libstdc++/112551] " rguenth at gcc dot gnu.org
  2024-01-30  6:41 ` [Bug libstdc++/112551] Incompatibility of libstdc++ linked " sjames at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: serge.guelton@telecom-bretagne.eu @ 2023-11-15 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112551
           Summary: Incompatibility of libstdc++ liked statically and
                    -Bsymbolic-functions
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: serge.guelton@telecom-bretagne.eu
  Target Milestone: ---

Created attachment 56595
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56595&action=edit
reproducer

Hey folks,

While debugging a firefox issue, we found an interesting bug where a program
linked statically against libstdc++ and dynamically against a library that's
itself statically linked against libstdc++, both with -Bsymbolic-functions, is
segfaulting at startup (during Elf con structor init)

The attached tarball provides a minimal reproducer.

Our understanding of the problem is that an initializer from the libstdc++ is
run by the host binary, updating locale::_S_once from the host. Then the shared
libray initializes itself, calls the same initializer through its
non-interposed version, checks the interposed symbol locale::_S_once (remember
we only have -Bsymbolic-functions and not -Bsymbolic), decides everything is
initialized, and proceeds to call a local function that references local
storage that's not initialized, kaboom.

Given the setup, I'm not quite sure libstdc++ should actually support the
scenario, but maybe there's a way?

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

* [Bug libstdc++/112551] Incompatibility of libstdc++ liked statically and -Bsymbolic-functions
  2023-11-15 16:54 [Bug libstdc++/112551] New: Incompatibility of libstdc++ liked statically and -Bsymbolic-functions serge.guelton@telecom-bretagne.eu
@ 2023-11-16  7:30 ` rguenth at gcc dot gnu.org
  2024-01-30  6:41 ` [Bug libstdc++/112551] Incompatibility of libstdc++ linked " sjames at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-16  7:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Don't use -Bsymbolic-functions then?  You are actively breaking the C++
standard guarantees here.  Not to say, don't use static linking, but hey ... or
at least fully statically link the application.

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

* [Bug libstdc++/112551] Incompatibility of libstdc++ linked statically and -Bsymbolic-functions
  2023-11-15 16:54 [Bug libstdc++/112551] New: Incompatibility of libstdc++ liked statically and -Bsymbolic-functions serge.guelton@telecom-bretagne.eu
  2023-11-16  7:30 ` [Bug libstdc++/112551] " rguenth at gcc dot gnu.org
@ 2024-01-30  6:41 ` sjames at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-01-30  6:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
Writeup about this:
https://hacks.mozilla.org/2024/01/option-soup-the-subtle-pitfalls-of-combining-compiler-flags/.

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

end of thread, other threads:[~2024-01-30  6:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 16:54 [Bug libstdc++/112551] New: Incompatibility of libstdc++ liked statically and -Bsymbolic-functions serge.guelton@telecom-bretagne.eu
2023-11-16  7:30 ` [Bug libstdc++/112551] " rguenth at gcc dot gnu.org
2024-01-30  6:41 ` [Bug libstdc++/112551] Incompatibility of libstdc++ linked " sjames 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).