This is the mail archive of the libc-hacker@sourceware.cygnus.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]

PATCH: BPs in csu/


I changed types from (void*) to (void (*) (void)) because they are
function pointers, and because they should always be unbounded.
Function pointers are unbounded even with `-fbounded-pointers', since
low & high bounds are not useful for functions.  The net effect
is that by declaring these as having pointer-to-function type,
we can avoid qualifying the decl of `ptr' in RUN_HOOK as __unbounded.

No binary changes for non-BP in csu/ on i[3456]86.

OK?

2000-06-26  Greg McGary  <greg@mcgary.org>

	* Makeconfig: Add missing comment.
	* csu/Makefile (extra-objs, omit-deps, install-lib): Add
	BP-flavored startup object.
	($(objpfx)b$(start-installed-name)): New rule.
	* include/libc-symbols.h (symbol_set_declare): Change type
	of `__start_##set' and `__stop_##set' to pointer-to-function.
	(symbol_set_declare): Change type of `set' to array of
	pointer-to-function.
	* include/set-hooks.h (RUN_HOOK): Change type of `ptr' to
	pointer-to-function.

Index: Makeconfig
===================================================================
RCS file: /cvs/glibc/libc/Makeconfig,v
retrieving revision 1.238
diff -u -p -r1.238 Makeconfig
--- Makeconfig	2000/06/13 07:32:01	1.238
+++ Makeconfig	2000/06/27 00:51:09
@@ -634,6 +634,8 @@ bppfx = BP-
 ifeq (yes,$(build-bounded))
 # Under --enable-bounded, we build the library with `-fbounded-pointers -g'
 # to runtime bounds checking.  The bounded-pointer objects are named foo.ob.
+# We disable sibling-call optimizations so that stack traces will be complete
+# and thus aid debugging, since after all, BPs are a debugging tool.
 object-suffixes += .ob
 CPPFLAGS-.ob = -fbounded-pointers $(pic-default)
 CFLAGS-.ob = -g -O2 -fno-optimize-sibling-calls
Index: csu/Makefile
===================================================================
RCS file: /cvs/glibc/libc/csu/Makefile,v
retrieving revision 1.41
diff -u -p -r1.41 Makefile
--- Makefile	2000/05/25 04:57:17	1.41
+++ Makefile	2000/06/27 00:51:09
@@ -30,11 +30,11 @@ subdir := csu
 routines = init-first libc-start $(libc-init) sysdep version check_fds
 csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
 extra-objs = start.o gmon-start.o \
-	     $(start-installed-name) g$(start-installed-name) \
+	     $(start-installed-name) g$(start-installed-name) b$(start-installed-name) \
 	     $(csu-dummies)
 omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \
-		             $(csu-dummies))
-install-lib = $(start-installed-name) g$(start-installed-name) \
+			      b$(start-installed-name) $(csu-dummies))
+install-lib = $(start-installed-name) g$(start-installed-name) b$(start-installed-name) \
 	      $(csu-dummies)
 distribute = initfini.c gmon-start.c start.c defs.awk munch.awk \
 	     abi-note.S init.c munch-tmpl.c
@@ -129,6 +129,9 @@ ifeq (yes,$(elf))
 # the kernel ABI the binaries linked with this library will require.
 $(objpfx)$(start-installed-name): $(objpfx)start.o $(objpfx)abi-note.o \
 				  $(objpfx)init.o
+	$(link-relocatable)
+$(objpfx)b$(start-installed-name): $(objpfx)start.ob $(objpfx)abi-note.ob \
+				  $(objpfx)init.ob
 	$(link-relocatable)
 else
 # The startfile is installed under different names, so we just call our
Index: include/libc-symbols.h
===================================================================
RCS file: /cvs/glibc/libc/include/libc-symbols.h,v
retrieving revision 1.13
diff -u -p -r1.13 libc-symbols.h
--- libc-symbols.h	2000/06/14 16:15:27	1.13
+++ libc-symbols.h	2000/06/27 00:51:09
@@ -239,8 +243,8 @@
 
 /* Declare SET for use in this module, if defined in another module.  */
 #  define symbol_set_declare(set) \
-  extern void *const __start_##set __attribute__ ((__weak__));		\
-  extern void *const __stop_##set __attribute__ ((__weak__));		\
+  extern void (*const __start_##set) (void) __attribute__ ((__weak__));	\
+  extern void (*const __stop_##set) (void) __attribute__ ((__weak__));	\
   weak_extern (__start_##set) weak_extern (__stop_##set)
 
 /* Return a pointer (void *const *) to the first element of SET.  */
@@ -258,7 +262,7 @@
   asm(".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol)
 #  define bss_set_element(set, symbol)	?error Must use initialized data.
 #  define symbol_set_define(set)	void *const (set)[1];
-#  define symbol_set_declare(set)	extern void *const (set)[1];
+#  define symbol_set_declare(set)	extern void (*const (set)[1]) (void);
 
 #  define symbol_set_first_element(set)	&(set)[1]
 #  define symbol_set_end_p(set, ptr)	(*(ptr) == 0)
Index: include/set-hooks.h
===================================================================
RCS file: /cvs/glibc/libc/include/set-hooks.h,v
retrieving revision 1.2
diff -u -p -r1.2 set-hooks.h
--- set-hooks.h	2000/02/28 20:47:01	1.2
+++ set-hooks.h	2000/06/27 00:51:09
@@ -42,7 +42,7 @@
 
 # define RUN_HOOK(NAME, ARGS) \
 do {									   \
-  void *const *ptr;							   \
+  void (*const *ptr) (void);						   \
   for (ptr = symbol_set_first_element (NAME);				   \
        ! symbol_set_end_p (NAME, ptr); ++ptr)				   \
     (*(__##NAME##_hook_function_t *) *ptr) ARGS;			   \

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