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:
authorKen Brown <kbrown@cornell.edu>2022-06-10 01:42:03 +0300
committerKen Brown <kbrown@cornell.edu>2022-06-10 23:38:34 +0300
commitbbfe79fb725a1f8833143416f10db822e04f902b (patch)
treed3a8baa648fd836298525f5203dccb820b9ab468 /winsup/cygwin/autoload.cc
parentb0cb9f85ca3626e0e68fd451c3090d253ceb4300 (diff)
Cygwin: restore '#ifdef __x86_64__' for CPU-specific code
Commit e1ce752a1d, "Cygwin: remove miscellaneous 32-bit code", removed most occurrences of '#ifdef __x86_64__'. Restore those occurrences that guarded code specific to the AMD64 processor, and #error out if the processor is different. This will make it easier to find AMD64-specific code if we ever want to add support for a different 64-bit processor (e.g., ARM64).
Diffstat (limited to 'winsup/cygwin/autoload.cc')
-rw-r--r--winsup/cygwin/autoload.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index 668e64650..8ab42d3e5 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -66,6 +66,7 @@ bool NO_COPY wsock_started;
/* LoadDLLprime is used to prime the DLL info information, providing an
additional initialization routine to call prior to calling the first
function. */
+#ifdef __x86_64__
#define LoadDLLprime(dllname, init_also, no_resolve_on_fork) __asm__ (" \n\
.ifndef " #dllname "_primed \n\
.section .data_cygwin_nocopy,\"w\" \n\
@@ -81,6 +82,9 @@ bool NO_COPY wsock_started;
.set " #dllname "_primed, 1 \n\
.endif \n\
");
+#else
+#error unimplemented for this target
+#endif
/* Standard DLL load macro. May invoke a fatal error if the function isn't
found. */
@@ -92,6 +96,7 @@ bool NO_COPY wsock_started;
LoadDLLfuncEx3(name, n, dllname, notimp, err, 0)
/* Main DLL setup stuff. */
+#ifdef __x86_64__
#define LoadDLLfuncEx3(name, n, dllname, notimp, err, no_resolve_on_fork) \
LoadDLLprime (dllname, dll_func_load, no_resolve_on_fork) \
__asm__ (" \n\
@@ -116,6 +121,9 @@ _win32_" #name ": \n\
.asciz \"" #name "\" \n\
.text \n\
");
+#else
+#error unimplemented for this target
+#endif
/* DLL loader helper functions used during initialization. */
@@ -131,6 +139,7 @@ extern "C" void dll_chain () __asm__ ("dll_chain");
extern "C" {
+#ifdef __x86_64__
__asm__ (" \n\
.section .rdata,\"r\" \n\
msg1: \n\
@@ -192,6 +201,9 @@ dll_chain: \n\
push %rax # Restore 'return address' \n\
jmp *%rdx # Jump to next init function \n\
");
+#else
+#error unimplemented for this target
+#endif
/* C representations of the two info blocks described above.
FIXME: These structures confuse gdb for some reason. GDB can print
@@ -246,6 +258,7 @@ dll_load (HANDLE& handle, PWCHAR name)
#define RETRY_COUNT 10
/* The standard DLL initialization routine. */
+#ifdef __x86_64__
/* On x86_64, we need assembler wrappers for std_dll_init and wsock_init.
In the x86_64 ABI it's no safe bet that frame[1] (aka 8(%rbp)) contains
@@ -285,6 +298,10 @@ _" #func ": \n\
INIT_WRAPPER (std_dll_init)
+#else
+#error unimplemented for this target
+#endif
+
__attribute__ ((used, noinline)) static two_addr_t
std_dll_init (struct func_info *func)
{
@@ -341,8 +358,12 @@ std_dll_init (struct func_info *func)
/* Initialization function for winsock stuff. */
+#ifdef __x86_64__
/* See above comment preceeding std_dll_init. */
INIT_WRAPPER (wsock_init)
+#else
+#error unimplemented for this target
+#endif
__attribute__ ((used, noinline)) static two_addr_t
wsock_init (struct func_info *func)