aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog84
-rw-r--r--bits/resource.h4
-rw-r--r--manual/install.texi28
-rw-r--r--posix/Makefile11
-rw-r--r--posix/wordexp-test.c2
-rwxr-xr-xposix/wordexp-tst.sh24
-rw-r--r--posix/wordexp.c6
-rw-r--r--string/bits/string2.h37
-rw-r--r--sysdeps/arm/__longjmp.S7
-rw-r--r--sysdeps/arm/bits/fenv.h90
-rw-r--r--sysdeps/arm/bsd-_setjmp.S4
-rw-r--r--sysdeps/arm/bsd-setjmp.S4
-rw-r--r--sysdeps/arm/dl-machine.h478
-rw-r--r--sysdeps/arm/elf/setjmp.S76
-rw-r--r--sysdeps/arm/elf/start.S109
-rw-r--r--sysdeps/arm/fpu/__longjmp.S36
-rw-r--r--sysdeps/arm/fpu/setjmp.S35
-rw-r--r--sysdeps/arm/init-first.c71
-rw-r--r--sysdeps/arm/memset.S68
-rw-r--r--sysdeps/arm/setjmp.S9
-rw-r--r--sysdeps/arm/sysdep.h13
-rw-r--r--sysdeps/generic/bits/resource.h4
-rw-r--r--sysdeps/generic/libc-start.c37
-rw-r--r--sysdeps/generic/setsockopt.c4
-rw-r--r--sysdeps/unix/arm/brk.S19
-rw-r--r--sysdeps/unix/arm/sysdep.S36
-rw-r--r--sysdeps/unix/sysv/linux/Dist2
-rw-r--r--sysdeps/unix/sysv/linux/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/arm/socket.S6
-rw-r--r--sysdeps/unix/sysv/linux/arm/sysdep.h6
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h18
-rw-r--r--sysdeps/unix/sysv/linux/libc-start.c73
-rw-r--r--sysdeps/unix/sysv/linux/netash/ash.h34
-rw-r--r--sysdeps/unix/sysv/linux/netpacket/packet.h61
35 files changed, 1344 insertions, 158 deletions
diff --git a/ChangeLog b/ChangeLog
index 91bda00f91..6eb771e7a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,87 @@
+1998-03-18 14:25 Ulrich Drepper <drepper@cygnus.com>
+
+ * string/bits/string2.h: Add optimization for strdup.
+ Always define __strsep and __strtok_r and make real names available
+ when feature select macros are defined.
+
+1998-03-18 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * manual/install.texi (Installation): Use i486-linux as example
+ instead of the unsupported sunos4.
+ (Reporting Bugs): Mention glibcbug script.
+ (Tools for Installation): gcc 2.8.1/egcs 1.0.2 is required.
+
+1998-03-16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * posix/wordexp-tst.sh: Make portable. Add more tests.
+
+ * posix/Makefile (do-globtest do-wordexp-test): New targets.
+
+1998-03-18 13:38 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/unix/sysv/linux/libc-start.c: Moved to ...
+ * sysdeps/generic/libc-start.c: ...here, replacing former content.
+
+ * sysdeps/unix/sysv/linux/Dist: Add netash/ash.h and
+ netpacket/packet.h.
+
+ * sysdeps/unix/sysv/linux/bits/socket.h: Pretty print.
+
+1998-03-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/unix/sysv/linux/bits/resource.h: Remove trailing comma
+ in enumerator for strict standard compliance.
+ * sysdeps/generic/bits/resource.h: Likewise.
+
+1998-03-18 10:04 Philip Blundell <pb@nexus.co.uk>
+
+ * sysdeps/arm/sysdep.h (__ARM_USES_FP): Deleted.
+ (PLTJMP): New macro.
+
+ * sysdeps/arm/fpu/__longjmp.S: New file, implementation of
+ longjmp() when floating point enabled.
+ * sysdeps/arm/fpu/setjmp.S: Likewise for setjmp().
+ * sysdeps/arm/__longjmp.S: Remove floating point code.
+ * sysdeps/arm/setjmp.S: Likewise.
+
+ * sysdeps/arm/bsd-setjmp.S: Call __sigsetjmp by correct name.
+ * sysdeps/arm/bsd-_setjmp.S: Likewise.
+
+ * sysdeps/arm/memset.S: New file; optimised ARM implementation of
+ memset().
+
+ * sysdeps/generic/setsockopt.c (setsockopt): Keep in step with
+ prototype.
+
+1998-03-17 16:16 Philip Blundell <pb@nexus.co.uk>
+
+ Based on patches from Pat Beirne and Scott Bambrough:
+
+ * sysdeps/arm/__longjmp.S: Use ip, not r2, as temporary.
+
+ * sysdeps/arm/bits/fenv.h: New file.
+
+ * sysdeps/arm/dl-machine.h: New file. Add ELF support.
+ * sysdeps/arm/elf/setjmp.S: Likewise.
+ * sysdeps/arm/elf/start.S: Likewise.
+ * sysdeps/arm/init-first.c: Likewise.
+ * sysdeps/arm/setjmp.S: Call __sigjmp_save through PLT
+ * sysdeps/arm/sysdep.h: Change format of .type directive. Correct
+ comment about floating point to reflect current reality.
+
+ * sysdeps/unix/arm/brk.S: Support PIC.
+ * sysdeps/unix/arm/sysdep.S (syscall_error): Support PIC and
+ re-entrant code.
+ * sysdeps/unix/sysv/linux/arm/socket.S: Check correctly for error
+ return; call syscall_error through PLT.
+ * sysdeps/unix/sysv/linux/arm/sysdep.h (ENTRY): Correct error jump.
+
+1998-03-04 12:01 Philip Blundell <pb@nexus.co.uk>
+
+ * sysdeps/unix/sysv/linux/netpacket/packet.h: New file.
+ * sysdeps/unix/sysv/linux/netash/ash.h: Likewise.
+ * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Install them.
+
1998-03-18 Ulrich Drepper <drepper@cygnus.com>
* dirent/list.c (test): Return error value.
diff --git a/bits/resource.h b/bits/resource.h
index e29be98210..d0bbe30df0 100644
--- a/bits/resource.h
+++ b/bits/resource.h
@@ -1,5 +1,5 @@
/* Bit values & structures for resource limits. 4.4 BSD/generic GNU version.
- Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1996, 1997, 1998 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
@@ -65,7 +65,7 @@ enum __rlimit_resource
#define RLIMIT_NOFILE RLIMIT_NOFILE
RLIMIT_NLIMITS, /* Number of limit flavors. */
- RLIM_NLIMITS = RLIMIT_NLIMITS, /* Traditional name for same. */
+ RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same. */
};
/* Value to indicate that there is no limit. */
diff --git a/manual/install.texi b/manual/install.texi
index 6f686c37a8..e1d20868a6 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -25,14 +25,14 @@ and describes problems you may experience with compilation and
installation. It is updated more frequently than this manual.
To configure the GNU C library for your system, run the shell script
-@file{configure} with @code{sh}. Use an argument which is the
+@file{configure} with @code{sh}. You might use an argument which is the
conventional GNU name for your system configuration---for example,
-@samp{sparc-sun-sunos4.1}, for a Sun 4 running SunOS 4.1.
+@samp{i486-pc-linux-gnu}, for Linux running on i486.
@xref{Installation, Installation, Installing GNU CC, gcc.info, Using and
Porting GNU CC}, for a full description of standard GNU configuration
names. If you omit the configuration name, @file{configure} will try to
guess one for you by inspecting the system it is running on. It may or
-may not be able to come up with a guess, and the its guess might be
+may not be able to come up with a guess, and the guess might be
wrong. @file{configure} will tell you the canonical name of the chosen
configuration before proceeding.
@@ -109,9 +109,9 @@ because there are bugs in @code{make clean}. Make a directory for the
build, and run @code{configure} from that directory, like this:
@smallexample
-mkdir sun4
-cd sun4
-../configure sparc-sun-sunos4.1
+mkdir linux
+cd linux
+../configure
@end smallexample
@noindent
@@ -190,14 +190,11 @@ recommend version GNU @code{make} version 3.75. Versions 3.76 and
GNU @code{libc}.
@item
-GCC 2.7.2.3
+GCC 2.8.1/EGCS 1.0.2
On most platforms, the GNU C library can only be compiled with the GNU C
-compiler. We recommend GCC version 2.7.2 or later; earlier versions may
-have problems.
-
-On PowerPC, GCC versions dated earlier than 970904 are known not to work
-(they crash), including 2.7.2.
+compiler family. We recommend GCC version 2.8.1 and EGCS version 1.0.2
+or later versions of these two; earlier versions may have problems.
@item
GNU @code{binutils} 2.8.1.0.23
@@ -363,9 +360,10 @@ If you think you have found some way in which the GNU C library does not
conform to the ISO and POSIX standards (@pxref{Standards and
Portability}), that is definitely a bug. Report it!@refill
-Send bug reports to the Internet address
-@email{bug-glibc@@gnu.org}. If you have other problems
-with installation or use, please report those as well.@refill
+Send bug reports to the Internet address @email{bug-glibc@@gnu.org}
+using the @code{glibcbug} script which is installed by the GNU C
+library. If you have other problems with installation or use, please
+report those as well.@refill
If you are not sure how a function should behave, and this manual
doesn't tell you, that's a bug in the manual. Report that too! If the
diff --git a/posix/Makefile b/posix/Makefile
index 0fc1787968..7b00d48435 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -64,9 +64,14 @@ before-compile := testcases.h
include ../Rules
ifeq (no,$(cross-compiling))
-tests: $(objpfx)globtest $(objpfx)wordexp-test
- $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) $(rtld-installed-name)
- $(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) $(rtld-installed-name)
+.PHONY: do-globtest do-wordexp-tst
+tests: do-globtest do-wordexp-test
+do-globtest: $(objpfx)globtest
+ $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) \
+ $(rtld-installed-name)
+do-wordexp-test: $(objpfx)wordexp-test
+ $(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) \
+ $(rtld-installed-name)
endif
CFLAGS-regex.c = -Wno-unused -Wno-strict-prototypes
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index 2fc5f0ffac..1797a7a42e 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -164,7 +164,7 @@ main (int argc, char *argv[])
const char *globfile[] = { "one", "two", "three", NULL };
char tmpdir[32];
struct passwd *pw;
- char *cwd;
+ const char *cwd;
int test;
int fail = 0;
int i;
diff --git a/posix/wordexp-tst.sh b/posix/wordexp-tst.sh
index e1f0b78830..57ef01383b 100755
--- a/posix/wordexp-tst.sh
+++ b/posix/wordexp-tst.sh
@@ -12,7 +12,13 @@ rtld_installed_name=$1; shift
testout=$TMPDIR/wordexp-test-result
failed=0
-export IFS=$(echo -e " \t\n")
+# This is written in this funny way so that there is no trailing whitespace.
+# The first line contains a space followed by a tab.
+IFS=" \
+
+"
+export IFS
+
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '$*' > ${testout}1
@@ -70,4 +76,20 @@ we_wordv[2] = "4"
we_wordv[3] = "th"
EOF
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${common_objpfx}posix/wordexp-test '${11}' 2 3 4 5 6 7 8 9 10 11 > ${testout}8
+cat <<"EOF" | cmp - ${testout}8 || failed=1
+wordexp returned 0
+we_wordv[0] = "11"
+EOF
+
+${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
+cat <<"EOF" | cmp - ${testout}9 || failed=1
+wordexp returned 0
+we_wordv[0] = "a "a $@ b""
+we_wordv[1] = "c"
+we_wordv[2] = "d b"
+EOF
+
exit $failed
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 1c69af8a1c..268a0e8c86 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1548,7 +1548,7 @@ envsubst:
pattern = qtd_pattern;
}
- if (pattern == NULL && (pattern = __strdup("")) == NULL)
+ if (pattern == NULL && (pattern = __strdup ("")) == NULL)
goto no_space;
error = wordexp (pattern, &we, flags);
@@ -1563,8 +1563,8 @@ envsubst:
assert (!quoted || we.we_wordc == 1);
/* Substitute */
- for (i = 0; i < we.we_wordc; i++)
- if (w_addword (pwordexp, __strdup(we.we_wordv[i]))
+ for (i = 0; i < we.we_wordc; ++i)
+ if (w_addword (pwordexp, __strdup (we.we_wordv[i]))
== WRDE_NOSPACE)
break;
diff --git a/string/bits/string2.h b/string/bits/string2.h
index 3104f949ba..4b8f161aa1 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -704,9 +704,8 @@ strnlen (__const char *__string, size_t __maxlen)
#endif
-#if defined __USE_POSIX || defined __USE_MISC
-# ifndef _HAVE_STRING_ARCH_strtok_r
-# define strtok_r(s, sep, nextp) \
+#ifndef _HAVE_STRING_ARCH_strtok_r
+# define __strtok_r(s, sep, nextp) \
(__extension__ (__builtin_constant_p (sep) && __string2_1bptr_p (sep) \
? (((__const unsigned char *) (sep))[0] != '\0' \
&& ((__const unsigned char *) (sep))[1] == '\0' \
@@ -740,14 +739,15 @@ __strtok_r_1c (char *__s, char __sep, char **__nextp)
}
return __result;
}
+# if defined __USE_POSIX || defined __USE_MISC
+# define strtok_r(s, sep, nextp) __strtok_r (s, sep, nextp)
# endif
#endif
-#ifdef __USE_BSD
-# ifndef _HAVE_STRING_ARCH_strsep
+#ifndef _HAVE_STRING_ARCH_strsep
-# define strsep(s, reject) \
+# define __strsep(s, reject) \
(__extension__ (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \
&& ((__const unsigned char *) (reject))[0] != '\0' \
? (((__const unsigned char *) (reject))[1] == '\0' \
@@ -844,6 +844,31 @@ __strsep_g (char **__s, __const char *__reject)
*(*__s)++ = '\0';
return __retval;
}
+# ifdef __USE_BSD
+# define strsep(s, reject) __strsep (s, reject)
+# endif
+#endif
+
+
+#if !defined _HAVE_STRING_ARCH_strdup && !defined __STRICT_ANSI__
+
+/* We need the memory allocation functions. Including this header is
+ not allowed. */
+# include <stdlib.h>
+
+# define __strdup(s) \
+ (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s)
+ ? (((__const unsigned char *) (s))[0] == '\0'
+ ? return (char *) calloc (1, 1);
+ : ({ size_t len = strlen (s) + 1;
+ char *retval = (char *) malloc (len);
+ if (retval != NULL)
+ retval = (char *) memcpy (retval, s, len);
+ retval; }))
+ : strdup (s)))
+
+# if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+# define strdup(s) __strdup (s)
# endif
#endif
diff --git a/sysdeps/arm/__longjmp.S b/sysdeps/arm/__longjmp.S
index a2042f5543..239b0cfc85 100644
--- a/sysdeps/arm/__longjmp.S
+++ b/sysdeps/arm/__longjmp.S
@@ -1,5 +1,5 @@
/* longjmp for ARM.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 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
@@ -29,10 +29,5 @@ ENTRY (__longjmp)
movs r0, r1 /* get the return value in place */
moveq r1, #1 /* can't let setjmp() return zero! */
-#if __ARM_USES_FP
- add r2, r2, #48
- lfmfd f4, 4, [r2]
-#endif
-
LOADREGS(ia, r2, {v1-v6, sl, fp, sp, pc})
END (__longjmp)
diff --git a/sysdeps/arm/bits/fenv.h b/sysdeps/arm/bits/fenv.h
new file mode 100644
index 0000000000..3e4cdd3f3b
--- /dev/null
+++ b/sysdeps/arm/bits/fenv.h
@@ -0,0 +1,90 @@
+/* Copyright (C) 1997, 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
+
+
+/* Define bits representing the exception. We use the bit positions
+ of the appropriate bits in the FPU control word. */
+enum
+ {
+ FE_INVALID = 0x01,
+#define FE_INVALID FE_INVALID
+ __FE_DENORM = 0x02,
+ FE_DIVBYZERO = 0x04,
+#define FE_DIVBYZERO FE_DIVBYZERO
+ FE_OVERFLOW = 0x08,
+#define FE_OVERFLOW FE_OVERFLOW
+ FE_UNDERFLOW = 0x10,
+#define FE_UNDERFLOW FE_UNDERFLOW
+ FE_INEXACT = 0x20
+#define FE_INEXACT FE_INEXACT
+ };
+
+#define FE_ALL_EXCEPT \
+ (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+/* The ARM FPU supports all of the four defined rounding modes. We
+ use again the bit positions in the FPU control word as the values
+ for the appropriate macros. */
+enum
+ {
+ FE_TONEAREST = 0,
+#define FE_TONEAREST FE_TONEAREST
+ FE_DOWNWARD = 0x400,
+#define FE_DOWNWARD FE_DOWNWARD
+ FE_UPWARD = 0x800,
+#define FE_UPWARD FE_UPWARD
+ FE_TOWARDSZERO = 0xc00
+#define FE_TOWARDSZERO FE_TOWARDSZERO
+ };
+
+
+/* Type representing exception flags. */
+typedef unsigned short int fexcept_t;
+
+
+/* Type representing floating-point environment. This function corresponds
+ to the layout of the block written by the `fstenv'. */
+typedef struct
+ {
+ unsigned short int control_word;
+ unsigned short int __unused1;
+ unsigned short int status_word;
+ unsigned short int __unused2;
+ unsigned short int tags;
+ unsigned short int __unused3;
+ unsigned int eip;
+ unsigned short int cs_selector;
+ unsigned int opcode:11;
+ unsigned int __unused4:5;
+ unsigned int data_offset;
+ unsigned short int data_selector;
+ unsigned short int __unused5;
+ }
+fenv_t;
+
+/* If the default argument is used we use this value. */
+#define FE_DFL_ENV ((fenv_t *) -1)
+
+#ifdef __USE_GNU
+/* Floating-point environment where none of the exception is masked. */
+# define FE_NOMASK_ENV ((fenv_t *) -2)
+#endif
diff --git a/sysdeps/arm/bsd-_setjmp.S b/sysdeps/arm/bsd-_setjmp.S
index 5643c50918..6ae6da6457 100644
--- a/sysdeps/arm/bsd-_setjmp.S
+++ b/sysdeps/arm/bsd-_setjmp.S
@@ -1,5 +1,5 @@
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. ARM version.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 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
@@ -25,5 +25,5 @@
ENTRY (_setjmp)
mov r1, #0
- b __sigsetjmp
+ b C_SYMBOL_NAME(__sigsetjmp)
END (_setjmp)
diff --git a/sysdeps/arm/bsd-setjmp.S b/sysdeps/arm/bsd-setjmp.S
index ac7dd96821..52622e2155 100644
--- a/sysdeps/arm/bsd-setjmp.S
+++ b/sysdeps/arm/bsd-setjmp.S
@@ -1,5 +1,5 @@
/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. ARM version.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 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
@@ -25,5 +25,5 @@
ENTRY (setjmp)
mov r1, #1
- b __sigsetjmp
+ b C_SYMBOL_NAME(__sigsetjmp)
END (setjmp)
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
new file mode 100644
index 0000000000..66b69d02db
--- /dev/null
+++ b/sysdeps/arm/dl-machine.h
@@ -0,0 +1,478 @@
+/* Machine-dependent ELF dynamic relocation inline functions. ARM version.
+ Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef dl_machine_h
+#define dl_machine_h
+
+#define ELF_MACHINE_NAME "ARM"
+
+#include <sys/param.h>
+
+#include <assert.h>
+
+/* Return nonzero iff E_MACHINE is compatible with the running host. */
+static inline int __attribute__ ((unused))
+elf_machine_matches_host (Elf32_Half e_machine)
+{
+ switch (e_machine)
+ {
+ case EM_ARM:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+/* Return the link-time address of _DYNAMIC. Conveniently, this is the
+ first element of the GOT. This must be inlined in a function which
+ uses global data. */
+static inline Elf32_Addr __attribute__ ((unused))
+elf_machine_dynamic (void)
+{
+ register Elf32_Addr *got asm ("r10");
+ return *got;
+}
+
+
+/* Return the run-time load address of the shared object. */
+// patb
+static inline Elf32_Addr __attribute__ ((unused))
+elf_machine_load_address (void)
+{
+ Elf32_Addr addr;
+ asm (" ldr ip,.L1
+ ldr r3,.L3
+ add r3, r3, sl
+ ldr ip,[sl, ip]
+ sub ip, r3, ip
+ b .L2
+ .L1: .word _dl_start(GOT)
+ .L3: .word _dl_start(GOTOFF)
+ .L2: mov %0, ip"
+ : "=r" (addr) : : "ip", "r3");
+ return addr;
+}
+
+
+/* Set up the loaded object described by L so its unrelocated PLT
+ entries will jump to the on-demand fixup code in dl-runtime.c. */
+
+static inline int __attribute__ ((unused))
+elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
+{
+ Elf32_Addr *got;
+ extern void _dl_runtime_resolve (Elf32_Word);
+ extern void _dl_runtime_profile (Elf32_Word);
+
+ if (l->l_info[DT_JMPREL] && lazy)
+ {
+ /* patb: this is different than i386 */
+ /* The GOT entries for functions in the PLT have not yet been filled
+ in. Their initial contents will arrange when called to push an
+ index into the .got section, load ip with &_GLOBAL_OFFSET_TABLE_[3],
+ and then jump to _GLOBAL_OFFSET_TABLE[2]. */
+ got = (Elf32_Addr *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr);
+ got[1] = (Elf32_Addr) l; /* Identify this shared object. */
+
+ /* The got[2] entry contains the address of a function which gets
+ called to get the address of a so far unresolved function and
+ jump to it. The profiling extension of the dynamic linker allows
+ to intercept the calls to collect information. In this case we
+ don't store the address in the GOT so that all future calls also
+ end in this function. */
+ if (profile)
+ {
+ got[2] = (Elf32_Addr) &_dl_runtime_profile;
+ /* Say that we really want profiling and the timers are started. */
+ _dl_profile_map = l;
+ }
+ else
+ /* This function will get called to fix up the GOT entry indicated by
+ the offset on the stack, and then jump to the resolved address. */
+ got[2] = (Elf32_Addr) &_dl_runtime_resolve;
+ }
+ return lazy;
+}
+
+/* This code is used in dl-runtime.c to call the `fixup' function
+ and then redirect to the address it returns. */
+ // macro for handling PIC situation....
+#ifdef PIC
+#define CALL_ROUTINE(x) " ldr sl,0f
+ add sl, pc, sl
+1: ldr r2, 2f
+ mov lr, pc
+ add pc, sl, r2
+ b 3f
+0: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4
+2: .word " #x "(GOTOFF)
+3: "
+#else
+#define CALL_ROUTINE(x) " bl " #x
+#endif
+
+#ifndef PROF
+# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
+ .text
+ .globl _dl_runtime_resolve
+ .type _dl_runtime_resolve, #function
+ .align 2
+_dl_runtime_resolve:
+ @ we get called with
+ @ stack[0] contains the return address from this call
+ @ ip contains &GOT[n+3] (pointer to function)
+ @ lr points to &GOT[2]
+
+ @ save almost everything; lr is already on the stack
+ stmdb sp!,{r0-r3,sl,fp}
+
+ @ prepare to call fixup()
+
+ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
+ sub r1, ip, lr
+ sub r1, r1, #4
+ add r1, r1, r1
+
+ @ get pointer to linker struct
+ ldr r0, [lr, #-4]
+
+ " CALL_ROUTINE(fixup) "
+
+ @ save the return
+ mov ip, r0
+
+ @ restore the stack
+ ldmia sp!,{r0-r3,sl,fp,lr}
+
+ @ jump to the newly found address
+ mov pc, ip
+
+ .size _dl_runtime_resolve, .-_dl_runtime_resolve
+
+ .globl _dl_runtime_profile
+ .type _dl_runtime_profile, #function
+ .align 2
+_dl_runtime_profile:
+ @ we get caled with
+ @ stack[0] contains the return address from this call
+ @ ip contains &GOT[n+3] (pointer to function)
+ @ lr points to &GOT[2]
+
+ @ save almost everything; return add is already on the stack
+ stmdb sp!,{r0-r3,fp}
+
+ @ prepare to call fixup()
+
+ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
+ sub r1, ip, lr
+ sub r1, r1, #4
+ add r1, r1, r1
+
+ @ get pointer to linker struct
+ ldr r0, [lr, #-4]
+
+ " CALL_ROUTINE(profile_fixup) "
+
+ @ save the return
+ mov ip, r0
+
+ @ restore the stack
+ ldmia sp!,{r0-r3,fp,lr}
+
+ @ jump to the newly found address
+ mov pc, ip
+
+ .size _dl_runtime_profile, .-_dl_runtime_profile
+ .previous
+");
+#else // PROF
+# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
+ .text
+ .globl _dl_runtime_resolve
+ .globl _dl_runtime_profile
+ .type _dl_runtime_resolve, #function
+ .type _dl_runtime_profile, #function
+ .align 2
+_dl_runtime_resolve:
+_dl_runtime_profile:
+ stmdb sp!,{r0-r3,fp}
+ ldr r1,[sp,#0x34]
+ sub r1, ip, lr
+ sub r1, r1, #4
+ add r1, r1, r1
+ ldr r0, [lr, #-4]
+ " CALL_ROUTINE(fixup) "
+ mov ip, r0
+ ldmia sp!,{r0-r3,fp,lr}
+ mov pc, ip
+
+ .size _dl_runtime_profile, .-_dl_runtime_profile
+ .previous
+");
+#endif //PROF
+
+/* Mask identifying addresses reserved for the user program,
+ where the dynamic linker should not map anything. */
+#define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL
+
+/* Initial entry point code for the dynamic linker.
+ The C function `_dl_start' is the real entry point;
+ its return value is the user program's entry point. */
+
+#define RTLD_START asm ("\
+.text
+.globl _start
+.globl _dl_start_user
+_start:
+ @ at start time, all the args are on the stack
+ mov r0, sp
+ bl _dl_start
+ @ returns user entry point in r0
+_dl_start_user:
+ mov r6, r0
+ @ we are PIC code, so get global offset table
+ ldr sl, .L_GET_GOT
+ add sl, pc, sl
+.L_GOT_GOT:
+ @ See if we were run as a command with the executable file
+ @ name as an extra leading argument.
+ ldr r1, .L_SKIP_ARGS
+ ldr r1, [sl, r1]
+ @ get the original arg count
+ ldr r0, [sp]
+ @ subtract _dl_skip_args from it
+ sub r0, r0, r1
+ @ adjust the stack pointer to skip them
+ add sp, sp, r1, lsl #2
+ @ store the new argc in the new stack location
+ str r0, [sp]
+
+ @ now we enter a _dl_init_next loop
+ ldr r2, .L_DEF_SCOPE
+ ldr r2, [sl, r2]
+ ldr r4, [r2, #8]
+ @ call _dl_init_next to get the address of an initalizer
+0: mov r0, r4
+ bl _dl_init_next(PLT)
+ cmp r0, #0
+ beq 1f
+ @ call the shared-object initializer
+ @ during this call, the stack may get moved around
+ mov lr, pc
+ mov pc, r0
+ @ go back and look for another initializer
+ b 0b
+1: @ clear the startup flag
+ ldr r2, .L_STARTUP_FLAG
+ ldr r1, [sl, r2]
+ @ we know r0==0 at this point
+ str r0, [r1]
+ @ load the finalizer function
+ ldr r0, .L_FINI_PROC
+ ldr r0, [sl, r0]
+ @ jump to the user_s entry point
+ mov pc, r6
+.L_GET_GOT:
+ .word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4 \n\
+.L_SKIP_ARGS: \n\
+ .word _dl_skip_args(GOTOFF) \n\
+.L_DEF_SCOPE: \n\
+ .word _dl_default_scope(GOT) \n\
+.L_STARTUP_FLAG:
+ .word _dl_starting_up(GOT)
+.L_FINI_PROC:
+ .word _dl_fini(GOT)
+.previous\n\
+");
+
+/* Nonzero iff TYPE should not be allowed to resolve to one of
+ the main executable's symbols, as for a COPY reloc. */
+#define elf_machine_lookup_noexec_p(type) ((type) == R_ARM_COPY)
+
+/* Nonzero iff TYPE describes relocation of a PLT entry, so
+ PLT entries should not be allowed to define the value. */
+#define elf_machine_lookup_noplt_p(type) ((type) == R_ARM_JMP_SLOT)
+
+/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
+#define ELF_MACHINE_JMP_SLOT R_ARM_JMP_SLOT
+
+/* The i386 never uses Elf32_Rela relocations. */
+#define ELF_MACHINE_NO_RELA 1
+
+/* We define an initialization functions. This is called very early in
+ _dl_sysdep_start. */
+#define DL_PLATFORM_INIT dl_platform_init ()
+
+extern const char *_dl_platform;
+
+static inline void __attribute__ ((unused))
+dl_platform_init (void)
+{
+ if (_dl_platform == NULL)
+ /* We default to ARM
+ This is where processors could be distinguished arm2, arm6, sa110, etc */
+ _dl_platform = "ARM";
+}
+
+static inline void
+elf_machine_fixup_plt (struct link_map *map, const Elf32_Rel *reloc,
+ Elf32_Addr *reloc_addr, Elf32_Addr value)
+{
+ *reloc_addr = value;
+}
+
+/* Return the final value of a plt relocation. */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
+ Elf32_Addr value)
+{
+ return value;
+}
+
+#endif /* !dl_machine_h */
+
+#ifdef RESOLVE
+
+extern char **_dl_argv;
+
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+ MAP is the object containing the reloc. */
+
+static inline void
+elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
+ const Elf32_Sym *sym, const struct r_found_version *version,
+ Elf32_Addr *const reloc_addr)
+{
+ if (ELF32_R_TYPE (reloc->r_info) == R_ARM_RELATIVE)
+ {
+#ifndef RTLD_BOOTSTRAP
+ if (map != &_dl_rtld_map) /* Already done in rtld itself. */
+#endif
+ *reloc_addr += map->l_addr;
+ }
+ else if (ELF32_R_TYPE (reloc->r_info) != R_ARM_NONE)
+ {
+ const Elf32_Sym *const refsym = sym;
+ Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info));
+ if (sym)
+ value += sym->st_value;
+
+ switch (ELF32_R_TYPE (reloc->r_info))
+ {
+ case R_ARM_COPY:
+ if (sym == NULL)
+ /* This can happen in trace mode if an object could not be
+ found. */
+ break;
+ if (sym->st_size > refsym->st_size
+ || (_dl_verbose && sym->st_size < refsym->st_size))
+ {
+ const char *strtab;
+
+ strtab = ((const char *) map->l_addr
+ + map->l_info[DT_STRTAB]->d_un.d_ptr);
+ _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+ ": Symbol `", strtab + refsym->st_name,
+ "' has different size in shared object, "
+ "consider re-linking\n", NULL);
+ }
+ memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
+ refsym->st_size));
+ break;
+ case R_ARM_GLOB_DAT:
+ case R_ARM_JMP_SLOT:
+
+#if 0
+#define _HEX(i) for (j=28; j>=0; j-=4) b[7-j/4]="0123456789abcdef"[((int)i>>j)&15];
+{
+char b[10];
+int j;
+_HEX(map->l_addr);
+__asm__ (" mov r0, #2; mov r1, %0; mov r2, #9; swi 0x00900004; "
+ : : "r"(b) : "r0", "r1", "r2" );
+_HEX(sym->st_size);
+__asm__ (" mov r0, #2; mov r1, %0; mov r2, #9; swi 0x00900004; "
+ : : "r"(b) : "r0", "r1", "r2" );
+_HEX(&sym->st_value);
+__asm__ (" mov r0, #2; mov r1, %0; mov r2, #9; swi 0x00900004; "
+ : : "r"(b) : "r0", "r1", "r2" );
+_HEX(sym->st_value);
+__asm__ (" mov r0, #2; mov r1, %0; mov r2, #9; swi 0x00900004; "
+ : : "r"(b) : "r0", "r1", "r2" );
+_HEX(sym);
+__asm__ (" mov r0, #2; mov r1, %0; mov r2, #9; swi 0x00900004; "
+ : : "r"(b) : "r0", "r1", "r2" );
+_HEX(reloc_addr);
+__asm__ (" mov r0, #2; mov r1, %0; mov r2, #9; swi 0x00900004; "
+ : : "r"(b) : "r0", "r1", "r2" );
+b[0]=' '; b[1]='\n';
+__asm__ (" mov r0, #2; mov r1, %0; mov r2, #2; swi 0x00900004; "
+ : : "r"(b) : "r0", "r1", "r2" );
+}
+#endif
+ *reloc_addr = value;
+ break;
+ case R_ARM_32:
+ {
+#ifndef RTLD_BOOTSTRAP
+ /* This is defined in rtld.c, but nowhere in the static
+ libc.a; make the reference weak so static programs can
+ still link. This declaration cannot be done when
+ compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because
+ rtld.c contains the common defn for _dl_rtld_map, which
+ is incompatible with a weak decl in the same file. */
+ weak_extern (_dl_rtld_map);
+ if (map == &_dl_rtld_map)
+ /* Undo the relocation done here during bootstrapping.
+ Now we will relocate it anew, possibly using a
+ binding found in the user program or a loaded library
+ rather than the dynamic linker's built-in definitions
+ used while loading those libraries. */
+ value -= map->l_addr + refsym->st_value;
+#endif
+ *reloc_addr += value;
+ break;
+ }
+ case R_ARM_PC26:
+ *reloc_addr += (value - (Elf32_Addr) reloc_addr);
+ break;
+ default:
+ assert (! "unexpected dynamic reloc type");
+ break;
+ }
+ }
+}
+
+static inline void
+elf_machine_lazy_rel (struct link_map *map, const Elf32_Rel *reloc)
+{
+ Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
+ switch (ELF32_R_TYPE (reloc->r_info))
+ {
+ case R_ARM_JMP_SLOT:
+ *reloc_addr += map->l_addr;
+ break;
+ default:
+ assert (! "unexpected PLT reloc type");
+ break;
+ }
+}
+
+#endif /* RESOLVE */
diff --git a/sysdeps/arm/elf/setjmp.S b/sysdeps/arm/elf/setjmp.S
new file mode 100644
index 0000000000..51572ca515
--- /dev/null
+++ b/sysdeps/arm/elf/setjmp.S
@@ -0,0 +1,76 @@
+/* setjmp for arm, ELF version.
+ Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+
+ /* We include the BSD entry points here as well but we make
+ them weak. */
+ENTRY (setjmp)
+ .weak C_SYMBOL_NAME (setjmp)
+ @ call comes here with
+ @ lr = return pc
+ @ r0 = &jump_buf
+
+ @ add a second argument into the fray
+ mov r1, #1
+ @ call the common code
+ b __sigsetjmp(PLT)
+END (setjmp)
+
+ /* Binary compatibility entry point. */
+ENTRY (_setjmp)
+ .weak C_SYMBOL_NAME (_setjmp)
+ENTRY (__setjmp)
+ @ call comes here with
+ @ lr = return pc
+ @ r0 = &jump_buf
+
+ @ add a second argument into the fray
+ mov r1, #1
+ @ fall through to the common code....
+
+ENTRY (__sigsetjmp)
+ @ save the registers into the jmp_buf....
+ stmia r0, {r1-r6, sl, fp, sp, lr}
+
+ /* Make a tail call to __sigjmp_save; it takes the same args. */
+#ifdef PIC
+ /* We cannot use the PLT, because it requires that sl==r10 be set, but
+ we can't save and restore our caller's value. Instead, we do an
+ indirect jump through the GOT, using for the temporary register
+ ip, which is call-clobbered. */
+ ldr ip, 1f
+ add ip, ip, pc
+2: @ get the address of __sigjmp_save
+ ldr r1, 3f
+ ldr ip, [ip, r1]
+ @ restore r1
+ ldr r1, [r0]
+ @ jump to *__sigjmp_save
+ mov pc, ip
+1: .word _GLOBAL_OFFSET_TABLE_ - 2b - 4
+3: .word __sigjmp_save(GOT)
+
+#else
+ b __sigjmp_save
+#endif
+END (__sigsetjmp)
diff --git a/sysdeps/arm/elf/start.S b/sysdeps/arm/elf/start.S
new file mode 100644
index 0000000000..e0964a1e38
--- /dev/null
+++ b/sysdeps/arm/elf/start.S
@@ -0,0 +1,109 @@
+/* Startup code for ARM & ELF
+ Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment.
+
+ Note that the code in the .init section has already been run.
+ This includes _init and _libc_init
+
+
+ At this entry point, most registers' values are unspecified, except for:
+
+ r0 Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ sp The stack contains the arguments and environment:
+ 0(%esp) argc
+ 4(%esp) argv[0]
+ ...
+ (4*argc)(%esp) NULL
+ (4*(argc+1))(%esp) envp[0]
+ ...
+ NULL
+*/
+
+ .text
+ .globl _start
+_start:
+ /* Clear the frame pointer. The Intel ABI suggests this be done,
+ to mark the outermost frame obviously. This seems like a
+ sensible thing to do */
+ mov fp, #0
+
+ /* r0 contains the address of the shared library termination
+ function, which we will register with `atexit' to be called by
+ `exit'. I suspect that on some systems, and when statically
+ linked, this will not be set by anything to any function
+ pointer; hopefully it will be zero so we don't try to call
+ random pointers. */
+ cmp r0,#0
+ blne atexit(PLT)
+
+ /* Do essential libc initialization. In statically linked
+ programs under the GNU Hurd, this is what sets up the
+ arguments on the stack for the code below. For dyn-link
+ programs, this has been run already, in the .init code. */
+#ifndef PIC
+ bl __libc_init_first
+
+ /* Extract the arguments and environment as encoded on the stack
+ and set up the arguments for `main': argc, argv, envp. */
+ ldr r0,[sp]
+ add r1,sp,#4
+ add r2,r1,r0,lsl #2
+ add r2,r2,#4
+ /* save a copy of envp while we have it */
+ ldr r3,L_environ
+ str r2,[r3]
+
+ /* Call `_init', which is the entry point to our own `.init'
+ section; and register with `atexit' to have `exit' call
+ `_fini', which is the entry point to our own `.fini' section. */
+ bl _init
+ ldr r0,L_fini
+ bl atexit
+ b L_pfini
+
+L_fini: .word _fini
+L_environ: .word _environ
+L_pfini:
+#endif
+ /* rebuild the arg list for main() */
+ ldr r0,[sp]
+ add r1,sp,#4
+ add r2,r1,r0,lsl #2
+ add r2,r2,#4
+
+ /* Call the user's main function, and exit with its value. */
+ bl main
+ bl exit
+ /* should never get here....*/
+ bl abort
+
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/sysdeps/arm/fpu/__longjmp.S b/sysdeps/arm/fpu/__longjmp.S
new file mode 100644
index 0000000000..8afa177b20
--- /dev/null
+++ b/sysdeps/arm/fpu/__longjmp.S
@@ -0,0 +1,36 @@
+/* longjmp for ARM.
+ Copyright (C) 1997, 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+#define _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+/* __longjmp(jmpbuf, val) */
+
+ENTRY (__longjmp)
+ movs r2, r0
+ movs r0, r1 /* get the return value in place */
+ moveq r1, #1 /* can't let setjmp() return zero! */
+
+ add r2, r2, #48
+ lfmfd f4, 4, [r2]
+
+ LOADREGS(ia, r2, {v1-v6, sl, fp, sp, pc})
+END (__longjmp)
diff --git a/sysdeps/arm/fpu/setjmp.S b/sysdeps/arm/fpu/setjmp.S
new file mode 100644
index 0000000000..790e7566d4
--- /dev/null
+++ b/sysdeps/arm/fpu/setjmp.S
@@ -0,0 +1,35 @@
+/* setjmp for ARM.
+ Copyright (C) 1997, 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+#define _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+ /* Binary compatibility entry point. */
+ENTRY (__setjmp)
+ mov r1, #0
+ENTRY (__sigsetjmp)
+ /* Save registers */
+ sfmea f4, 4, [r0]!
+ stmia r0, {v1-v6, sl, fp, sp, lr}
+
+ /* Make a tail call to __sigjmp_save; it takes the same args. */
+ B PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
+END (__setjmp)
diff --git a/sysdeps/arm/init-first.c b/sysdeps/arm/init-first.c
new file mode 100644
index 0000000000..7e6bcf79ff
--- /dev/null
+++ b/sysdeps/arm/init-first.c
@@ -0,0 +1,71 @@
+/* Initialization code run first thing by the ELF startup code. For ARM.
+ Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <unistd.h>
+
+extern void __libc_init (int, char **, char **);
+extern void __getopt_clean_environment (char **);
+extern void __libc_global_ctors (void);
+
+int __libc_multiple_libcs = 1;
+
+pid_t __libc_pid;
+
+static void
+init (int *data)
+{
+ int argc = *data;
+ char **argv = (void *) (data + 1);
+ char **envp = &argv[argc + 1];
+
+ __environ = envp;
+ __libc_init (argc, argv, envp);
+
+ /* This is a hack to make the special getopt in GNU libc working. */
+ __getopt_clean_environment (envp);
+}
+
+#ifdef PIC
+/* This function is called to initialize the shared C library.
+ It is called just before the user _start code from i386/elf/start.S,
+ with the stack set up as that code gets it. */
+
+/* NOTE! The linker notices the magical name `_init' and sets the DT_INIT
+ pointer in the dynamic section based solely on that. It is convention
+ for this function to be in the `.init' section, but the symbol name is
+ the only thing that really matters!! */
+/*void _init (int argc, ...) __attribute__ ((unused, section (".init")));*/
+
+void
+_init (int argc, ...)
+{
+ init (&argc);
+
+ __libc_global_ctors ();
+}
+#endif
+
+
+void
+__libc_init_first (int argc __attribute__ ((unused)), ...)
+{
+#ifndef PIC
+ init (&argc);
+#endif
+}
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
new file mode 100644
index 0000000000..a986d687da
--- /dev/null
+++ b/sysdeps/arm/memset.S
@@ -0,0 +1,68 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Philip Blundell <philb@gnu.org>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+
+/* void *memset (dstpp, c, len) */
+
+ENTRY(memset)
+ mov a4, a1
+ cmp a3, $8 @ at least 8 bytes to do?
+ blt 2f
+ orr a2, a2, a2, lsl $8
+ orr a2, a2, a2, lsl $16
+1:
+ tst a4, $3 @ aligned yet?
+ strneb a2, [a4], $1
+ subne a3, a3, $1
+ bne 1b
+ mov ip, a2
+1:
+ cmp a3, $8 @ 8 bytes still to do?
+ blt 2f
+ stmia a4!, {a2, ip}
+ sub a3, a3, $8
+ cmp a3, $8 @ 8 bytes still to do?
+ blt 2f
+ stmia a4!, {a2, ip}
+ sub a3, a3, $8
+ cmp a3, $8 @ 8 bytes still to do?
+ blt 2f
+ stmia a4!, {a2, ip}
+ sub a3, a3, $8
+ cmp a3, $8 @ 8 bytes still to do?
+ stmgeia a4!, {a2, ip}
+ subge a3, a3, $8
+ bge 1b
+2:
+ movs a3, a3 @ anything left?
+ RETINSTR(moveq,pc,lr) @ nope
+ rsb a3, a3, $7
+ add pc, pc, a3, lsl $2
+ mov r0, r0
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ RETINSTR(mov,pc,lr)
+END(memset)
diff --git a/sysdeps/arm/setjmp.S b/sysdeps/arm/setjmp.S
index 08cd0d254e..237cc0addd 100644
--- a/sysdeps/arm/setjmp.S
+++ b/sysdeps/arm/setjmp.S
@@ -1,5 +1,5 @@
/* setjmp for ARM.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 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
@@ -27,11 +27,8 @@ ENTRY (__setjmp)
mov r1, #0
ENTRY (__sigsetjmp)
/* Save registers */
-#if __ARM_USES_FP
- sfmea f4, 4, [r0]!
-#endif
stmia r0, {v1-v6, sl, fp, sp, lr}
/* Make a tail call to __sigjmp_save; it takes the same args. */
- B __sigjmp_save
-END (__sigsetjmp)
+ B PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
+END (__setjmp)
diff --git a/sysdeps/arm/sysdep.h b/sysdeps/arm/sysdep.h
index 8d1e2972df..28dd402ced 100644
--- a/sysdeps/arm/sysdep.h
+++ b/sysdeps/arm/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for ARM.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 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
@@ -28,19 +28,23 @@
/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */
#define ALIGNARG(log2) 1<<log2
/* For ELF we need the `.type' directive to make shared libs work right. */
-#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
+#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,%##typearg;
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
/* In ELF C symbols are asm symbols. */
#undef NO_UNDERSCORES
#define NO_UNDERSCORES
+#define PLTJMP(_x) _x##(PLT)
+
#else
#define ALIGNARG(log2) log2
#define ASM_TYPE_DIRECTIVE(name,type) /* Nothing is specified. */
#define ASM_SIZE_DIRECTIVE(name) /* Nothing is specified. */
+#define PLTJMP(_x) _x
+
#endif
/* APCS-32 doesn't preserve the condition codes across function call. */
@@ -56,13 +60,10 @@
instr##s regs
#endif
-/* Don't do floating point */
-#define __ARM_USES_FP 1
-
/* Define an entry point visible from C. */
#define ENTRY(name) \
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
- ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
+ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function) \
.align ALIGNARG(4); \
C_LABEL(name) \
CALL_MCOUNT
diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h
index e29be98210..d0bbe30df0 100644
--- a/sysdeps/generic/bits/resource.h
+++ b/sysdeps/generic/bits/resource.h
@@ -1,5 +1,5 @@
/* Bit values & structures for resource limits. 4.4 BSD/generic GNU version.
- Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1996, 1997, 1998 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
@@ -65,7 +65,7 @@ enum __rlimit_resource
#define RLIMIT_NOFILE RLIMIT_NOFILE
RLIMIT_NLIMITS, /* Number of limit flavors. */
- RLIM_NLIMITS = RLIMIT_NLIMITS, /* Traditional name for same. */
+ RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same. */
};
/* Value to indicate that there is no limit. */
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
index d6fd3d3581..d32e54f162 100644
--- a/sysdeps/generic/libc-start.c
+++ b/sysdeps/generic/libc-start.c
@@ -16,29 +16,58 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <link.h>
#include <stdlib.h>
#include <unistd.h>
+extern void __libc_init_first (int argc, char **argv, char **envp);
+
+extern int _dl_starting_up;
+weak_extern (_dl_starting_up)
+extern int __libc_multiple_libcs;
+
int
__libc_start_main (int (*main) (int, char **, char **), int argc,
char **argv, void (*init) (void), void (*fini) (void),
void (*rtld_fini) (void))
{
+#ifndef PIC
+ /* 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. */
+ int *dummy_addr = &_dl_starting_up;
+
+ __libc_multiple_libcs = dummy_addr && !_dl_starting_up;
+#endif
+
/* Register the destructor of the dynamic linker if there is any. */
if (rtld_fini != NULL)
atexit (rtld_fini);
- /* Call the initializer of the libc. */
- __libc_init_first ();
-
/* Set the global _environ variable correctly. */
__environ = &argv[argc + 1];
+ /* Call the initializer of the libc. */
+#ifdef PIC
+ if (_dl_debug_impcalls)
+ _dl_debug_message (1, "\ninitialize libc\n\n", NULL);
+#endif
+ __libc_init_first (argc, argv, __environ);
+
/* Call the initializer of the program. */
+#ifdef PIC
+ if (_dl_debug_impcalls)
+ _dl_debug_message (1, "\ninitialize program: ", argv[0], "\n\n", NULL);
+#endif
(*init) ();
/* Register the destructor of the program. */
atexit (fini);
- exit ((*main) (argc, argv, envp));
+#ifdef PIC
+ if (_dl_debug_impcalls)
+ _dl_debug_message (1, "\ntransferring control: ", argv[0], "\n\n", NULL);
+#endif
+
+ exit ((*main) (argc, argv, __environ));
}
diff --git a/sysdeps/generic/setsockopt.c b/sysdeps/generic/setsockopt.c
index ba876438e5..3b6d741257 100644
--- a/sysdeps/generic/setsockopt.c
+++ b/sysdeps/generic/setsockopt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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
@@ -27,7 +27,7 @@ setsockopt (fd, level, optname, optval, optlen)
int fd;
int level;
int optname;
- void *optval;
+ const __ptr_t optval;
socklen_t optlen;
{
__set_errno (ENOSYS);
diff --git a/sysdeps/unix/arm/brk.S b/sysdeps/unix/arm/brk.S
index 0150bcde80..b3924a3d6d 100644
--- a/sysdeps/unix/arm/brk.S
+++ b/sysdeps/unix/arm/brk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95, 97, 98 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
@@ -33,11 +33,24 @@ C_LABEL(__curbrk)
.text
SYSCALL__ (brk, 1)
+#ifdef PIC
+ ldr r1, 1f
+ add r1, r1, pc
+2: ldr r2, _cb_addr
+ add r1, r1, r2
+#else
ldr r1, _cb_addr
+#endif
str r0, [r1]
mov r0, $0
RETINSTR(mov, pc, r14)
-_cb_addr: .long C_SYMBOL_NAME(__curbrk)
-
+#ifdef PIC
+1: .long _GLOBAL_OFFSET_TABLE_ - 2b - 4
+_cb_addr:
+ .long C_SYMBOL_NAME(__curbrk)(GOTOFF)
+#else
+_cb_addr:
+ .long C_SYMBOL_NAME(__curbrk)
+#endif
weak_alias (__brk, brk)
diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S
index d59500e47a..c1da5255b0 100644
--- a/sysdeps/unix/arm/sysdep.S
+++ b/sysdeps/unix/arm/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,98 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
@@ -23,8 +23,6 @@
.globl C_SYMBOL_NAME(errno)
.globl syscall_error
-_errno_loc: .long C_SYMBOL_NAME(errno)
-
#undef syscall_error
#ifdef NO_UNDERSCORES
__syscall_error:
@@ -38,12 +36,44 @@ syscall_error:
cmp r0, $EWOULDBLOCK_sys /* Is it the old EWOULDBLOCK? */
moveq r0, $EAGAIN /* Yes; translate it to EAGAIN. */
#endif
+
#ifndef PIC
ldr r1, _errno_loc
str r0, [r1]
+#ifdef _LIBC_REENTRANT
+ stmdb sp!, {r0, lr}
+ /* put another copy of r0 at a specific errno location */
+ bl __errno_location
+ ldmia sp!, {r1, lr}
+ str r1, [r0]
+#endif
+#else
+ stmdb sp!,{r10, lr}
+ @ we have to establish our PIC register
+ ldr r10, 1f
+ add r10, pc, r10
+0: ldr r1, 2f
+ ldr r1, [r10, r1]
+ @ store a copy in _errno_loc
+ str r0, [r1]
+#ifdef _LIBC_REENTRANT
+ @ and another copy in thread copy of _errno_loc
+ mov r10, r0
+ bl __errno_location(PLT)
+ str r10, [r0]
+#endif
+ ldmia sp!, {r10, lr}
+ b 4f
+1: .word _GLOBAL_OFFSET_TABLE_ - 0b - 4
+2: .word C_SYMBOL_NAME(errno)(GOT)
+4:
#endif
mvn r0, $0
RETINSTR(mov, pc, r14)
+#ifndef PIC
+_errno_loc: .long C_SYMBOL_NAME(errno)
+#endif
+
#undef __syscall_error
END (__syscall_error)
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index 4471224bcc..709f9abae5 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -22,6 +22,7 @@ net/if_slip.h
net/ppp-comp.h
net/ppp_defs.h
net/route.h
+netash/ash.h
netatalk/at.h
netax25/ax25.h
netinet/if_fddi.h
@@ -30,6 +31,7 @@ netinet/igmp.h
netinet/in_systm.h
netinet/ip_fw.h
netinet/ip_icmp.h
+netpacket/packet.h
netinet/tcp.h
netinet/udp.h
netipx/ipx.h
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 7b53e3a399..7a73ded547 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -74,7 +74,7 @@ sysdep_headers += netinet/in_systm.h netinet/udp.h \
netinet/if_fddi.h netinet/if_tr.h netinet/igmp.h \
netinet/ip_fw.h netinet/ip_icmp.h netipx/ipx.h \
sys/socketvar.h netax25/ax25.h netrom/netrom.h \
- netrose/rose.h
+ netrose/rose.h netpacket/packet.h netash/ash.h
endif
ifeq ($(subdir),posix)
diff --git a/sysdeps/unix/sysv/linux/arm/socket.S b/sysdeps/unix/sysv/linux/arm/socket.S
index 1940061dda..0ff6dd0164 100644
--- a/sysdeps/unix/sysv/linux/arm/socket.S
+++ b/sysdeps/unix/sysv/linux/arm/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998 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
@@ -41,9 +41,9 @@ ENTRY (__socket)
/* Do the system call trap. */
swi SYS_ify(socketcall)
- /* %eax is < 0 if there was an error. */
+ /* r0 is < 0 if there was an error. */
cmn r0, $124
- bge syscall_error
+ bge syscall_error(PLT)
/* Successful; return the syscall's value. */
RETINSTR(mov,pc,r14)
diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h
index af08277a63..3b7ffe08d9 100644
--- a/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arm/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997.
@@ -41,7 +41,7 @@
Since version 2.1 the return value of a system call might be
negative even if the call succeeded. E.g., the `lseek' system call
might return a large offset. Therefore we must not anymore test
- for < 0, but test for a real error by making sure the value in %eax
+ for < 0, but test for a real error by making sure the value in R0
is a real error number. Linus said he will make sure the no syscall
returns a value in -1 .. -4095 as a valid result so we can savely
test with -4095. */
@@ -51,7 +51,7 @@
ENTRY (name) \
DO_CALL (args, syscall_name); \
cmn r0, $4096; \
- bge syscall_error;
+ bgt syscall_error;
#undef PSEUDO_END
#define PSEUDO_END(name) \
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index c649217e7e..faa493e7e3 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,5 +1,5 @@
/* Bit values & structures for resource limits. Linux version.
- Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1996, 1997, 1998 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
@@ -99,7 +99,7 @@ enum __rlimit_resource
RLIMIT_NLIMITS = RLIM_NLIMITS,
#undef RLIM_NLIMITS
- RLIM_NLIMITS = RLIMIT_NLIMITS,
+ RLIM_NLIMITS = RLIMIT_NLIMITS
#define RLIMIT_NLIMITS RLIMIT_NLIMITS
#define RLIM_NLIMITS RLIM_NLIMITS
};
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 2b3b098926..91eec61d28 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -66,16 +66,16 @@ enum __socket_type
#define PF_AAL5 8 /* Reserved for Werner's ATM. */
#define PF_X25 9 /* Reserved for X.25 project. */
#define PF_INET6 10 /* IP version 6. */
-#define PF_ROSE 11 /* Amateur Radio X.25 PLP */
-#define PF_DECnet 12 /* Reserved for DECnet project */
-#define PF_NETBEUI 13 /* Reserved for 802.2LLC project*/
-#define PF_SECURITY 14 /* Security callback pseudo AF */
-#define PF_KEY 15 /* PF_KEY key management API */
+#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */
+#define PF_DECnet 12 /* Reserved for DECnet project. */
+#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */
+#define PF_SECURITY 14 /* Security callback pseudo AF. */
+#define PF_KEY 15 /* PF_KEY key management API. */
#define PF_NETLINK 16
-#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD */
-#define PF_PACKET 17 /* Packet family */
-#define PF_ASH 18 /* Ash */
-#define PF_MAX 32 /* For now.. */
+#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */
+#define PF_PACKET 17 /* Packet family. */
+#define PF_ASH 18 /* Ash. */
+#define PF_MAX 32 /* For now.. */
/* Address families. */
#define AF_UNSPEC PF_UNSPEC
diff --git a/sysdeps/unix/sysv/linux/libc-start.c b/sysdeps/unix/sysv/linux/libc-start.c
deleted file mode 100644
index d32e54f162..0000000000
--- a/sysdeps/unix/sysv/linux/libc-start.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 1998 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <link.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-extern void __libc_init_first (int argc, char **argv, char **envp);
-
-extern int _dl_starting_up;
-weak_extern (_dl_starting_up)
-extern int __libc_multiple_libcs;
-
-int
-__libc_start_main (int (*main) (int, char **, char **), int argc,
- char **argv, void (*init) (void), void (*fini) (void),
- void (*rtld_fini) (void))
-{
-#ifndef PIC
- /* 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. */
- int *dummy_addr = &_dl_starting_up;
-
- __libc_multiple_libcs = dummy_addr && !_dl_starting_up;
-#endif
-
- /* Register the destructor of the dynamic linker if there is any. */
- if (rtld_fini != NULL)
- atexit (rtld_fini);
-
- /* Set the global _environ variable correctly. */
- __environ = &argv[argc + 1];
-
- /* Call the initializer of the libc. */
-#ifdef PIC
- if (_dl_debug_impcalls)
- _dl_debug_message (1, "\ninitialize libc\n\n", NULL);
-#endif
- __libc_init_first (argc, argv, __environ);
-
- /* Call the initializer of the program. */
-#ifdef PIC
- if (_dl_debug_impcalls)
- _dl_debug_message (1, "\ninitialize program: ", argv[0], "\n\n", NULL);
-#endif
- (*init) ();
-
- /* Register the destructor of the program. */
- atexit (fini);
-
-#ifdef PIC
- if (_dl_debug_impcalls)
- _dl_debug_message (1, "\ntransferring control: ", argv[0], "\n\n", NULL);
-#endif
-
- exit ((*main) (argc, argv, __environ));
-}
diff --git a/sysdeps/unix/sysv/linux/netash/ash.h b/sysdeps/unix/sysv/linux/netash/ash.h
new file mode 100644
index 0000000000..e4feec44ab
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netash/ash.h
@@ -0,0 +1,34 @@
+/* Definitions for use with Linux AF_ASH sockets.
+ Copyright (C) 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef __NETASH_ASH_H
+#define __NETASH_ASH_H 1
+
+#include <features.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+
+struct sockaddr_ash
+ {
+ _SOCKADDR_COMMON (sash_); /* Common data: address family etc. */
+ int if_index; /* Interface to use. */
+ int channel; /* Realtime or control. */
+ };
+
+#endif /* netash/ash.h */
diff --git a/sysdeps/unix/sysv/linux/netpacket/packet.h b/sysdeps/unix/sysv/linux/netpacket/packet.h
new file mode 100644
index 0000000000..a382654326
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/netpacket/packet.h
@@ -0,0 +1,61 @@
+/* Definitions for use with Linux AF_PACKET sockets.
+ Copyright (C) 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef __NETPACKET_PACKET_H
+#define __NETPACKET_PACKET_H 1
+
+struct sockaddr_ll
+ {
+ unsigned short int sll_family;
+ unsigned short int sll_protocol;
+ int sll_ifindex;
+ unsigned short int sll_hatype;
+ unsigned char sll_pkttype;
+ unsigned char sll_halen;
+ unsigned char sll_addr[8];
+ };
+
+/* Packet types. */
+
+#define PACKET_HOST 0 /* To us. */
+#define PACKET_BROADCAST 1 /* To all. */
+#define PACKET_MULTICAST 2 /* To group. */
+#define PACKET_OTHERHOST 3 /* To someone else. */
+#define PACKET_OUTGOING 4 /* Originated by us . */
+#define PACKET_LOOPBACK 5
+#define PACKET_FASTROUTE 6
+
+/* Packet socket options. */
+
+#define PACKET_ADD_MEMBERSHIP 1
+#define PACKET_DROP_MEMBERSHIP 2
+
+struct packet_mreq
+ {
+ int mr_ifindex;
+ unsigned short int mr_type;
+ unsigned short int mr_alen;
+ unsigned char mr_address[8];
+ };
+
+#define PACKET_MR_MULTICAST 0
+#define PACKET_MR_PROMISC 1
+#define PACKET_MR_ALLMULTI 2
+
+#endif /* netpacket/packet.h */