mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
update from main archive 960818
This commit is contained in:
@ -111,11 +111,6 @@ asm ("\nEOF.crtn.init\
|
|||||||
\n\
|
\n\
|
||||||
cat >> crti.s-new <<\\EOF.crti.fini");
|
cat >> crti.s-new <<\\EOF.crti.fini");
|
||||||
|
|
||||||
/* Global variable which says whether we have a statically or dynamically
|
|
||||||
linked program. If > 0, static, for < 0 dynamic, == 0 means yet to
|
|
||||||
be determined (see init-first.c). */
|
|
||||||
int __libc_is_static = 0;
|
|
||||||
|
|
||||||
SECTION (".fini")
|
SECTION (".fini")
|
||||||
void
|
void
|
||||||
_fini (void)
|
_fini (void)
|
||||||
|
@ -22,6 +22,11 @@ Cambridge, MA 02139, USA. */
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern void _dl_start (void); weak_extern (_dl_start)
|
||||||
|
|
||||||
|
extern int __libc_multiple_libcs; /* Defined in init-first.c. */
|
||||||
|
|
||||||
size_t _dl_global_scope_alloc;
|
size_t _dl_global_scope_alloc;
|
||||||
|
|
||||||
struct link_map *
|
struct link_map *
|
||||||
@ -30,7 +35,9 @@ _dl_open (const char *file, int mode)
|
|||||||
struct link_map *new, *l;
|
struct link_map *new, *l;
|
||||||
ElfW(Addr) init;
|
ElfW(Addr) init;
|
||||||
struct r_debug *r;
|
struct r_debug *r;
|
||||||
|
/* To decide whether we are the static libc or not. We must use
|
||||||
|
this variable since gcc would otherwise optimize the test away. */
|
||||||
|
void (*dl_start_ptr) (void) = &_dl_start;
|
||||||
|
|
||||||
/* Load the named object. */
|
/* Load the named object. */
|
||||||
new = _dl_map_object (NULL, file, lt_loaded);
|
new = _dl_map_object (NULL, file, lt_loaded);
|
||||||
@ -131,5 +138,11 @@ _dl_open (const char *file, int mode)
|
|||||||
while (init = _dl_init_next (new))
|
while (init = _dl_init_next (new))
|
||||||
(*(void (*) (void)) init) ();
|
(*(void (*) (void)) init) ();
|
||||||
|
|
||||||
|
if (dl_start_ptr == NULL)
|
||||||
|
/* We must be the static _dl_open in libc.a because ld.so.1 is not
|
||||||
|
in scope. A static program that has loaded a dynamic object
|
||||||
|
now has competition. */
|
||||||
|
__libc_multiple_libcs = 1;
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
12
elf/rtld.c
12
elf/rtld.c
@ -42,6 +42,15 @@ int _dl_argc;
|
|||||||
char **_dl_argv;
|
char **_dl_argv;
|
||||||
const char *_dl_rpath;
|
const char *_dl_rpath;
|
||||||
|
|
||||||
|
/* Set nonzero during loading and initialization of executable and
|
||||||
|
libraries, cleared before the executable's entry point runs. This
|
||||||
|
must not be initialized to nonzero, because the unused dynamic
|
||||||
|
linker loaded in for libc.so's "ld.so.1" dep will provide the
|
||||||
|
definition seen by libc.so's initializer; that value must be zero,
|
||||||
|
and will be since that dynamic linker's _dl_start and dl_main will
|
||||||
|
never be called. */
|
||||||
|
int _dl_starting_up;
|
||||||
|
|
||||||
static void dl_main (const ElfW(Phdr) *phdr,
|
static void dl_main (const ElfW(Phdr) *phdr,
|
||||||
ElfW(Half) phent,
|
ElfW(Half) phent,
|
||||||
ElfW(Addr) *user_entry);
|
ElfW(Addr) *user_entry);
|
||||||
@ -486,6 +495,9 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
_dl_rtld_map.l_info[DT_INIT] = NULL;
|
_dl_rtld_map.l_info[DT_INIT] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We finished the intialization and will start up. */
|
||||||
|
_dl_starting_up = 1;
|
||||||
|
|
||||||
/* Once we return, _dl_sysdep_start will invoke
|
/* Once we return, _dl_sysdep_start will invoke
|
||||||
the DT_INIT functions and then *USER_ENTRY. */
|
the DT_INIT functions and then *USER_ENTRY. */
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,8 @@ __pututline_r (const struct utmp *id, struct utmp_data *utmp_data)
|
|||||||
match: */
|
match: */
|
||||||
if (id->ut_id[0]
|
if (id->ut_id[0]
|
||||||
&& (utmp_data->loc_utmp < (off_t) sizeof (struct utmp)
|
&& (utmp_data->loc_utmp < (off_t) sizeof (struct utmp)
|
||||||
|| strncmp(utmp_data->ubuf.ut_id, id->ut_id, sizeof (id->ut_id)) != 0))
|
|| strncmp (utmp_data->ubuf.ut_id, id->ut_id,
|
||||||
|
sizeof (id->ut_id)) != 0))
|
||||||
{
|
{
|
||||||
/* We must not overwrite the data in UTMP_DATA since ID may be
|
/* We must not overwrite the data in UTMP_DATA since ID may be
|
||||||
aliasing it. */
|
aliasing it. */
|
||||||
@ -74,16 +75,8 @@ __pututline_r (const struct utmp *id, struct utmp_data *utmp_data)
|
|||||||
*data_tmp = *utmp_data;
|
*data_tmp = *utmp_data;
|
||||||
utmp_data = data_tmp;
|
utmp_data = data_tmp;
|
||||||
|
|
||||||
if (getutid_r (id, &dummy, utmp_data) < 0)
|
if (getutid_r (id, &dummy, utmp_data) < 0 && errno != ESRCH)
|
||||||
{
|
return -1;
|
||||||
if (errno != ESRCH)
|
|
||||||
/* Some error occured. If no entry was found, the position
|
|
||||||
pointer now is at the end of the file. */
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Set position pointer to position behind the record. */
|
|
||||||
utmp_data->loc_utmp += sizeof (struct utmp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -102,7 +95,8 @@ __pututline_r (const struct utmp *id, struct utmp_data *utmp_data)
|
|||||||
|
|
||||||
if (result >= 0)
|
if (result >= 0)
|
||||||
/* Position file correctly. */
|
/* Position file correctly. */
|
||||||
if (utmp_data->loc_utmp < (off_t) sizeof (struct utmp))
|
if (utmp_data->loc_utmp < (off_t) sizeof (struct utmp)
|
||||||
|
|| utmp_data->loc_utmp - sizeof (struct utmp) > st.st_size)
|
||||||
/* Not located at any valid entry. Add at the end. */
|
/* Not located at any valid entry. Add at the end. */
|
||||||
{
|
{
|
||||||
result = lseek (utmp_data->ut_fd, 0L, SEEK_END);
|
result = lseek (utmp_data->ut_fd, 0L, SEEK_END);
|
||||||
@ -110,7 +104,7 @@ __pututline_r (const struct utmp *id, struct utmp_data *utmp_data)
|
|||||||
/* Where we'll be if the write succeeds. */
|
/* Where we'll be if the write succeeds. */
|
||||||
utmp_data->loc_utmp = st.st_size + sizeof (struct utmp);
|
utmp_data->loc_utmp = st.st_size + sizeof (struct utmp);
|
||||||
}
|
}
|
||||||
else if (utmp_data->loc_utmp <= st.st_size)
|
else
|
||||||
result =
|
result =
|
||||||
lseek (utmp_data->ut_fd, utmp_data->loc_utmp - sizeof (struct utmp),
|
lseek (utmp_data->ut_fd, utmp_data->loc_utmp - sizeof (struct utmp),
|
||||||
SEEK_SET);
|
SEEK_SET);
|
||||||
|
@ -22,10 +22,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
extern void *__curbrk;
|
extern void *__curbrk;
|
||||||
extern int __brk (void *addr);
|
extern int __brk (void *addr);
|
||||||
|
|
||||||
#ifdef PIC
|
extern int __libc_multiple_libcs; /* Defined in init-first.c. */
|
||||||
extern int __libc_is_static;
|
|
||||||
weak_extern (__libc_is_static)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Extend the process's data space by INCREMENT.
|
/* Extend the process's data space by INCREMENT.
|
||||||
If INCREMENT is negative, shrink data space by - INCREMENT.
|
If INCREMENT is negative, shrink data space by - INCREMENT.
|
||||||
@ -40,9 +37,7 @@ __sbrk (ptrdiff_t increment)
|
|||||||
__curbrk from the kernel's brk value. That way two separate
|
__curbrk from the kernel's brk value. That way two separate
|
||||||
instances of __brk and __sbrk can share the heap, returning
|
instances of __brk and __sbrk can share the heap, returning
|
||||||
interleaved pieces of it. */
|
interleaved pieces of it. */
|
||||||
#ifdef PIC
|
if (__curbrk == NULL || __libc_multiple_libcs)
|
||||||
if (__curbrk == NULL || &__libc_is_static == NULL)
|
|
||||||
#endif
|
|
||||||
if (__brk (0) < 0)
|
if (__brk (0) < 0)
|
||||||
return (void *) -1;
|
return (void *) -1;
|
||||||
|
|
||||||
|
@ -163,7 +163,9 @@ _dl_start_user:\n\
|
|||||||
call *%eax\n\
|
call *%eax\n\
|
||||||
# Loop to call _dl_init_next for the next initializer.\n\
|
# Loop to call _dl_init_next for the next initializer.\n\
|
||||||
jmp 0b\n\
|
jmp 0b\n\
|
||||||
1: # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
|
1: # Clear the startup flag.\n\
|
||||||
|
movl $0, _dl_starting_up@GOT(%ebx)\n\
|
||||||
|
# Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
|
||||||
movl _dl_fini@GOT(%ebx), %edx\n\
|
movl _dl_fini@GOT(%ebx), %edx\n\
|
||||||
# Jump to the user's entry point.\n\
|
# Jump to the user's entry point.\n\
|
||||||
jmp *%edi\n\
|
jmp *%edi\n\
|
||||||
|
@ -174,7 +174,9 @@ _dl_start_user:
|
|||||||
jsr (%a0)
|
jsr (%a0)
|
||||||
| Loop to call _dl_init_next for the next initializer.
|
| Loop to call _dl_init_next for the next initializer.
|
||||||
jra 0b
|
jra 0b
|
||||||
1: | Pass our finalizer function to the user in %a1.
|
1: | Clear the startup flag.
|
||||||
|
move.l #0, _dl_starting_up@GOT(%a5)
|
||||||
|
| Pass our finalizer function to the user in %a1.
|
||||||
move.l _dl_fini@GOT(%a5), %a1
|
move.l _dl_fini@GOT(%a5), %a1
|
||||||
| Initialize %fp with the stack pointer.
|
| Initialize %fp with the stack pointer.
|
||||||
move.l %sp, %fp
|
move.l %sp, %fp
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
ifeq ($(subdir), csu)
|
||||||
|
CFLAGS-init-first.c = -fkeep-inline-functions
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(subdir), misc)
|
ifeq ($(subdir), misc)
|
||||||
sysdep_routines += sysctl clone
|
sysdep_routines += sysctl clone
|
||||||
|
|
||||||
|
@ -2,5 +2,5 @@ ifeq ($(subdir), misc)
|
|||||||
sysdep_headers += alpha/ptrace.h alpha/regdef.h
|
sysdep_headers += alpha/ptrace.h alpha/regdef.h
|
||||||
|
|
||||||
sysdep_routines += ieee_get_fp_control ieee_set_fp_control \
|
sysdep_routines += ieee_get_fp_control ieee_set_fp_control \
|
||||||
sethae ioperm osf_sigprocmask fstatfs statfs
|
sethae ioperm osf_sigprocmask fstatfs statfs llseek
|
||||||
endif
|
endif
|
||||||
|
@ -52,7 +52,7 @@ I/O address space that's 512MB large!). */
|
|||||||
#define vuip volatile unsigned int *
|
#define vuip volatile unsigned int *
|
||||||
|
|
||||||
#define JENSEN_IO_BASE (0xfffffc0300000000UL)
|
#define JENSEN_IO_BASE (0xfffffc0300000000UL)
|
||||||
#define JENSEN_MEM (0xfffffc0200000000UL) /* sparse!! */
|
#define JENSEN_SPARSE_MEM (0xfffffc0200000000UL)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* With respect to the I/O architecture, APECS and LCA are identical,
|
* With respect to the I/O architecture, APECS and LCA are identical,
|
||||||
@ -94,7 +94,7 @@ static struct platform {
|
|||||||
{"EB64+", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
{"EB64+", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
||||||
{"EB66", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
{"EB66", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
||||||
{"EB66P", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
{"EB66P", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
||||||
{"Jensen", IOSYS_JENSEN, JENSEN_MEM, JENSEN_MEM},
|
{"Jensen", IOSYS_JENSEN, 0, JENSEN_SPARSE_MEM},
|
||||||
{"Mikasa", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
{"Mikasa", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
||||||
{"Mustang", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
{"Mustang", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
||||||
{"Noname", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
{"Noname", IOSYS_APECS, APECS_DENSE_MEM, APECS_SPARSE_MEM},
|
||||||
|
@ -29,10 +29,12 @@ extern void __libc_global_ctors (void);
|
|||||||
/* The function is called from assembly stubs the compiler can't see. */
|
/* The function is called from assembly stubs the compiler can't see. */
|
||||||
static void init (void *) __attribute__ ((unused));
|
static void init (void *) __attribute__ ((unused));
|
||||||
|
|
||||||
extern int __libc_is_static;
|
extern int _dl_starting_up;
|
||||||
#ifdef PIC
|
weak_extern (_dl_starting_up)
|
||||||
weak_extern (__libc_is_static)
|
|
||||||
#endif
|
/* Set nonzero if we have to be prepared for more then one libc being
|
||||||
|
used in the process. Safe assumption if initializer never runs. */
|
||||||
|
int __libc_multiple_libcs = 1;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init (void *data)
|
init (void *data)
|
||||||
@ -43,39 +45,21 @@ init (void *data)
|
|||||||
char **argv = (char **)data + 1;
|
char **argv = (char **)data + 1;
|
||||||
char **envp = &argv[argc + 1];
|
char **envp = &argv[argc + 1];
|
||||||
|
|
||||||
/* XXX Another gcc bug. We marked the function as `unused' but it
|
|
||||||
is still optimized away. */
|
|
||||||
volatile void *foo __attribute__ ((unused)) = &init;
|
|
||||||
|
|
||||||
#ifdef PIC
|
__libc_multiple_libcs = &_dl_starting_up && ! _dl_starting_up;
|
||||||
if (&__libc_is_static != NULL)
|
|
||||||
#endif
|
/* We must not call `personality' twice. */
|
||||||
|
if (!__libc_multiple_libcs)
|
||||||
{
|
{
|
||||||
#ifdef PIC
|
/* The `personality' system call takes one argument that chooses
|
||||||
/* We must not call `personality' twice. */
|
the "personality", i.e. the set of system calls and such. We
|
||||||
if (__libc_is_static == 0)
|
must make this call first thing to disable emulation of some
|
||||||
#endif
|
other system that might have been enabled by default based on
|
||||||
{
|
the executable format. */
|
||||||
/* The `personality' system call takes one argument that
|
__personality (PER_LINUX);
|
||||||
chooses the "personality", i.e. the set of system calls
|
|
||||||
and such. We must make this call first thing to disable
|
|
||||||
emulation of some other system that might have been
|
|
||||||
enabled by default based on the executable format. */
|
|
||||||
__personality (PER_LINUX);
|
|
||||||
|
|
||||||
/* Set the FPU control word to the proper default value. */
|
/* Set the FPU control word to the proper default value. */
|
||||||
__setfpucw (__fpu_control);
|
__setfpucw (__fpu_control);
|
||||||
}
|
|
||||||
|
|
||||||
/* We set LIBC_IS_STATIC to a value > 0 for the static library
|
|
||||||
and < 0 for the shared library. This information might be
|
|
||||||
useful for the running program but it is mainly necessary for
|
|
||||||
the above `if' statement. */
|
|
||||||
#ifdef PIC
|
|
||||||
__libc_is_static = -1;
|
|
||||||
#else
|
|
||||||
__libc_is_static = 1;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__environ = envp;
|
__environ = envp;
|
||||||
|
@ -21,6 +21,8 @@ Cambridge, MA 02139, USA. */
|
|||||||
#define _SYS_IO_H 1
|
#define _SYS_IO_H 1
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
/* Get constants from kernel header files. */
|
/* Get constants from kernel header files. */
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
|
||||||
@ -39,4 +41,6 @@ extern int ioperm __P ((unsigned long int __from, unsigned long int __num,
|
|||||||
privileges. */
|
privileges. */
|
||||||
extern int iopl __P ((int __level));
|
extern int iopl __P ((int __level));
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
#endif /* _SYS_IO_H */
|
#endif /* _SYS_IO_H */
|
||||||
|
Reference in New Issue
Block a user