mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-31 11:30:56 +08:00
Cygwin: remove some 32-bit only environment code
This commit is contained in:
parent
3e917daec1
commit
f6bb8bfaa0
@ -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 ();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user