Skip to content

i686 mingw-w64 comdat functions use wrong .text section name #38566

Closed
@rnk

Description

@rnk
Bugzilla Link 39218
Resolution FIXED
Resolved on Nov 29, 2018 16:09
Version trunk
OS Windows NT
Blocks #38454
CC @tstellar
Fixed by commit(s) r347431 r347931

Extended Description

If you simply build and run the example from the original mingw-w64 comdat ABI compatibility bug (https://github.com/Alexpux/MINGW-packages/issues/1677#issuecomment-394906508, also below) for i686, it shows we don't use the right section names:

$ cat a.cpp
inline int foo(int a, int b) { return a + b; }
int bar(void);
int main() { return foo(1, 2) + bar(); }

$ cat b.cpp
inline int foo(int a, int b) { return a + b; }
int bar() { return foo(3, 4); }

$ gcc -m32 a.cpp -c -o a.o && clang --target=i686-w64-windows-gnu -c b.cpp -o b.o

$ dumpbin a.o | grep text
34 .text
10 .text$_Z3fooii

$ dumpbin b.o | grep text
1F .text
1F .text$__Z3fooii

Clang adds the extra '_' for Windows C symbol mangling, but GCC does not.

A user emailed me directly to report that they were getting linker errors, but I have not been able to observe any problems caused by this mismatch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions