From e7c5513dcd240d468812b11fda8eaba404ea082c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 21 Sep 1998 14:34:13 +0000 Subject: Update. 1998-09-21 10:00 Ulrich Drepper * string/bits/string2.h: Add mempcpy optimization. * sysdeps/generic/mempcpy.c: Undefined __mempcpy. * intl/localealias.c: Define mempcpy only if not already defined. * sysdeps/i386/i486/bits/string.h: Define ffsl only if not already defined. 1998-09-20 10:48 -0400 Zack Weinberg * csu/abi-note.S: Emit the note directly instead of defining a preprocessor macro that's only used once. Don't include sysdep.h. * abi-tags: Generalize Solaris entry. 1998-09-18 Andreas Schwab * sysdeps/unix/bsd/getpt.c (__libc_ptyname1, __libc_ptyname2): Change to array to avoid runtime relocation. * sysdeps/unix/sysv/linux/ptsname.c: Update declarations. 1998-09-21 12:22 Andreas Schwab * malloc/Makefile ($(objpfx)libmcheck.a): Fix use of $(LN_S). * math/Makefile ($(objpfx)libieee.a): Likewise. 1998-09-21 Ulrich Drepper * sysdeps/generic/getpt.c: Fix order of argument to weak_alias. Patch by John Tobey . --- ChangeLog | 31 ++++++++ abi-tags | 8 +-- csu/abi-note.S | 72 ++++++++++--------- intl/localealias.c | 4 +- malloc/Makefile | 3 +- math/Makefile | 3 +- string/bits/string2.h | 147 +++++++++++++++++++++++++++++++++++++- sysdeps/generic/getpt.c | 2 +- sysdeps/generic/mempcpy.c | 3 +- sysdeps/i386/i486/bits/string.h | 4 +- sysdeps/unix/bsd/getpt.c | 25 ++++--- sysdeps/unix/sysv/linux/ptsname.c | 12 ++-- 12 files changed, 249 insertions(+), 65 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19f5b14edd..141d7c72bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +1998-09-21 10:00 Ulrich Drepper + + * string/bits/string2.h: Add mempcpy optimization. + * sysdeps/generic/mempcpy.c: Undefined __mempcpy. + * intl/localealias.c: Define mempcpy only if not already defined. + + * sysdeps/i386/i486/bits/string.h: Define ffsl only if not already + defined. + +1998-09-20 10:48 -0400 Zack Weinberg + + * csu/abi-note.S: Emit the note directly instead of defining + a preprocessor macro that's only used once. Don't include sysdep.h. + * abi-tags: Generalize Solaris entry. + +1998-09-18 Andreas Schwab + + * sysdeps/unix/bsd/getpt.c (__libc_ptyname1, __libc_ptyname2): + Change to array to avoid runtime relocation. + * sysdeps/unix/sysv/linux/ptsname.c: Update declarations. + +1998-09-21 12:22 Andreas Schwab + + * malloc/Makefile ($(objpfx)libmcheck.a): Fix use of $(LN_S). + * math/Makefile ($(objpfx)libieee.a): Likewise. + +1998-09-21 Ulrich Drepper + + * sysdeps/generic/getpt.c: Fix order of argument to weak_alias. + Patch by John Tobey . + 1998-09-20 Ulrich Drepper * login/Makefile (distribute): Remove pty-internal.h, add diff --git a/abi-tags b/abi-tags index b43f8afb6f..6170a2a13e 100644 --- a/abi-tags +++ b/abi-tags @@ -6,9 +6,9 @@ # earlier entries taking precedence over later entries. So loose patterns # at the end of the list can give defaults. -# The ABI tag values we use are 32-bit quantities stored in machine byte order. -# Conventionally the high-order byte indicates the OS and the low three -# bytes form a version number associated with a particular ABI version. +# The ABI tags we use are four 32-bit integers. The first of these +# is the operating-system number, the next three are the revision number +# of the first compatible kernel. # After the configuration regexp, four integers in C syntax appear # surrounded by any whitespace or punctuation, one for each byte, MSB first. @@ -20,7 +20,7 @@ .*-.*-gnu-gnu.* 1 0.0.0 -sparc-sun-solaris2.* 2 2.0.0 # just an arbitrary value +.*-sun-solaris2.* 2 2.0.0 # just an arbitrary value # There is no catch-all default here because every supported OS that uses # ELF must have its own unique ABI tag. diff --git a/csu/abi-note.S b/csu/abi-note.S index d2051e5b3b..a5014ab5cc 100644 --- a/csu/abi-note.S +++ b/csu/abi-note.S @@ -26,44 +26,46 @@ write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +/* Define an ELF note identifying the operating-system ABI that the + executable was created for. The ELF note information identifies a + particular OS or coordinated development effort within which the + ELF header's e_machine value plus (for dynamically linked programs) + the PT_INTERP dynamic linker name and DT_NEEDED shared library + names fully identify the runtime environment required by an + executable. -/* The basic layout of note sections is specified by the ELF format. */ + The general format of ELF notes is as follows. + Offsets and lengths are bytes or (parenthetical references) to the + values in other fields. -#define ELF_NOTE_BEGIN(sectname, sectflags, type, name) \ - .section sectname, sectflags; \ - .align 4; /* Notes are 4-byte aligned. */ \ - .long 1f - 0f; /* 32-bit word: length of name field */ \ - .long 3f - 2f; /* 32-bit word: length of desc field */ \ - .long (type); /* 32-bit word: vendor-defined type field */ \ -0: .asciz name; /* null-terminated string, any length: name */\ -1: .align 4; /* Name data padded to 4-byte alignment. */ \ -2: /* Here follows the "note descriptor" data, whose format \ - is not specified by ELF. The vendor name and type field \ - indicate what sort of data is found here. */ +offset length contents +0 4 length of name +4 4 length of data +8 4 note type +12 (0) vendor name + - null-terminated ASCII string, padded to 4-byte alignment +12+(0) (4) note data, -#define ELF_NOTE_END \ -3: .align 4 /* Pad to 4-byte align the next note. */ - - -/* The linker (GNU ld 2.8 and later) recognize an allocated section whose - name begins with `.note' and creates a PT_NOTE program header entry - pointing at it. - - Such a program header is the canonical way (at least in the free OS - community) to identify the OS environment ABI that the executable was - created for. The ELF note information identifies a particular OS or - coordinated development effort within which the ELF header's e_machine - value plus (for dynamically linked programs) the PT_INTERP dynamic - linker name and DT_NEEDED shared library names fully identify the - runtime environment required by an executable. - - The GNU project and cooperating development efforts (including the Linux - community) use a vendor name string of "GNU", and a note type field with - value 1 for a note descriptor that indicates ABI requirements. */ + The GNU project and cooperating development efforts (including the + Linux community) use note type 1 and a vendor name string of "GNU" + for a note descriptor that indicates ABI requirements. The note data + is four 32-bit words. The first of these is an operating system + number (0=Hurd, 1=Linux, 2=Solaris, ...) and the remaining three + identify the earliest release of that OS that supports this ABI. + See abi-tags (top level) for details. */ #include /* OS-specific ABI tag value */ + +/* The linker (GNU ld 2.8 and later) recognizes an allocated section whose + name begins with `.note' and creates a PT_NOTE program header entry + pointing at it. */ -ELF_NOTE_BEGIN(".note.ABI-tag", "a", 1, "GNU") - .long ABI_TAG -ELF_NOTE_END + .section ".note.ABI-tag", "a" + .align 4 + .long 1f - 0f /* name length */ + .long 3f - 2f /* data length */ + .long 1 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: .align 4 +2: .long ABI_TAG /* note data: the ABI tag */ +3: .align 4 /* pad out section */ diff --git a/intl/localealias.c b/intl/localealias.c index 01fbe04f2e..78a704f185 100644 --- a/intl/localealias.c +++ b/intl/localealias.c @@ -83,7 +83,9 @@ void free (); file and the name space must not be polluted. */ # define strcasecmp __strcasecmp -# define mempcpy __mempcpy +# ifndef mempcpy +# define mempcpy __mempcpy +# endif # define HAVE_MEMPCPY 1 /* We need locking here since we can be called from different places. */ diff --git a/malloc/Makefile b/malloc/Makefile index 521037a51a..53251ba58a 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -64,7 +64,8 @@ include ../Rules $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o -rm -f $@ - $(LN_S) $< $@ + $(patsubst %/,cd % &&,$(objpfx)) \ + $(LN_S) $( diff --git a/sysdeps/generic/mempcpy.c b/sysdeps/generic/mempcpy.c index 43873405c5..6117e1503a 100644 --- a/sysdeps/generic/mempcpy.c +++ b/sysdeps/generic/mempcpy.c @@ -1,7 +1,7 @@ /* Copy memory to memory until the specified number of bytes has been copied, return pointer to following byte. Overlap is NOT handled correctly. - Copyright (C) 1991, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). @@ -25,6 +25,7 @@ #include #undef mempcpy +#undef __mempcpy void * __mempcpy (dstpp, srcpp, len) diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h index 134f117377..9c4bb525cc 100644 --- a/sysdeps/i386/i486/bits/string.h +++ b/sysdeps/i386/i486/bits/string.h @@ -1582,7 +1582,9 @@ __strstr_g (__const char *__haystack, __const char *__needle) : "rm" (word), "1" (-1)); \ __cnt + 1; })) -# define ffsl(word) ffs(word) +# ifndef ffsl +# define ffsl(word) ffs(word) +# endif # endif /* i686 */ #endif /* BSD || X/Open */ diff --git a/sysdeps/unix/bsd/getpt.c b/sysdeps/unix/bsd/getpt.c index ec339c8335..55d87fa2bc 100644 --- a/sysdeps/unix/bsd/getpt.c +++ b/sysdeps/unix/bsd/getpt.c @@ -31,13 +31,13 @@ #ifndef PTYNAME1 #define PTYNAME1 "pqrsPQRS" #endif -const char *__libc_ptyname1 = PTYNAME1; +const char __libc_ptyname1[] = PTYNAME1; /* Letters indicating the position within a series. */ #ifndef PTYNAME2 #define PTYNAME2 "0123456789abcdefghijklmnopqrstuv"; #endif -const char *__libc_ptyname2 = PTYNAME2; +const char __libc_ptyname2[] = PTYNAME2; /* Open a master pseudo terminal and return its file descriptor. */ @@ -47,32 +47,31 @@ __getpt (void) char buf[sizeof (_PATH_PTY) + 2]; const char *p, *q; char *s; - - s = __stpcpy (buf, _PATH_PTY); - s[0] = '?'; - s[1] = '?'; - s[2] = 0; - for (p = __libc_ptyname1; *p; p++) + s = __mempcpy (buf, _PATH_PTY, sizeof (_PATH_PTY) - 1); + /* s[0] and s[1] will be filled in the loop. */ + s[2] = '\0'; + + for (p = __libc_ptyname1; *p != '\0'; ++p) { s[0] = *p; - for (q = __libc_ptyname2; *q; q++) + for (q = __libc_ptyname2; *q != '\0'; ++q) { int fd; - + s[1] = *q; - + fd = __open (buf, O_RDWR); if (fd != -1) { if (__isatty (fd)) return fd; - + __close (fd); continue; } - + if (errno != EIO) return -1; } diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c index 048ac96551..d852fb3658 100644 --- a/sysdeps/unix/sysv/linux/ptsname.c +++ b/sysdeps/unix/sysv/linux/ptsname.c @@ -33,8 +33,8 @@ #define _PATH_DEVPTS "/dev/pts/" /* The are declared in getpt.c. */ -extern const char *__libc_ptyname1; -extern const char *__libc_ptyname2; +extern const char __libc_ptyname1[]; +extern const char __libc_ptyname2[]; /* Static buffer for `ptsname'. */ static char buffer[sizeof (_PATH_DEVPTS) + 20]; @@ -59,7 +59,7 @@ __ptsname_r (int fd, char *buf, size_t buflen) int save_errno = errno; struct stat st; int ptyno; - + if (buf == NULL) { __set_errno (EINVAL); @@ -97,7 +97,7 @@ __ptsname_r (int fd, char *buf, size_t buflen) #endif { char *p; - + if (buflen < strlen (_PATH_TTY) + 3) { __set_errno (ERANGE); @@ -116,13 +116,13 @@ __ptsname_r (int fd, char *buf, size_t buflen) __set_errno (ENOTTY); return ENOTTY; } - + p = __stpcpy (buf, _PATH_TTY); p[0] = __libc_ptyname1[ptyno / 16]; p[1] = __libc_ptyname2[ptyno % 16]; p[2] = '\0'; } - + if (__stat (buf, &st) < 0) return errno; -- cgit v1.2.3