diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/dl-sysdep.c | 23 | ||||
-rw-r--r-- | sysdeps/gnu/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/gnu/errlist.awk | 15 | ||||
-rw-r--r-- | sysdeps/mach/hurd/Dist | 1 | ||||
-rw-r--r-- | sysdeps/mach/hurd/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/mach/hurd/errlist.c | 26 | ||||
-rw-r--r-- | sysdeps/unix/Makefile | 6 |
7 files changed, 55 insertions, 20 deletions
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index 58c093e268..90beb8f269 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -38,7 +38,7 @@ extern char **_dl_argv; extern char **_environ; extern size_t _dl_pagesize; extern const char *_dl_platform; -extern unsigned long _dl_hwcap; +extern unsigned long int _dl_hwcap; extern size_t _dl_platformlen; extern void _end; extern void ENTRY_POINT (void); @@ -48,7 +48,6 @@ int __libc_enable_secure; int __libc_multiple_libcs; /* Defining this here avoids the inclusion of init-first. */ static ElfW(auxv_t) *_dl_auxv; -static unsigned long int hwcap; unsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT; @@ -241,10 +240,11 @@ _dl_show_auxv (void) _dl_sysdep_message ("AT_PLATFORM: ", av->a_un.a_ptr, "\n", NULL); break; case AT_HWCAP: - hwcap = av->a_un.a_val; - if (_dl_procinfo (hwcap) < 0) + _dl_hwcap = av->a_un.a_val; + if (_dl_procinfo (_dl_hwcap) < 0) _dl_sysdep_message ("AT_HWCAP: ", - _itoa_word (hwcap, buf + sizeof buf - 1, 16, 0), + _itoa_word (_dl_hwcap, buf + sizeof buf - 1, + 16, 0), "\n", NULL); break; } @@ -284,7 +284,7 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, size_t *max_capstrlen) { /* Determine how many important bits are set. */ - unsigned long int mask = _dl_hwcap_mask; + unsigned long int masked = _dl_hwcap & _dl_hwcap_mask; size_t cnt = platform != NULL; size_t n, m; size_t total; @@ -293,8 +293,9 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, struct r_strlenpair *rp; char *cp; - for (n = 0; (~((1UL << n) - 1) & mask) != 0; ++n) - if ((mask & (1UL << n)) != 0) + /* Count the number of bits set in the masked value. */ + for (n = 0; (~((1UL << n) - 1) & masked) != 0; ++n) + if ((masked & (1UL << n)) != 0) ++cnt; if (cnt == 0) @@ -318,12 +319,12 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, /* Create temporary data structure to generate result table. */ temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp)); m = 0; - for (n = 0; mask != 0; ++n) - if ((mask & (1UL << n)) != 0) + for (n = 0; masked != 0; ++n) + if ((masked & (1UL << n)) != 0) { temp[m].str = _dl_hwcap_string (n); temp[m].len = strlen (temp[m].str); - mask ^= 1UL << n; + masked ^= 1UL << n; ++m; } if (platform != NULL) diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile index 762f79b866..77f0b230fd 100644 --- a/sysdeps/gnu/Makefile +++ b/sysdeps/gnu/Makefile @@ -21,7 +21,7 @@ $(..)sysdeps/gnu/errlist.c: $(..)sysdeps/gnu/errlist.awk \ $(..)manual/errno.texi - awk -f $^ > $@-tmp + $(AWK) -f $^ > $@-tmp # Make it unwritable so noone will edit it by mistake. -chmod a-w $@-tmp mv -f $@-tmp $@ diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk index a14c29cf98..b40606a696 100644 --- a/sysdeps/gnu/errlist.awk +++ b/sysdeps/gnu/errlist.awk @@ -34,9 +34,14 @@ BEGIN { print ""; print "#ifndef SYS_ERRLIST"; print "# define SYS_ERRLIST _sys_errlist"; + print "# define SYS_ERRLIST_ALIAS sys_errlist"; print "#endif"; print "#ifndef SYS_NERR"; print "# define SYS_NERR _sys_nerr"; + print "# define SYS_NERR_ALIAS sys_nerr"; + print "#endif"; + print "#ifndef ERR_REMAP"; + print "# define ERR_REMAP(n) n"; print "#endif"; print ""; print "const char *const SYS_ERRLIST[] ="; @@ -70,7 +75,7 @@ errnoh == 3 && $1 == "@comment" && $2 == "errno" \ errnoh == 4 && $1 == "@end" && $2 == "deftypevr" \ { printf "/*%s */\n", desc; - printf " [%s] = N_(\"%s\"),\n", e, etext; + printf " [ERR_REMAP (%s)] = N_(\"%s\"),\n", e, etext; print "#endif"; errnoh = 0; next; @@ -85,8 +90,10 @@ END { print " };"; print ""; print "const int SYS_NERR = sizeof SYS_ERRLIST / sizeof SYS_ERRLIST [0];"; - print "#if !defined HAVE_ELF || !defined PIC || !defined DO_VERSIONING"; - print "weak_alias (_sys_errlist, sys_errlist)"; - print "weak_alias (_sys_nerr, sys_nerr)"; + print "#ifdef SYS_ERRLIST_ALIAS"; + print "weak_alias (_sys_errlist, SYS_ERRLIST_ALIAS)"; + print "#endif"; + print "#ifdef SYS_NERR_ALIAS"; + print "weak_alias (_sys_nerr, SYS_NERR_ALIAS)"; print "#endif"; } diff --git a/sysdeps/mach/hurd/Dist b/sysdeps/mach/hurd/Dist index 084c314649..03f422d794 100644 --- a/sysdeps/mach/hurd/Dist +++ b/sysdeps/mach/hurd/Dist @@ -1,3 +1,4 @@ +errlist.c errnos.awk err_hurd.sub libc-ldscript diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index 454ac8f98c..b3161ca195 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -87,7 +87,7 @@ $(common-objpfx)errnos.d: $(mach-errnos-deps) $(hurd)/errnos.h: $(common-objpfx)stamp-errnos ; $(common-objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \ $(mach-errnos-deps) - gawk -f $^ > $(hurd)/errnos.h-tmp + $(AWK) -f $^ > $(hurd)/errnos.h-tmp # Make it unwritable so noone will edit it by mistake. -chmod a-w $(hurd)/errnos.h-tmp ./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h diff --git a/sysdeps/mach/hurd/errlist.c b/sysdeps/mach/hurd/errlist.c new file mode 100644 index 0000000000..5cbc543ed1 --- /dev/null +++ b/sysdeps/mach/hurd/errlist.c @@ -0,0 +1,26 @@ +/* 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. */ + +/* SYS_ERRLIST cannot have Unix semantics on the Hurd, so it is easier + just to rename it. We also need to remap error codes to array + indices by taking their subcode. */ +#define SYS_ERRLIST _hurd_errlist +#define SYS_NERR _hurd_nerr +#define ERR_REMAP(n) (n & 0x3fff) + +#include <sysdeps/gnu/errlist.c> diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile index 4863556332..234caee5d4 100644 --- a/sysdeps/unix/Makefile +++ b/sysdeps/unix/Makefile @@ -54,7 +54,7 @@ $(common-objpfx)sys/param.h: $(sysincludedir)/sys/param.h (echo '#ifndef _SYS_PARAM_H'; \ echo '#define _SYS_PARAM_H 1'; \ echo '#include <endian.h>'; \ - awk < $< \ + $(AWK) < $< \ '/^#define[ ]*NULL/ { print "#ifndef NULL"; \ print $$0; \ print "#endif"; \ @@ -142,7 +142,7 @@ $(common-objpfx)make-errnos: $(common-objpfx)make-errnos.c $(common-objpfx)make-errnos.c: $(sysdep_dir)/unix/errnos-tmpl.c \ $(sysdep_dir)/unix/errnos.awk $(common-objpfx)errnos - awk -f $(word 2,$^) errnos="`tr '\012' ' ' < $(word 3,$^)`" $< > $@T + $(AWK) -f $(word 2,$^) errnos="`tr '\012' ' ' < $(word 3,$^)`" $< > $@T mv $@T $@ $(common-objpfx)errnos: $(wildcard $(sysincludedir)/errno.h \ @@ -176,7 +176,7 @@ $(common-objpfx)make-ioctls: $(common-objpfx)make-ioctls.c $(common-objpfx)make-ioctls.c: $(sysdep_dir)/unix/ioctls-tmpl.c \ $(sysdep_dir)/unix/ioctls.awk \ $(common-objpfx)ioctls - awk -f $(word 2,$^) requests="`cat $(word 3,$^)`" $< > $@T + $(AWK) -f $(word 2,$^) requests="`cat $(word 3,$^)`" $< > $@T mv $@T $@ |