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

--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> ---

Sorry, my intended design was not stated very clearly.

1. IIUC, the objective is to have only one instance of these symbols in the
dynamically-linked program.

2. One way to ensure that is to make it a requirement that all DSOs that need
these must link with libgcc_s.

 - However, that is not always what the user wants to do and might link a DSO
with -static-libgcc
 - it makes DSOs built with GCC more difficult to use with other compilers.

3. An alternate solution is to have COMDAT/Weak Definitions (I'm not sure if
I've got exactly the right terminology for ELF; Weak Definition is the right
one for Mach-o).

 - then the dynamic linker picks only one in the loaded program, so the
duplication is avoided
 - this also works when DSOs are used with a foreign compiler without libgcc_s

---

For my ports the second is the most practical, since my downsteams use GCC and
clang together, but I have no strong opinion on what should be done in general.

Reply via email to