Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2020-11-26 19:50:43 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2022-08-29 19:53:48 +0300
commitb4561c236357c32290321fade62b5c81a5a9fe3c (patch)
treecb47ae51d050243a60b81b37d2509cc746907aad /winsup/testsuite
parent6e843f7750c7b2e4f36765cae7f3027f83714e98 (diff)
Cygwin: testsuite: Add x86_64 code to "dynamically load cygwin" test
This still needs some more voudou to actually work. Also update how-cygtls-works.txt a bit
Diffstat (limited to 'winsup/testsuite')
-rw-r--r--winsup/testsuite/winsup.api/cygload.cc22
-rw-r--r--winsup/testsuite/winsup.api/cygload.exp8
2 files changed, 26 insertions, 4 deletions
diff --git a/winsup/testsuite/winsup.api/cygload.cc b/winsup/testsuite/winsup.api/cygload.cc
index faad5ce0e..f5ca8db9a 100644
--- a/winsup/testsuite/winsup.api/cygload.cc
+++ b/winsup/testsuite/winsup.api/cygload.cc
@@ -43,7 +43,10 @@ using std::string;
cygwin::padding *cygwin::padding::_main = NULL;
DWORD cygwin::padding::_mainTID = 0;
-// A few cygwin constants.
+// Cygwin signal constants
+#undef SIGINT
+#undef SIGTERM
+
static const int SIGHUP = 1;
static const int SIGINT = 2;
static const int SIGTERM = 15; // Cygwin won't deliver this one to us;
@@ -68,17 +71,30 @@ cygwin::padding::padding ()
_end = _padding + sizeof (_padding);
char *stackbase;
-#ifdef __GNUC__
+#ifdef __GNUC__ /* GCC */
+# ifdef __x86_64__
+ __asm__ (
+ "mov %%gs:8, %0"
+ :"=r"(stackbase)
+ );
+# elif __X86__
__asm__ (
"movl %%fs:4, %0"
:"=r"(stackbase)
);
-#else
+# else
+# error Unknown architecture
+# endif
+#else /* !GCC assumed to be MSVC */
+# ifdef __X86__
__asm
{
mov eax, fs:[4];
mov stackbase, eax;
}
+#else
+# error Unknown architecture
+# endif
#endif
_stackbase = stackbase;
diff --git a/winsup/testsuite/winsup.api/cygload.exp b/winsup/testsuite/winsup.api/cygload.exp
index e7b439512..8ba8249bb 100644
--- a/winsup/testsuite/winsup.api/cygload.exp
+++ b/winsup/testsuite/winsup.api/cygload.exp
@@ -14,7 +14,13 @@ proc ws_spawn {cmd args} {
verbose send "catchCode = $rv\n"
}
-ws_spawn "$MINGW_CXX $srcdir/$subdir/cygload.cc -o mingw-cygload.exe -lstdc++ -Wl,-e,_cygloadCRTStartup@0"
+if { [string match "i686" $target_alias] } {
+ set entrypoint "_cygloadCRTStartup@0"
+} else {
+ set entrypoint "cygloadCRTStartup"
+}
+
+ws_spawn "$MINGW_CXX $srcdir/$subdir/cygload.cc -o mingw-cygload.exe -static -Wl,-e,$entrypoint"
if { $rv != {0 {}} } {
verbose -log "$rv"