Hi,
while working on Cygwin's new sigaltstack implementation, I wrote
a testcase which I intended to share with my main tester. Since
we're trying to debug, we build without optimization. Now, this
is looking closely at what happens to the stack, so I need access
to the TEB. Here's what happens:
$ cat foo.c
#include <windows.h>
int
main ()
{
MEMORY_BASIC_INFORMATION m;
NT_TIB *tib = (NT_TIB *) NtCurrentTeb ();
VirtualQuery (tib, &m, sizeof m);
}
$ gcc -g -O foo.c -o foo
$ gcc -g foo.c -o foo
/tmp/ccnnAEl3.o: In function `main':
/home/corinna/foo.c:7: undefined reference to `NtCurrentTeb'
collect2: error: ld returned 1 exit status
There's no way around that, except for builindg with optimization, which
is often not prudent when debugging.
In winnt.h, NtCurrentTeb is using __CRT_INLINE which, depending on C
standard, expandes into
extern inline __attribute__((__gnu_inline__))
or
extern __inline__
However, that's not sufficient for NtCurrentTeb (nor, fwiw,
GetCurrentFiber() etc.) since they are not backed by non-inlined
versions. Linking against ntdll doesn't help.
So, shouldn't these inline functions use the __always_inline__
attribute? Or, maybe better, shouldn't __CRT_INLINE use the
__always_inline__ attribute when built on GCC?
Thanks,
Corinna
pgpGQ7ayhx_WM.pgp
Description: PGP signature
------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
