On Wed Jun 21 05:10:20 2023 +0000, Rémi Bernon wrote:
This is just some internal symbols and it doesn't mean the symbols are exported. If you build some unix shared library with hidden symbols you might see them still with `objdump -t`. For instance:
# echo 'void __attribute__((visibility("hidden"),noinline)) bar(void) {}' >test.c # gcc -o test.so -shared test.c # objdump -t test.so|grep bar 00000000000010f9 l F .text 0000000000000007 bar
What is happening here with .refptr symbols is something different, and it is that clang figure that although the symbols are in a different translation unit, as they are also marked as hidden it knows that they are not exported and that they are actually static symbols. It allows it to add some additional optimization and avoid MinGW GOT-like redirections. This is something that GCC fails to do, but it is also not the right way to fix that. The right fix is to build PE code with -mcmodel=small instead of the MinGW default -mcmodel=medium, the latter being only useful with auto-exported symbols.
Interesting, thanks for the explanation. However, `i686-w64-mingw32-clang -mcmodel=small` still emits the refptr symbols, at least on Clang 15.