aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog34
-rw-r--r--elf/dl-lookup.c11
-rw-r--r--elf/reldep2.c4
-rw-r--r--sysdeps/arm/dl-machine.h2
-rw-r--r--sysdeps/generic/dl-machine.h2
-rw-r--r--sysdeps/hppa/dl-fptr.c4
-rw-r--r--sysdeps/hppa/dl-lookupcfg.h3
-rw-r--r--sysdeps/ia64/dl-fptr.c6
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.c2
-rw-r--r--sysdeps/mips/dl-machine.h2
-rw-r--r--sysdeps/mips/mips64/dl-machine.h2
-rw-r--r--sysdeps/powerpc/dl-machine.c2
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h2
-rw-r--r--sysdeps/unix/sysv/aix/Makefile5
-rw-r--r--sysdeps/unix/sysv/aix/fcntl.c3
-rw-r--r--sysdeps/unix/sysv/aix/init-first.c107
-rw-r--r--sysdeps/unix/sysv/aix/start-libc.c271
-rw-r--r--sysdeps/unix/sysv/aix/start.c294
-rw-r--r--sysdeps/unix/sysv/aix/start.s109
-rw-r--r--sysdeps/unix/sysv/aix/sysv_termio.h155
20 files changed, 706 insertions, 314 deletions
diff --git a/ChangeLog b/ChangeLog
index 81ba6caab6..afaa0d8da9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,39 @@
+2001-09-07 Tom Rix <trix@redhat.com>
+
+ * sysdeps/unix/sysv/aix/sysv_termio.h: New file.
+
+2001-08-26 Tom Rix <trix@redhat.com>
+
+ * sysdeps/unix/sysv/aix/Makefile (aix-syscalls.o): More linker
+ command line options.
+ * sysdeps/unix/sysv/aix/start.s: New file, rework of start.c
+ * sysdeps/unix/sysv/aix/start.c: Removed.
+ * sysdeps/unix/sysv/aix/start-libc.c: New file.
+ * sysdeps/unix/sysv/aix/init-first.c: New file.
+ * sysdeps/unix/sysv/aix/fcntl.c: Alias __libc_fcntl to __fcntl.
+
+2001-09-08 Ben Collins <bcollins@debian.org>
+
+ * sysdeps/arm/dl-machine.h: Fix usage of new _dl_signal_error() format.
+ * sysdeps/generic/dl-machine.h: Likewise.
+ * sysdeps/hppa/dl-fptr.c: Likewise.
+ * sysdeps/ia64/dl-fptr.c: Likewise.
+ * sysdeps/mach/hurd/dl-sysdep.c: Likewise.
+ * sysdeps/mips/dl-machine.h: Likewise.
+ * sysdeps/mips/mips64/dl-machine.h: Likewise.
+ * sysdeps/powerpc/dl-machine.c: Likewise.
+
+2001-09-07 Ben Collins <bcollins@debian.org>
+
+ * sysdeps/sparc/sparc32/dl-machine.h: Fix typo.
+
+ * sysdeps/hppa/dl-lookupcfg.h: Forward declare struct link_map.
+
2001-09-08 Ulrich Drepper <drepper@redhat.com>
+ * elf/dl-lookup.c (add_dependency): Bump l_opencount of all
+ dependencies if necessary.
+
* elf/dl-close.c (_dl_close): If object has no r_list (i.e., wasn't
loaded directly) determine length if l_initfini list by iterating
over its elements. Minor optimizations.
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 26c839caa7..5fa50fc457 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -151,8 +151,15 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
if (__builtin_expect (act < undef_map->l_reldepsmax, 1))
undef_map->l_reldeps[undef_map->l_reldepsact++] = map;
- /* And increment the counter in the referenced object. */
- ++map->l_opencount;
+ if (map->l_searchlist.r_list != NULL)
+ /* And increment the counter in the referenced object. */
+ ++map->l_opencount;
+ else
+ /* We have to bump the counts for all dependencies since so far
+ this object was only a normal or transitive dependency.
+ Now it might be closed with _dl_close() directly. */
+ for (list = map->l_initfini; *list != NULL; ++list)
+ ++(*list)->l_opencount;
/* Display information if we are debugging. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
diff --git a/elf/reldep2.c b/elf/reldep2.c
index aadb0cbfdb..ba5ab222f9 100644
--- a/elf/reldep2.c
+++ b/elf/reldep2.c
@@ -53,8 +53,8 @@ main (void)
exit (1);
}
- /* Now close the first object. If must still be around since we have
- a implicit dependency. */
+ /* Now close the first object. It must still be around since we have
+ an implicit dependency. */
if (dlclose (h1) != 0)
{
printf ("closing h1 failed: %s\n", dlerror ());
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 2a4ce9fb01..6abac52c90 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -501,7 +501,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
topbits = newvalue & 0xfe000000;
if (topbits != 0xfe000000 && topbits != 0x00000000)
{
- _dl_signal_error (0, map->l_name,
+ _dl_signal_error (0, map->l_name, NULL,
"R_ARM_PC24 relocation out of range");
}
}
diff --git a/sysdeps/generic/dl-machine.h b/sysdeps/generic/dl-machine.h
index 963c95d88d..8b4425cea4 100644
--- a/sysdeps/generic/dl-machine.h
+++ b/sysdeps/generic/dl-machine.h
@@ -95,7 +95,7 @@ elf_machine_rela (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
int noplt))
{
_dl_signal_error (0, "Elf32_Rela relocation requested -- unused on "
- ELF_MACHINE_NAME);
+ NULL, ELF_MACHINE_NAME);
}
diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c
index 6cf8d37275..4f8cc8b5d1 100644
--- a/sysdeps/hppa/dl-fptr.c
+++ b/sysdeps/hppa/dl-fptr.c
@@ -101,7 +101,7 @@ __hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value,
if (_dl_zerofd == -1)
{
__close (fd);
- _dl_signal_error (errno, NULL,
+ _dl_signal_error (errno, NULL, NULL,
"cannot open zero fill device");
}
}
@@ -110,7 +110,7 @@ __hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value,
__fptr_next = __mmap (0, _dl_pagesize, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, ANONFD, 0);
if (__fptr_next == MAP_FAILED)
- _dl_signal_error(errno, NULL, "cannot map page for fptr");
+ _dl_signal_error(errno, NULL, NULL, "cannot map page for fptr");
__fptr_count = _dl_pagesize / sizeof (struct hppa_fptr);
}
f = __fptr_next++;
diff --git a/sysdeps/hppa/dl-lookupcfg.h b/sysdeps/hppa/dl-lookupcfg.h
index d15732b56d..d76ea1221d 100644
--- a/sysdeps/hppa/dl-lookupcfg.h
+++ b/sysdeps/hppa/dl-lookupcfg.h
@@ -23,6 +23,9 @@
#define ELF_FUNCTION_PTR_IS_SPECIAL
#define DL_UNMAP_IS_SPECIAL
+/* Forward declaration. */
+struct link_map;
+
void *_dl_symbol_address (const struct link_map *map, const ElfW(Sym) *ref);
#define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref)
diff --git a/sysdeps/ia64/dl-fptr.c b/sysdeps/ia64/dl-fptr.c
index c31de86079..6916635281 100644
--- a/sysdeps/ia64/dl-fptr.c
+++ b/sysdeps/ia64/dl-fptr.c
@@ -109,7 +109,7 @@ new_fdesc_table (struct local *l)
new_table = __mmap (0, size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
if (new_table == MAP_FAILED)
- _dl_signal_error (errno, NULL, "cannot map pages for fdesc table");
+ _dl_signal_error (errno, NULL, NULL, "cannot map pages for fdesc table");
new_table->len = (size - sizeof (*new_table)) / sizeof (struct ia64_fdesc);
fdesc = &new_table->fdesc[0];
@@ -182,7 +182,7 @@ make_fptr_table (struct link_map *map)
fptr_table = __mmap (NULL, size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
if (fptr_table == MAP_FAILED)
- _dl_signal_error (errno, NULL, "cannot map pages for fptr table");
+ _dl_signal_error (errno, NULL, NULL, "cannot map pages for fptr table");
map->l_mach.fptr_table_len = len;
map->l_mach.fptr_table = fptr_table;
@@ -203,7 +203,7 @@ __ia64_make_fptr (struct link_map *map, const Elf64_Sym *sym, Elf64_Addr ip)
symidx = sym - symtab;
if (symidx >= map->l_mach.fptr_table_len)
- _dl_signal_error (0, NULL,
+ _dl_signal_error (0, NULL, NULL,
"internal error: symidx out of range of fptr table");
if (!ftab[symidx])
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 6442347890..a17e92aff3 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -615,7 +615,7 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
/* Return an empty array. Hurd has no hardware capabilities. */
result = (struct r_strlenpair *) malloc (sizeof (*result));
if (result == NULL)
- _dl_signal_error (ENOMEM, NULL, "cannot create capability list");
+ _dl_signal_error (ENOMEM, NULL, NULL, "cannot create capability list");
result[0].str = (char *) result; /* Does not really matter. */
result[0].len = 0;
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index e066aad015..da9a5d3279 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -239,7 +239,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
}
}
- _dl_signal_error (0, NULL, "cannot find runtime link map");
+ _dl_signal_error (0, NULL, NULL, "cannot find runtime link map");
return NULL;
}
diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h
index 34a81615bb..d51f1e3cb1 100644
--- a/sysdeps/mips/mips64/dl-machine.h
+++ b/sysdeps/mips/mips64/dl-machine.h
@@ -311,7 +311,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
}
}
- _dl_signal_error (0, NULL, "cannot find runtime link map");
+ _dl_signal_error (0, NULL, NULL, "cannot find runtime link map");
return NULL;
}
diff --git a/sysdeps/powerpc/dl-machine.c b/sysdeps/powerpc/dl-machine.c
index c9c4fe00d5..0e3164f70d 100644
--- a/sysdeps/powerpc/dl-machine.c
+++ b/sysdeps/powerpc/dl-machine.c
@@ -391,7 +391,7 @@ dl_reloc_overflow (struct link_map *map,
t = stpcpy (t, "'");
}
t = stpcpy (t, " out of range");
- _dl_signal_error (0, map->l_name, buffer);
+ _dl_signal_error (0, map->l_name, NULL, buffer);
}
void
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index a44ddbbd57..d98848b5dd 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -355,7 +355,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
weak_extern (_dl_rtld_map);
#endif
-#if !define RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
{
# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
diff --git a/sysdeps/unix/sysv/aix/Makefile b/sysdeps/unix/sysv/aix/Makefile
index 3fcf4bb3e9..2da5311091 100644
--- a/sysdeps/unix/sysv/aix/Makefile
+++ b/sysdeps/unix/sysv/aix/Makefile
@@ -11,11 +11,11 @@ sysdep_routines += aix-syscalls
$(objpfx)aix-syscalls.o : /lib/syscalls.exp
echo "static int a;" > foo.c
$(CC) -c foo.c
- ld -bM:SRE -bnoentry -bI:/lib/syscalls.exp -bE:/lib/syscalls.exp foo.o -o $@
+ ld -bM:SRE -bpT:0x00000000 -bpD:0x00000000 -bnoentry -bI:/lib/syscalls.exp -bE:/lib/syscalls.exp foo.o -o $@
rm foo.c foo.o
-endif
+endif
ifeq ($(subdir),misc)
sysdep_routines += dl-error dl-support dl-libc dl-open dl-sym \
@@ -39,4 +39,3 @@ inhibit-glue = yes
ifeq ($(subdir),timezone)
CPPFLAGS-zic.c = -Dunix
endif
-
diff --git a/sysdeps/unix/sysv/aix/fcntl.c b/sysdeps/unix/sysv/aix/fcntl.c
index 196bbf52cd..8c5ba154c2 100644
--- a/sysdeps/unix/sysv/aix/fcntl.c
+++ b/sysdeps/unix/sysv/aix/fcntl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -38,3 +38,4 @@ __fcntl (int fdes, int cmd, ...)
return res;
}
strong_alias (__fcntl, fcntl)
+strong_alias (__fcntl, __libc_fcntl)
diff --git a/sysdeps/unix/sysv/aix/init-first.c b/sysdeps/unix/sysv/aix/init-first.c
new file mode 100644
index 0000000000..2c8e0b1900
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/init-first.c
@@ -0,0 +1,107 @@
+/* Initialization code run first thing by the XCOFF startup code. AIX version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sysdep.h>
+#include <fpu_control.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <libc-internal.h>
+
+#ifndef SHARED
+# include <ldsodefs.h>
+# include "dl-osinfo.h"
+#endif
+
+extern void __libc_init (int, char **, char **);
+
+/* The function is called from assembly stubs the compiler can't see. */
+static void init (int, char **, char **) __attribute__ ((unused));
+
+extern int _dl_starting_up;
+weak_extern (_dl_starting_up)
+
+extern fpu_control_t _dl_fpu_control;
+extern int _dl_fpu_control_set;
+
+/* 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;
+
+/* Remember the command line argument and enviroment contents for
+ later calls of initializers for dynamic libraries. */
+int __libc_argc;
+char **__libc_argv;
+
+
+static void
+init (int argc, char **argv, char **envp)
+{
+ extern void __getopt_clean_environment (char **);
+ /* The next variable is only here to work around a bug in gcc <= 2.7.2.2.
+ If the address would be taken inside the expression the optimizer
+ would try to be too smart and throws it away. Grrr. */
+
+ /* XXX disable dl for now
+ int *dummy_addr = &_dl_starting_up;
+
+ __libc_multiple_libcs = dummy_addr && !_dl_starting_up; */
+
+ /* Save the command-line arguments. */
+ __libc_argc = argc;
+ __libc_argv = argv;
+ __environ = envp;
+
+#ifndef SHARED
+ __libc_init_secure ();
+#endif
+
+ __libc_init (argc, argv, envp);
+
+ /* This is a hack to make the special getopt in GNU libc working. */
+ __getopt_clean_environment (envp);
+
+#ifdef SHARED
+ __libc_global_ctors ();
+#endif
+}
+
+#ifdef SHARED
+
+strong_alias (init, _init);
+
+extern void __libc_init_first (void);
+
+void
+__libc_init_first (void)
+{
+}
+
+#else
+extern void __libc_init_first (int argc, char **argv, char **envp);
+
+void
+__libc_init_first (int argc, char **argv, char **envp)
+{
+ init (argc, argv, envp);
+}
+#endif
diff --git a/sysdeps/unix/sysv/aix/start-libc.c b/sysdeps/unix/sysv/aix/start-libc.c
new file mode 100644
index 0000000000..e3582e3892
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/start-libc.c
@@ -0,0 +1,271 @@
+/* Initialization code run first thing by the XCOFF startup code. AIX version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* hack to use uchar's */
+typedef unsigned char uchar;
+#include <xcoff.h>
+#include <rtinit.h>
+#include <dlldr.h>
+#include <bits/libc-lock.h>
+
+extern void __libc_init_first (int argc, char **argv, char **envp);
+
+/* XXX disable for now
+extern int _dl_starting_up;
+weak_extern (_dl_starting_up)
+extern int __libc_multiple_libcs; */
+
+/* XXX normally defined in generic/dl-sydep.c, hack it into existance
+extern void *__libc_stack_end; */
+void *__libc_stack_end;
+
+struct __libc_start_data_rec
+{
+ void *stack;
+ void *toc;
+ int argc;
+ char **argv;
+ char **envp;
+ char *data;
+ char *text;
+ unsigned int mcount;
+ unsigned int special;
+ int (*main) (int, char **, char **);
+ void (*init) (void);
+ void (*fini) (void);
+ void (*rtld_fini) (void);
+};
+
+extern struct __libc_start_data_rec __libc_start_data;
+extern int errno;
+
+/* The first piece of initialized data. */
+int __data_start = 0;
+
+#ifndef HAVE_ELF
+/* Since gcc/crtstuff.c won't define it unless the ELF format is used
+ we will need to define it here. */
+void *__dso_handle = NULL;
+#endif
+
+/* AIX kernel function */
+extern int __loadx (int flag, void *module, void *arg1, void *arg2,
+ void *arg3);
+/* Needed by setenv */
+char **__environ;
+
+/* Needed by dl-support.c */
+/* XXX stubbing out dl-support.c for now..
+ size_t _dl_pagesize = 0; */
+
+/*
+ Find __rtinit symbol
+
+ __RTINIT *find_rtinit()
+
+ __RTINIT *rti - pointer to __rtinit data structure
+ */
+
+static __RTINIT *
+find_rtinit (void)
+{
+ struct xcoffhdr *xcoff_hdr;
+ SCNHDR *sec_hdr;
+ SCNHDR *ldr_sec_hdr;
+ SCNHDR *data_sec_hdr;
+ LDSYM *ldsym_hdr;
+ __RTINIT *rtl;
+
+ xcoff_hdr = (struct xcoffhdr *) __libc_start_data.text;
+ sec_hdr = (SCNHDR *) ((caddr_t) &xcoff_hdr->aouthdr
+ + xcoff_hdr->filehdr.f_opthdr);
+ ldr_sec_hdr = (SCNHDR *) (sec_hdr + (xcoff_hdr->aouthdr.o_snloader - 1));
+ ldsym_hdr = (LDSYM *) ((caddr_t)xcoff_hdr + ldr_sec_hdr->s_scnptr
+ + LDHDRSZ);
+
+ if ( __libc_start_data.mcount <= 0)
+ {
+ if (!ldr_sec_hdr->s_scnptr)
+ return (__RTINIT *) 0;
+
+ if (memcmp (ldsym_hdr, RTINIT_NAME, sizeof (RTINIT_NAME) - 1))
+ return (__RTINIT *) 0;
+ }
+
+ data_sec_hdr = (SCNHDR *) (sec_hdr + (xcoff_hdr->aouthdr.o_sndata - 1));
+ rtl = (__RTINIT *) (ldsym_hdr->l_value
+ + (__libc_start_data.data - data_sec_hdr->s_vaddr));
+ return rtl;
+}
+
+/*
+ The mod_init1 calls every initialization function for a given module.
+
+ void mod_init1(handler, rti)
+
+ void *handler - if NULL init funtions for modules loaded at exec time
+ are being executed. Otherwise, the handler points to the
+ module loaded.
+
+ __RTINIT *rti - pointer to __rtinit data structure (with rti->init_offset
+ not equal to zero)
+ */
+
+static void
+mod_init1 (void *handler,__RTINIT *rtl)
+{
+ __RTINIT_DESCRIPTOR *descriptor;
+
+ descriptor = (__RTINIT_DESCRIPTOR *) ((caddr_t) &rtl->rtl
+ + rtl->init_offset);
+ while (descriptor->f != NULL)
+ {
+ if (!(descriptor->flags & _RT_CALLED))
+ {
+ descriptor->flags |= _RT_CALLED;
+ (descriptor->f) (handler, rtl, descriptor); /* execute init/fini */
+ }
+ descriptor = (__RTINIT_DESCRIPTOR *) ((caddr_t) descriptor
+ + rtl->__rtinit_descriptor_size);
+ }
+}
+
+/* The modinit() function performs run-time linking, if enabled, and calling
+ the init() function for all loaded modules. */
+
+#define DL_BUFFER_SIZE 1000