public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: remove some 32-bit only environment code
@ 2022-05-30 15:07 Ken Brown
0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2022-05-30 15:07 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f6bb8bfaa055ddf5efee422290e034b463aa154b
commit f6bb8bfaa055ddf5efee422290e034b463aa154b
Author: Ken Brown <kbrown@cornell.edu>
Date: Tue May 24 10:23:39 2022 -0400
Cygwin: remove some 32-bit only environment code
Diff:
---
winsup/cygwin/dcrt0.cc | 18 ------------------
winsup/cygwin/dll_init.cc | 25 -------------------------
winsup/cygwin/dll_init.h | 6 ------
winsup/cygwin/environ.cc | 21 ---------------------
winsup/cygwin/environ.h | 7 -------
winsup/cygwin/globals.cc | 6 ------
winsup/cygwin/include/sys/cygwin.h | 3 ---
7 files changed, 86 deletions(-)
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 5fb34d7e8..b846cc5bb 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -1019,11 +1019,7 @@ dll_crt0_1 (void *)
sig_dispatch_pending (false);
_my_tls.call_signal_handler ();
_my_tls.incyg--; /* Not in Cygwin anymore */
-#ifdef __x86_64__
cygwin_exit (user_data->main (__argc, newargv, __cygwin_environ));
-#else
- cygwin_exit (user_data->main (__argc, newargv, *user_data->envptr));
-#endif
}
__asm__ (" \n\
.global _cygwin_exit_return \n\
@@ -1037,7 +1033,6 @@ __cygwin_exit_return: \n\
extern "C" void __stdcall
_dll_crt0 ()
{
-#ifdef __x86_64__
/* Starting with Windows 10 rel 1511, the main stack of an application is
not reproducible if a 64 bit process has been started from a 32 bit
process. Given that we have enough virtual address space on 64 bit
@@ -1070,11 +1065,6 @@ _dll_crt0 ()
else
fork_info->alloc_stack ();
}
-#else
- main_environ = user_data->envptr;
- if (in_forkee)
- fork_info->alloc_stack ();
-#endif
fesetenv (FE_DFL_ENV);
_main_tls = &_my_tls;
@@ -1104,18 +1094,10 @@ dll_crt0 (per_process *uptr)
extern "C" void
cygwin_dll_init ()
{
-#ifdef __i386__
- static char **envp;
-#endif
static int _fmode;
user_data->magic_biscuit = sizeof (per_process);
-
-#ifdef __i386__
- user_data->envptr = &envp;
-#endif
user_data->fmode_ptr = &_fmode;
-
_dll_crt0 ();
}
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 6a4ed269e..24e3b8764 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -204,14 +204,6 @@ dll::init ()
{
int ret = 1;
-#ifdef __i386__
- /* This should be a no-op. Why didn't we just import this variable? */
- if (!p.envptr)
- p.envptr = &__cygwin_environ;
- else if (*(p.envptr) != __cygwin_environ)
- *(p.envptr) = __cygwin_environ;
-#endif
-
/* Don't run constructors or the "main" if we've forked. */
if (!in_forkee)
{
@@ -387,9 +379,6 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
loaded_dlls++;
}
guard (false);
-#ifdef __i386__
- assert (p->envptr != NULL);
-#endif
return d;
}
@@ -911,17 +900,3 @@ dlfork (int val)
{
dlls.reload_on_fork = val;
}
-
-#ifdef __i386__
-/* Called from various places to update all of the individual
- ideas of the environ block. Explain to me again why we didn't
- just import __cygwin_environ? */
-void __stdcall
-update_envptrs ()
-{
- for (dll *d = dlls.istart (DLL_ANY); d; d = dlls.inext ())
- if (*(d->p.envptr) != __cygwin_environ)
- *(d->p.envptr) = __cygwin_environ;
- *main_environ = __cygwin_environ;
-}
-#endif
diff --git a/winsup/cygwin/dll_init.h b/winsup/cygwin/dll_init.h
index 3c274cf35..65f4213db 100644
--- a/winsup/cygwin/dll_init.h
+++ b/winsup/cygwin/dll_init.h
@@ -8,9 +8,6 @@ details. */
struct per_module
{
-#ifdef __i386__
- char ***envptr;
-#endif
void (**ctors)(void);
void (**dtors)(void);
void *data_start;
@@ -20,9 +17,6 @@ struct per_module
int (*main)(int, char **, char **);
per_module &operator = (per_process *p)
{
-#ifdef __i386__
- envptr = p->envptr;
-#endif
ctors = p->ctors;
dtors = p->dtors;
data_start = p->data_start;
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 99b220d55..ab593ab64 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -626,7 +626,6 @@ _addenv (const char *name, const char *value, int overwrite)
}
__cygwin_environ[offset + 1] = NULL; /* NULL terminate. */
- update_envptrs (); /* Update any local copies of 'environ'. */
}
char *envhere;
@@ -742,7 +741,6 @@ clearenv (void)
lastenviron = NULL;
}
__cygwin_environ = NULL;
- update_envptrs ();
return 0;
}
__except (EFAULT) {}
@@ -845,7 +843,6 @@ environ_init (char **envp, int envc)
out:
findenv_func = (char * (*)(const char*, int*)) my_findenv;
__cygwin_environ = envp;
- update_envptrs ();
if (envp_passed_in)
{
p = getenv ("CYGWIN");
@@ -1311,21 +1308,3 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
debug_printf ("envp %p, envc %d", newenv, envc);
return newenv;
}
-
-#ifdef __i386__
-/* This idiocy is necessary because the early implementers of cygwin
- did not seem to know about importing data variables from the DLL.
- So, we have to synchronize cygwin's idea of the environment with the
- main program's with each reference to the environment. */
-extern "C" char ** __stdcall
-cur_environ ()
-{
- if (*main_environ != __cygwin_environ)
- {
- __cygwin_environ = *main_environ;
- update_envptrs ();
- }
-
- return __cygwin_environ;
-}
-#endif
diff --git a/winsup/cygwin/environ.h b/winsup/cygwin/environ.h
index fc34f1e91..3980d6b5a 100644
--- a/winsup/cygwin/environ.h
+++ b/winsup/cygwin/environ.h
@@ -33,15 +33,8 @@ struct win_env
win_env *getwinenv (const char *name, const char *posix = NULL, win_env * = NULL);
char *getwinenveq (const char *name, size_t len, int);
-#ifdef __x86_64__
-#define update_envptrs()
extern "C" char **__cygwin_environ;
#define cur_environ() __cygwin_environ
-#else
-void __stdcall update_envptrs ();
-extern "C" char **__cygwin_environ, ***main_environ;
-extern "C" char __stdcall **cur_environ ();
-#endif
char **build_env (const char * const *envp, PWCHAR &envblock,
int &envc, bool need_envblock, HANDLE new_token);
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index aad5d4259..294a67fe8 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -158,9 +158,6 @@ const int __collate_load_error = 0;
/* This is an exported copy of environ which can be used by DLLs
which use cygwin.dll. */
char **__cygwin_environ;
-#ifdef __i386__
- char ***main_environ = &__cygwin_environ;
-#endif
/* __progname used in getopt error message */
char *__progname;
char *program_invocation_name;
@@ -171,9 +168,6 @@ const int __collate_load_error = 0;
/* dll_major */ CYGWIN_VERSION_DLL_MAJOR,
/* dll_major */ CYGWIN_VERSION_DLL_MINOR,
/* impure_ptr_ptr */ NULL,
-#ifdef __i386__
- /* envptr */ NULL,
-#endif
/* malloc */ malloc, /* free */ free,
/* realloc */ realloc,
/* fmode_ptr */ NULL, /* main */ NULL, /* ctors */ NULL,
diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h
index 4923caacb..5532cb683 100644
--- a/winsup/cygwin/include/sys/cygwin.h
+++ b/winsup/cygwin/include/sys/cygwin.h
@@ -293,9 +293,6 @@ struct per_process
uint32_t dll_minor;
struct _reent **impure_ptr_ptr;
-#ifdef __i386__
- char ***envptr;
-#endif
/* Used to point to the memory machine we should use. Usually these
point back into the dll, but they can be overridden by the user. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-30 15:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-30 15:07 [newlib-cygwin] Cygwin: remove some 32-bit only environment code Ken Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).