This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix libSegFault.so


Hi!

libSegFault.so is broken ATM, since it has unresolved SHN_UNDEF reference to
_itoa_lower_digits_internal. These arrays are only defined
in ld.so (16 chars) and libc (36 chars), not in
libSegFault.so nor any other library.
Thus IMHO _itoa.h should only use the internal definitions if in libc or
ld.so. While at it, I think using IS_IN_RTLD instead of _RTLD_LOCAL would
be good for consistency with your recent Makefile changes for other libs.

2002-04-08  Jakub Jelinek  <jakub@redhat.com>

	* elf/Makefile (CFLAGS-.os): Define NOT_IN_LIBC and IS_IN_RTLD
	instead of _RTLD_LOCAL.
	* elf/dl-dst.h: Use IS_IN_RTLD instead of _RTLD_LOCAL.
	* include/unistd.h: Likewise.
	* sysdeps/generic/ldsodefs.h: Likewise.

	* stdio-common/_itoa.h (_itoa_word): Only use internal digit arrays
	if in libc or ld.so.

--- libc/elf/dl-dst.h.jj	Sat Mar 23 11:50:26 2002
+++ libc/elf/dl-dst.h	Mon Apr  8 15:44:17 2002
@@ -64,7 +64,7 @@ extern size_t _dl_dst_count_internal (co
 extern const char *_dl_get_origin (void);
 extern const char *_dl_get_origin_internal (void);
 
-#ifdef _RTLD_LOCAL
+#ifdef IS_IN_RTLD
 # define _dl_get_origin INTUSE(_dl_get_origin)
 #endif
 
--- libc/elf/Makefile.jj	Sat Mar 23 11:50:25 2002
+++ libc/elf/Makefile	Mon Apr  8 15:47:21 2002
@@ -250,7 +250,7 @@ CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'
 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
 CFLAGS-cache.c = $(SYSCONF-FLAGS)
 
-CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-D_RTLD_LOCAL)
+CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_LIBC -DIS_IN_RTLD)
 
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
 generated += $(addsuffix .so,$(strip $(modules-names)))
--- libc/include/unistd.h.jj	Sat Mar 23 11:50:27 2002
+++ libc/include/unistd.h	Mon Apr  8 15:44:49 2002
@@ -98,7 +98,7 @@ extern void *__sbrk (intptr_t __delta);
    and some functions contained in the C library ignore various
    environment variables that normally affect them.  */
 extern int __libc_enable_secure;
-#ifdef _RTLD_LOCAL
+#ifdef IS_IN_RTLD
 /* XXX The #ifdef should go.  */
 extern int __libc_enable_secure_internal attribute_hidden;
 #endif
--- libc/stdio-common/_itoa.h.jj	Sat Mar 23 11:50:55 2002
+++ libc/stdio-common/_itoa.h	Mon Apr  8 15:45:45 2002
@@ -39,8 +39,14 @@ _itoa_word (unsigned long value, char *b
 	    unsigned int base, int upper_case)
 {
   const char *digits = (upper_case
+#if !defined NOT_IN_LIBC || defined IS_IN_RTLD
 			? INTUSE(_itoa_upper_digits)
-			: INTUSE(_itoa_lower_digits));
+			: INTUSE(_itoa_lower_digits)
+#else
+			? _itoa_upper_digits
+			: _itoa_lower_digits
+#endif
+		       );
 
   switch (base)
     {
--- libc/sysdeps/generic/ldsodefs.h.jj	Sat Mar 23 11:51:05 2002
+++ libc/sysdeps/generic/ldsodefs.h	Mon Apr  8 15:46:54 2002
@@ -199,7 +199,7 @@ typedef void (*receiver_fct) (int, const
 # define GL(name) _##name
 #else
 # define EXTERN
-# ifdef _RTLD_LOCAL
+# ifdef IS_IN_RTLD
 #  define GL(name) _rtld_local._##name
 # else
 #  define GL(name) _rtld_global._##name
@@ -375,7 +375,7 @@ struct rtld_global
 #ifdef SHARED
 };
 extern struct rtld_global _rtld_global;
-# ifdef _RTLD_LOCAL
+# ifdef IS_IN_RTLD
 #  ifdef HAVE_VISIBILITY_ATTRIBUTE
 #   ifdef HAVE_SDATA_SECTION
 #    define __rtld_local_attribute__ \
@@ -394,7 +394,7 @@ extern struct rtld_global _rtld_local __
 /* Parameters passed to the dynamic linker.  */
 extern int _dl_argc attribute_hidden;
 extern char **_dl_argv;
-#ifdef _RTLD_LOCAL
+#ifdef IS_IN_RTLD
 extern char **_dl_argv_internal attribute_hidden;
 # define rtld_progname (INTUSE(_dl_argv)[0])
 #else
@@ -403,7 +403,7 @@ extern char **_dl_argv_internal attribut
 
 /* The array with message we print as a last resort.  */
 extern const char _dl_out_of_memory[];
-#ifdef _RTLD_LOCAL
+#ifdef IS_IN_RTLD
 /* XXX #ifdef should go away.  */
 extern const char _dl_out_of_memory_internal[] attribute_hidden;
 #endif


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]