public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109380] New: inline member function symbol not exported with explicit template instantiation declaration on MinGW
@ 2023-04-02 22:48 vittorio.romeo at outlook dot com
2023-04-02 22:59 ` [Bug target/109380] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: vittorio.romeo at outlook dot com @ 2023-04-02 22:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109380
Bug ID: 109380
Summary: inline member function symbol not exported with
explicit template instantiation declaration on MinGW
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vittorio.romeo at outlook dot com
Target Milestone: ---
Created attachment 54801
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54801&action=edit
Full example (lib.h, lib.cpp, main.cpp, build.sh)
Given the following code:
// ----------------------------
// lib.h
template <typename>
struct S
{
void f();
void g() { }
};
template <typename T> void S<T>::f() { }
extern template struct __declspec(dllexport) S<int>;
// ----------------------------
// lib.cpp
#include "lib.h"
template struct S<int>;
// ----------------------------
// main.cpp
#include "lib.h"
int main() { S<int>{}.g(); }
When building with:
g++ -c -o main.o main.cpp && \
g++ -c -o lib.o lib.cpp && \
g++ -shared -o lib.dll lib.o -Wl,--out-implib,liblib.dll.a && \
g++ -o main.exe main.o -L. -llib
This linker error is erroneously produced:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
main.o:main.cpp:(.text+0x15): undefined reference to `S<int>::g()'
collect2.exe: error: ld returned 1 exit status
This is likely the same as bug #89088:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89088
And probably related to this Clang PR and review:
https://reviews.llvm.org/D61118
I bumped into this issue today, using GCC version 12.2.0, on MinGW/MSYS2.
The last bug report is UNCONFIRMED since 2019.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/109380] inline member function symbol not exported with explicit template instantiation declaration on MinGW
2023-04-02 22:48 [Bug c++/109380] New: inline member function symbol not exported with explicit template instantiation declaration on MinGW vittorio.romeo at outlook dot com
@ 2023-04-02 22:59 ` pinskia at gcc dot gnu.org
2023-04-02 23:06 ` vittorio.romeo at outlook dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-02 22:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109380
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=81855
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually I think this is a dup of bug 81855.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/109380] inline member function symbol not exported with explicit template instantiation declaration on MinGW
2023-04-02 22:48 [Bug c++/109380] New: inline member function symbol not exported with explicit template instantiation declaration on MinGW vittorio.romeo at outlook dot com
2023-04-02 22:59 ` [Bug target/109380] " pinskia at gcc dot gnu.org
@ 2023-04-02 23:06 ` vittorio.romeo at outlook dot com
2023-04-02 23:11 ` pinskia at gcc dot gnu.org
2023-04-03 11:03 ` lh_mouse at 126 dot com
3 siblings, 0 replies; 5+ messages in thread
From: vittorio.romeo at outlook dot com @ 2023-04-02 23:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109380
--- Comment #2 from Vittorio Romeo <vittorio.romeo at outlook dot com> ---
Hmm, you might be correct. Seeing that the issue has not been looked at since
2017, are you aware of any workaround besides `-Wl,--export-all-symbols`?
The issue is preventing me from applying explicit template instantiations in
the SFML codebase for commonly used template types.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/109380] inline member function symbol not exported with explicit template instantiation declaration on MinGW
2023-04-02 22:48 [Bug c++/109380] New: inline member function symbol not exported with explicit template instantiation declaration on MinGW vittorio.romeo at outlook dot com
2023-04-02 22:59 ` [Bug target/109380] " pinskia at gcc dot gnu.org
2023-04-02 23:06 ` vittorio.romeo at outlook dot com
@ 2023-04-02 23:11 ` pinskia at gcc dot gnu.org
2023-04-03 11:03 ` lh_mouse at 126 dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-02 23:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109380
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note there are not many folks working on mingw support for GCC these days.
Also I don't work on that port, I work on other ports and try to triage bug
reports which is why I commented here.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/109380] inline member function symbol not exported with explicit template instantiation declaration on MinGW
2023-04-02 22:48 [Bug c++/109380] New: inline member function symbol not exported with explicit template instantiation declaration on MinGW vittorio.romeo at outlook dot com
` (2 preceding siblings ...)
2023-04-02 23:11 ` pinskia at gcc dot gnu.org
@ 2023-04-03 11:03 ` lh_mouse at 126 dot com
3 siblings, 0 replies; 5+ messages in thread
From: lh_mouse at 126 dot com @ 2023-04-03 11:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109380
LIU Hao <lh_mouse at 126 dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lh_mouse at 126 dot com
--- Comment #4 from LIU Hao <lh_mouse at 126 dot com> ---
Looks like GCC doesn't generate `-export:` after `.section .drectve`. The
functions are generated in `.linkonce` sections correctly; they are just not
exported.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-04-03 11:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-02 22:48 [Bug c++/109380] New: inline member function symbol not exported with explicit template instantiation declaration on MinGW vittorio.romeo at outlook dot com
2023-04-02 22:59 ` [Bug target/109380] " pinskia at gcc dot gnu.org
2023-04-02 23:06 ` vittorio.romeo at outlook dot com
2023-04-02 23:11 ` pinskia at gcc dot gnu.org
2023-04-03 11:03 ` lh_mouse at 126 dot com
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).