undefined reference to `__chkstk_ms'

Rastislav Stanik <[email protected]>
Newsgroups gmane.comp.gnu.mingw.user
Message-ID <[email protected]>
Hi,

I've hit a problem when compiling my project with
gcc --version
gcc (x86_64-win32-sjlj-rev0, Built by MinGW-W64 project) 8.1.0

I'm trying to build a 32-bit (using -m32) shared library that uses PCRE
(Perl Compatible Regular Expressions library) compiled by myself using the
same compiler. At linking stage I get a report about missing symbol
__chkstk_ms:

{MinGW-root}/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib32/libmingw32.a(lib32_libmingw32_a-pseudo-reloc.o):pseudo-reloc.c:(.text+0x18d):
undefined reference to `__chkstk_ms'

Reference to __chkstk_ms() is added by compiler when some function declares
local variables exceeding page size (~4k). In my case the function that
exceeds the limit is in PRCE, so I cannot simply work around it in my code.
The function __chkstk_ms() is provided by libgcc.a located in directory

  {MinGW-root}/lib/gcc/x86_64-w64-mingw32/8.1.0/32/

So if I add linking of that libgcc.a then the linking stage succeeds. But I
also have to ensure that libgcc.a is in link search path.

Questions:
- why the compiler does not add libgcc.a by itself when it added
__chkstk_ms() by itself?
- if I add -lgcc, why do I also have to add path with -L? Shouldn't the
directory be in the default linker search path?
- is there a solution that will keep working after next release of
MinGW/GCC when the path to libgcc changes?
--
	bye
		rastos

_______________________________________________
MinGW-Users mailing list
[email protected]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.osdn.me/mailman/listinfo/mingw-users
Also: mailto:[email protected]?subject=unsubscribe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.