* sysdeps/unix/sysv/linux/i386/sysdep.h (SYSCALL_ERROR_HANDLER):

New macro.
	(PSEUDO): Use it instead of SYSCALL_PIC_SETUP and jmp syscall_error.

	* sysdeps/unix/sysv/linux/i386/sysdep.S (__syscall_error): Define
	only #ifndef PIC.

	* Makeconfig (built-program-cmd): New variable.
	* sunrpc/Makefile (rpcgen-cmd): Use $(built-program-cmd).
	* time/Makefile (zic-cmd): Likewise.

	* hurd/Makefile (user-interfaces): Add hurd/exec_startup.
This commit is contained in:
Roland McGrath 1995-10-25 02:19:39 +00:00
parent e97ec51d01
commit 03a7582576
10 changed files with 99 additions and 32 deletions

View file

@ -1,5 +1,18 @@
Tue Oct 24 15:22:58 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> Tue Oct 24 15:22:58 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/i386/sysdep.h (SYSCALL_ERROR_HANDLER):
New macro.
(PSEUDO): Use it instead of SYSCALL_PIC_SETUP and jmp syscall_error.
* sysdeps/unix/sysv/linux/i386/sysdep.S (__syscall_error): Define
only #ifndef PIC.
* Makeconfig (built-program-cmd): New variable.
* sunrpc/Makefile (rpcgen-cmd): Use $(built-program-cmd).
* time/Makefile (zic-cmd): Likewise.
* hurd/Makefile (user-interfaces): Add hurd/exec_startup.
* sunrpc/Makefile (librpcsvc-no-lib-dep): New variable. * sunrpc/Makefile (librpcsvc-no-lib-dep): New variable.
* extra-lib.mk: If $(lib)-no-lib-dep is defined and MAKELEVEL>0, * extra-lib.mk: If $(lib)-no-lib-dep is defined and MAKELEVEL>0,
make `others' rather than `lib-noranlib' depend on the libraries. make `others' rather than `lib-noranlib' depend on the libraries.

View file

@ -301,8 +301,10 @@ ifeq ($(elf),yes)
endif endif
ifdef objpfx ifdef objpfx
csu-objpfx = $(objpfx) csu-objpfx = $(objpfx)
elf-objpfx = $(objpfx)
else else
csu-objpfx = $(..)csu/ csu-objpfx = $(..)csu/
elf-objpfx = $(..)elf/
endif endif
ifeq (yes,$(build-shared)) ifeq (yes,$(build-shared))
@ -311,6 +313,21 @@ rtld-installed-name = ld.so
endif endif
endif endif
# How to run a program we just linked with our library.
# The program binary is assumed to be $(word 2,$^).
built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
ifneq (yes,$(build-shared))
built-program-cmd = $(built-program-file)
else
, = ,
define built-program-cmd
LD_LIBRARY_PATH=$(common-objdir)$(patsubst -Wl$,-rpath-link=%,:%,\
$(filter -Wl$,-rpath-link=%,\
$(sysdep-LDFLAGS))) \
$(elf-objpfx)ld.so $(built-program-file)
endef
endif
ifndef LD ifndef LD
LD := ld -X LD := ld -X
endif endif

View file

@ -35,7 +35,7 @@ interface-library := libhurduser
user-interfaces := $(addprefix hurd/,\ user-interfaces := $(addprefix hurd/,\
auth process startup \ auth process startup \
msg msg_reply msg_request \ msg msg_reply msg_request \
exec crash interrupt \ exec exec_startup crash interrupt \
fs fsys io term socket ifsock) fs fsys io term socket ifsock)
server-interfaces := hurd/msg server-interfaces := hurd/msg

View file

@ -241,9 +241,11 @@ init_syntax_once ()
#if HAVE_ALLOCA_H #if HAVE_ALLOCA_H
#include <alloca.h> #include <alloca.h>
#else /* not __GNUC__ or HAVE_ALLOCA_H */ #else /* not __GNUC__ or HAVE_ALLOCA_H */
#if 0 /* It is a bad idea to declare alloca. We always cast the result. */
#ifndef _AIX /* Already did AIX, up at the top. */ #ifndef _AIX /* Already did AIX, up at the top. */
char *alloca (); char *alloca ();
#endif /* not _AIX */ #endif /* not _AIX */
#endif
#endif /* not HAVE_ALLOCA_H */ #endif /* not HAVE_ALLOCA_H */
#endif /* not __GNUC__ */ #endif /* not __GNUC__ */
@ -1379,11 +1381,13 @@ static reg_errcode_t compile_range ();
if necessary. Also cast from a signed character in the constant if necessary. Also cast from a signed character in the constant
string passed to us by the user to an unsigned char that we can use string passed to us by the user to an unsigned char that we can use
as an array index (in, e.g., `translate'). */ as an array index (in, e.g., `translate'). */
#ifndef PATFETCH
#define PATFETCH(c) \ #define PATFETCH(c) \
do {if (p == pend) return REG_EEND; \ do {if (p == pend) return REG_EEND; \
c = (unsigned char) *p++; \ c = (unsigned char) *p++; \
if (translate) c = translate[c]; \ if (translate) c = (unsigned char) translate[c]; \
} while (0) } while (0)
#endif
/* Fetch the next character in the uncompiled pattern, with no /* Fetch the next character in the uncompiled pattern, with no
translation. */ translation. */
@ -1400,7 +1404,10 @@ static reg_errcode_t compile_range ();
cast the subscript to translate because some data is declared as cast the subscript to translate because some data is declared as
`char *', to avoid warnings when a string constant is passed. But `char *', to avoid warnings when a string constant is passed. But
when we use a character as a subscript we must make it unsigned. */ when we use a character as a subscript we must make it unsigned. */
#define TRANSLATE(d) (translate ? translate[(unsigned char) (d)] : (d)) #ifndef TRANSLATE
#define TRANSLATE(d) \
(translate ? (char) translate[(unsigned char) (d)] : (d))
#endif
/* Macros for outputting the compiled pattern into `buffer'. */ /* Macros for outputting the compiled pattern into `buffer'. */
@ -1666,7 +1673,7 @@ regex_compile (pattern, size, syntax, bufp)
const char *pend = pattern + size; const char *pend = pattern + size;
/* How to translate the characters in the pattern. */ /* How to translate the characters in the pattern. */
char *translate = bufp->translate; RE_TRANSLATE_TYPE translate = bufp->translate;
/* Address of the count-byte of the most recently inserted `exactn' /* Address of the count-byte of the most recently inserted `exactn'
command. This makes it possible to tell if a new exact-match command. This makes it possible to tell if a new exact-match
@ -2832,7 +2839,7 @@ group_in_compile_stack (compile_stack, regnum)
static reg_errcode_t static reg_errcode_t
compile_range (p_ptr, pend, translate, syntax, b) compile_range (p_ptr, pend, translate, syntax, b)
const char **p_ptr, *pend; const char **p_ptr, *pend;
char *translate; RE_TRANSLATE_TYPE translate;
reg_syntax_t syntax; reg_syntax_t syntax;
unsigned char *b; unsigned char *b;
{ {
@ -3264,7 +3271,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
{ {
int val; int val;
register char *fastmap = bufp->fastmap; register char *fastmap = bufp->fastmap;
register char *translate = bufp->translate; register RE_TRANSLATE_TYPE translate = bufp->translate;
int total_size = size1 + size2; int total_size = size1 + size2;
int endpos = startpos + range; int endpos = startpos + range;
@ -3552,7 +3559,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
unsigned char *just_past_start_mem = 0; unsigned char *just_past_start_mem = 0;
/* We use this to map every character in the string. */ /* We use this to map every character in the string. */
char *translate = bufp->translate; RE_TRANSLATE_TYPE translate = bufp->translate;
/* Failure point stack. Each place that can handle a failure further /* Failure point stack. Each place that can handle a failure further
down the line pushes a failure point on this stack. It consists of down the line pushes a failure point on this stack. It consists of
@ -3951,7 +3958,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
do do
{ {
PREFETCH (); PREFETCH ();
if (translate[(unsigned char) *d++] != (char) *p++) if ((unsigned char) translate[(unsigned char) *d++]
!= (unsigned char) *p++)
goto fail; goto fail;
} }
while (--mcnt); while (--mcnt);
@ -5073,7 +5081,7 @@ static int
bcmp_translate (s1, s2, len, translate) bcmp_translate (s1, s2, len, translate)
unsigned char *s1, *s2; unsigned char *s1, *s2;
register int len; register int len;
char *translate; RE_TRANSLATE_TYPE translate;
{ {
register unsigned char *p1 = s1, *p2 = s2; register unsigned char *p1 = s1, *p2 = s2;
while (len) while (len)
@ -5245,7 +5253,9 @@ regcomp (preg, pattern, cflags)
{ {
unsigned i; unsigned i;
preg->translate = (char *) malloc (CHAR_SET_SIZE); preg->translate
= (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE
* sizeof (*(RE_TRANSLATE_TYPE)0));
if (preg->translate == NULL) if (preg->translate == NULL)
return (int) REG_ESPACE; return (int) REG_ESPACE;

View file

@ -283,6 +283,10 @@ typedef enum
compiled, the `re_nsub' field is available. All other fields are compiled, the `re_nsub' field is available. All other fields are
private to the regex routines. */ private to the regex routines. */
#ifndef RE_TRANSLATE_TYPE
#define RE_TRANSLATE_TYPE char *
#endif
struct re_pattern_buffer struct re_pattern_buffer
{ {
/* [[[begin pattern_buffer]]] */ /* [[[begin pattern_buffer]]] */
@ -309,7 +313,7 @@ struct re_pattern_buffer
comparing them, or zero for no translation. The translation comparing them, or zero for no translation. The translation
is applied to a pattern when it is compiled and to a string is applied to a pattern when it is compiled and to a string
when it is matched. */ when it is matched. */
char *translate; RE_TRANSLATE_TYPE translate;
/* Number of subexpressions found by the compiler. */ /* Number of subexpressions found by the compiler. */
size_t re_nsub; size_t re_nsub;

View file

@ -87,7 +87,7 @@ include ../Rules
$(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a
$(+link) $(+link)
rpcgen-cmd = $(dir $(word 2,$^))$(notdir $(word 2,$^)) rpcgen-cmd = $(built-program-cmd)
# The proper file name is longer than 14 chars, so we install it under # The proper file name is longer than 14 chars, so we install it under
# a shorter name. But if the filesystem can handle it, we want to # a shorter name. But if the filesystem can handle it, we want to

View file

@ -65,6 +65,7 @@ for unix_function in \
getitimer setitimer \ getitimer setitimer \
getdomainname/getdomain=bsd/bsd4.4 \ getdomainname/getdomain=bsd/bsd4.4 \
setdomainname/setdomain=bsd/bsd4.4 \ setdomainname/setdomain=bsd/bsd4.4 \
fchdir=bsd/bsd4.4 \
profil=bsd readv=bsd writev=bsd \ profil=bsd readv=bsd writev=bsd \
getpriority setpriority \ getpriority setpriority \
getrlimit setrlimit getrlimit setrlimit
@ -76,8 +77,8 @@ do
unix_srcname= unix_srcname=
unix_srcdir=common unix_srcdir=common
eval "unix_syscall=`echo $unix_function | \ eval "unix_syscall=`echo $unix_function | \
sed -e 's@=\(.*\)$@ unix_srcdir=\1@' \ sed -e 's@=\(.*\)$@ unix_srcdir=\1@' \
-e 's@/\(.*\)$@ unix_srcname=\1@'`" -e 's@/\(^=/*\)$@ unix_srcname=\1@'`"
test -z "$unix_srcname" && unix_srcname=$unix_syscall test -z "$unix_srcname" && unix_srcname=$unix_syscall
unix_implementor=none unix_implementor=none

View file

@ -16,17 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
/* The syscall stubs jump here when they detect an error.
The code for Linux is almost identical to the canonical Unix/i386
code, except that the error number in %eax is negated. */
.globl __syscall_error
__syscall_error:
negl %eax
#define __syscall_error __syscall_error_1
#include <sysdeps/unix/i386/sysdep.S>
/* Because the Linux version is in fact i386/ELF and the start.? file /* Because the Linux version is in fact i386/ELF and the start.? file
for this system (sysdeps/i386/elf/start.S) is also used by The Hurd for this system (sysdeps/i386/elf/start.S) is also used by The Hurd
and therefore this files must not contain the definition of the and therefore this files must not contain the definition of the
@ -38,3 +27,21 @@ __syscall_error:
.globl errno .globl errno
errno: errno:
.long 0 .long 0
/* The following code is not used at all in the shared library.
The PIC system call stubs set errno themselves. */
#ifndef PIC
/* The syscall stubs jump here when they detect an error.
The code for Linux is almost identical to the canonical Unix/i386
code, except that the error number in %eax is negated. */
.globl __syscall_error
__syscall_error:
negl %eax
#define __syscall_error __syscall_error_1
#include <sysdeps/unix/i386/sysdep.S>
#endif

View file

@ -42,16 +42,31 @@ Cambridge, MA 02139, USA. */
#undef PSEUDO #undef PSEUDO
#define PSEUDO(name, syscall_name, args) \ #define PSEUDO(name, syscall_name, args) \
.text; \ .text; \
lose: SYSCALL_PIC_SETUP \ SYSCALL_ERROR_HANDLER \
jmp JUMPTARGET (syscall_error) \
.globl syscall_error; \
ENTRY (name) \ ENTRY (name) \
movl $SYS_ify (syscall_name), %eax; \ movl $SYS_ify (syscall_name), %eax; \
DO_CALL (args); \ DO_CALL (args); \
testl %eax, %eax; \ testl %eax, %eax; \
jl lose jl syscall_error;
/* We define our own ENTRY macro because the alignment should be 16 for ELF. */ #ifndef PIC
#define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
#else
/* Store (- %eax) into errno through the GOT. */
#define SYSCALL_ERROR_HANDLER \
syscall_error: \
call 0f; \
0:popl %ecx; \
negl %eax; \
addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ecx; \
movl errno@GOT(%ecx), %ecx; \
movl %eax, (%ecx); \
movl $-1, %eax; \
ret
#endif
/* We define our own ENTRY macro because the alignment should be 16 for
ELF. */
#undef ENTRY #undef ENTRY
#define ENTRY(name) \ #define ENTRY(name) \
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name); \ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name); \
@ -81,7 +96,7 @@ Cambridge, MA 02139, USA. */
arguments 4 and 5.) arguments 4 and 5.)
The following code tries hard to be optimal. A general assuption The following code tries hard to be optimal. A general assuption
(which is true accoriding to the data books I have) is that (which is true according to the data books I have) is that
2 * xchg is more expensive than pushl + movl + popl 2 * xchg is more expensive than pushl + movl + popl

View file

@ -98,7 +98,7 @@ echo-zonenames: zonenames
# Although $(zonedir) gets compiled into zic, it is useful to always # Although $(zonedir) gets compiled into zic, it is useful to always
# specify it with -d on the command line so that it can be overridden on # specify it with -d on the command line so that it can be overridden on
# the command line of `make install' (e.g., "make install prefix=/foo"). # the command line of `make install' (e.g., "make install prefix=/foo").
zic-cmd = $(dir $(word 2,$^))$(notdir $(word 2,$^)) -d $(zonedir) zic-cmd = $(built-program-cmd) -d $(zonedir)
define tzcompile define tzcompile
$(zic-cmd) -L $(word 3,$^) -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $< $(zic-cmd) -L $(word 3,$^) -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
endef endef