]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* locale/setlocale.c (_nl_C_name): Variable removed. cvs/libc-960505 cvs/libc-960506
authorRoland McGrath <roland@gnu.org>
Sat, 4 May 1996 13:57:05 +0000 (13:57 +0000)
committerRoland McGrath <roland@gnu.org>
Sat, 4 May 1996 13:57:05 +0000 (13:57 +0000)
* locale/C_name.c: New file.
(_nl_C_name): Put it here instead.
* locale/Makefile (aux): Add C_name.

* sysdeps/mach/hurd/dl-sysdep.c (open): Don't pass io port in
auth_user_authenticate rpc.
(open): Avoid using strtol in digit conversion for "fd/N" magic.
(_dl_sysdep_start): Likewise for memobj name in magic switches.

* elf/Makefile (reloc-link): New variable.
(dl-allobjs.so): New target, link together $(rtld-routines).
(librtld.so): Depend on that instead of the rtld components.
(generated): Add dl-allobjs.so.

ChangeLog
elf/Makefile
locale/C_name.c [new file with mode: 0644]
locale/Makefile
locale/setlocale.c
sysdeps/mach/hurd/dl-sysdep.c

index 7bb59dbbd6277f59e7d4771aae19d83cbfdaf703..c4ebc447e22d27bfbbdc7dae6dab742927cab975 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 Sat May  4 05:44:25 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
 
+       * locale/setlocale.c (_nl_C_name): Variable removed.
+       * locale/C_name.c: New file.
+       (_nl_C_name): Put it here instead.
+       * locale/Makefile (aux): Add C_name.
+
+       * sysdeps/mach/hurd/dl-sysdep.c (open): Don't pass io port in
+       auth_user_authenticate rpc.
+       (open): Avoid using strtol in digit conversion for "fd/N" magic.
+       (_dl_sysdep_start): Likewise for memobj name in magic switches.
+
+       * elf/Makefile (reloc-link): New variable.
+       (dl-allobjs.so): New target, link together $(rtld-routines).
+       (librtld.so): Depend on that instead of the rtld components.
+       (generated): Add dl-allobjs.so.
+
        * hurd/hurd-raise.c (_hurd_raise_signal): Pass sigcode in msg_sig_post
        rpc.
 
index dfb307b6823f844e9aebc14e6a0723c77858228f..c973a0f4617ae51d36b3924ba7cb0774abb22c97 100644 (file)
@@ -39,7 +39,7 @@ include ../Makeconfig
 
 ifeq (yes,$(build-shared))
 extra-objs     = $(rtld-routines:=.so) soinit.so sofini.so
-generated      = librtld.so
+generated      = librtld.so dl-allobjs.so
 install-others = $(slibdir)/$(rtld-installed-name)
 install-bin    = ldd
 
@@ -52,14 +52,19 @@ endif
 include ../Rules
 
 
+# Command to link into a larger single relocatable object.
+reloc-link = $(LINK.o) -nostdlib -nostartfiles -r -o $@
+
+$(objpfx)dl-allobjs.so: $(rtld-routines:%=$(objpfx)%.so)
+       $(reloc-link) $^
+
 # Link together the dynamic linker into a single relocatable object.
 # We use this to produce both the ABI-compliant and Linux-compatible
 # dynamic linker shared objects below.
-$(objpfx)librtld.so: $(rtld-routines:%=$(objpfx)%.so) \
+$(objpfx)librtld.so: $(objpfx)dl-allobjs.so \
                     $(patsubst %,$(common-objpfx)lib%_pic.a,\
                                elf c $(LDLIBS-c.so:-l%=%))
-       $(LINK.o) -nostdlib -nostartfiles -r -o $@ \
-                 '-Wl,-(' $^ -lgcc '-Wl,-)'
+       $(reloc-link) '-Wl,-(' $^ -lgcc '-Wl,-)'
 
 $(objpfx)ld.so: $(objpfx)librtld.so
        $(rtld-link) -Wl,-soname=$(rtld-installed-name)
diff --git a/locale/C_name.c b/locale/C_name.c
new file mode 100644 (file)
index 0000000..5e7cb85
--- /dev/null
@@ -0,0 +1,7 @@
+/* Define a constant for the name of the standard C locale, so the string
+   constant is not repeated in dozens of object files.  */
+
+#include "localeinfo.h"
+
+/* Name of our standard locale.  */
+const char _nl_C_name[] = "C";
index 6b208b71a6480cf7bee1b289c82e087c830e2ef7..d7941d689fdf36b4d356274ed800b5c010fd1ed5 100644 (file)
@@ -30,7 +30,7 @@ distribute    = localeinfo.h categories.def \
                  locales.h locfile.h stringtrans.h
 routines       = setlocale findlocale loadlocale localeconv nl_langinfo
 categories     = ctype messages monetary numeric time collate
-aux            = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc
+aux            = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name
 others         = localedef locale
 install-bin    = localedef locale
 extra-objs     = $(localedef-modules:=.o) $(locale-modules:=.o) \
index c0d6fcdc4e50811155009320aedde92ee3ca50c8..6eb6d98d70f49ccfc53143fd57bd3cfe628e1738 100644 (file)
@@ -102,9 +102,6 @@ void (*const _nl_category_postload[]) (void) =
   };
 
 
-/* Name of our standard locale.  */
-const char _nl_C_name[] = "C";
-
 /* Name of current locale for each individual category.
    Each is malloc'd unless it is nl_C_name.  */
 static const char *_nl_current_names[] =
@@ -261,7 +258,7 @@ setlocale (int category, const char *locale)
   if (__argz_append (&locale_path, &locale_path_len,
                     LOCALE_PATH, sizeof (LOCALE_PATH)) != 0)
     return NULL;
-  
+
   if (category == LC_ALL)
     {
       /* The user wants to set all categories.  The desired locales
@@ -274,7 +271,7 @@ setlocale (int category, const char *locale)
       /* Set all name pointers to the argument name.  */
       for (category = 0; category < LC_ALL; ++category)
        newnames[category] = (char *) locale;
-      
+
       if (strchr (locale, ';') != NULL)
        {
          /* This is a composite name.  Make a copy and split it up.  */
@@ -329,7 +326,7 @@ setlocale (int category, const char *locale)
                int save_errno;
              abort_composite:
                save_errno = errno;
-               
+
                while (++category < LC_ALL)
                  if (_nl_current[category] != NULL)
                    _nl_free_locale (newdata[category]);
index 21f94f812accd50fc11979d3f3556cdb0d0f27be..c580bb31ed72d4dd4a96e34f12e79cc14b39b156 100644 (file)
@@ -33,6 +33,7 @@ Cambridge, MA 02139, USA.  */
 #include <hurd/auth.h>
 #include <hurd/term.h>
 #include <stdarg.h>
+#include <ctype.h>
 
 #include "dl-machine.h"
 
@@ -139,7 +140,9 @@ unfmh();                    /* XXX */
            if (! memobjname)
              _dl_sysdep_fatal ("Bogus library spec: ", p, "\n", NULL);
            *memobjname++ = '\0';
-           memobj = (mach_port_t) atoi (memobjname);
+           memobj = 0;
+           while (*memobjname != '\0')
+             memobj = (memobj * 10) + (*memobjname++ - '0');
 
            /* Add a user reference on the memory object port, so we will
               still have one after _dl_map_object_from_fd calls our
@@ -307,7 +310,6 @@ open (const char *file_name, int mode, ...)
            if (! err)
              err = __auth_user_authenticate
                (_dl_hurd_data->portarray[INIT_PORT_AUTH],
-                fileport,
                 ref, MACH_MSG_TYPE_MAKE_SEND,
                 &newpt);
            __mach_port_destroy (__mach_task_self (), ref);
@@ -361,17 +363,19 @@ open (const char *file_name, int mode, ...)
              break;
 
            case 'f':
-             if (retryname[1] == 'd' && retryname[2] == '/')
+             if (retryname[1] == 'd' && retryname[2] == '/' &&
+                 isdigit (retryname[3]))
                {
-                 int fd;
-                 char *end;
-                 err = 0;
-                 fd = (int) strtol (retryname, &end, 10);
-                 if (end == NULL || err || /* Malformed number.  */
-                     /* Check for excess text after the number.  A slash
-                        is valid; it ends the component.  Anything else
-                        does not name a numeric file descriptor.  */
-                     (*end != '/' && *end != '\0'))
+                 /* We can't use strtol for the decoding here
+                    because it brings in hairy locale bloat.  */
+                 char *p;
+                 int fd = 0;
+                 for (p = &retryname[3]; isdigit (*p); ++p)
+                   fd = (fd * 10) + (*p - '0');
+                 /* Check for excess text after the number.  A slash is
+                    valid; it ends the component.  Anything else does not
+                    name a numeric file descriptor.  */
+                 if (*p != '/' && *p != '\0')
                    return __hurd_fail (ENOENT);
                  if (fd < 0 || fd >= _dl_hurd_data->dtablesize ||
                      _dl_hurd_data->dtable[fd] == MACH_PORT_NULL)
@@ -380,7 +384,7 @@ open (const char *file_name, int mode, ...)
                       of ENOENT.  */
                    return __hurd_fail (EBADF);
                  fileport = _dl_hurd_data->dtable[fd];
-                 if (*end == '\0')
+                 if (*p == '\0')
                    {
                      /* This descriptor is the file port we want.  */
                      dealloc_dir = 0;
@@ -391,7 +395,7 @@ open (const char *file_name, int mode, ...)
                      /* Do a normal retry on the remaining components.  */
                      startdir = fileport;
                      dealloc_dir = 1;
-                     file_name = end + 1; /* Skip the slash.  */
+                     file_name = p + 1; /* Skip the slash.  */
                      break;
                    }
                }
@@ -448,7 +452,6 @@ open (const char *file_name, int mode, ...)
                            if (! err)
                              err = __auth_user_authenticate
                                (_dl_hurd_data->portarray[INIT_PORT_AUTH],
-                                unauth,
                                 ref, MACH_MSG_TYPE_MAKE_SEND,
                                 result);
                            __mach_port_deallocate (__mach_task_self (),