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]

PATCH: makefile support for BP tests


No build regressions.

OK?

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

	* Makeconfig (+link-bounded, link-libc-bounded,
	link-extra-libs-bounded): New variables.
	(built-program-cmd): Omit $(run-program-prefix) for static BP tests.
	* Makerules (do-tests-clean, common-mostlyclean): Remove BP test files.
	* Rules (tests-bp.out): New variable.
	(tests): Conditionally add BP tests.
	(binaries-bounded): Add variable and associated rule.
	* csu/Makefile [build-bounded] (extra-objs, install-lib):
	Move conditional stuff after place where condition is defined.

Index: Makeconfig
===================================================================
RCS file: /cvs/glibc/libc/Makeconfig,v
retrieving revision 1.240
diff -u -p -r1.240 Makeconfig
--- Makeconfig	2000/07/12 19:47:42	1.240
+++ Makeconfig	2000/07/26 08:16:34
@@ -400,6 +400,18 @@ ifndef +link-static
 			   $(common-objpfx)libc% $(+postinit),$^) \
 	      $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
 endif
+# Command for statically linking bounded-pointer programs with the C library.
+ifndef +link-bounded
++link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
+	      $(sysdep-LDFLAGS) $(LDFLAGS)  \
+	      $(addprefix $(csu-objpfx),b$(static-start-installed-name)) \
+	      $(+preinit) $(+prector) \
+	      $(filter-out $(addprefix $(csu-objpfx),start.o \
+						     $(start-installed-name))\
+			   $(+preinit) $(link-extra-libs-bounded) \
+			   $(common-objpfx)libc% $(+postinit),$^) \
+	      $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
+endif
 ifndef config-LDFLAGS
 ifeq (yes,$(build-shared))
 config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
@@ -458,6 +470,8 @@ link-libc-static = $(gnulib) $(common-ob
 link-extra-libs-static = $(link-extra-libs)
 endif
 endif
+link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
+link-extra-libs-bounded = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib)_b.a)
 
 ifndef gnulib
 gnulib := -lgcc
@@ -486,7 +500,8 @@ run-program-prefix = $(elf-objpfx)$(rtld
 else
 run-program-prefix =
 endif
-built-program-cmd = $(run-program-prefix) $(built-program-file)
+built-program-cmd = $(if $(filter-out %-bp,$(built-program-file)),$(run-program-prefix)) \
+		    $(built-program-file)
 
 ifndef LD
 LD := ld -X
Index: Makerules
===================================================================
RCS file: /cvs/glibc/libc/Makerules,v
retrieving revision 1.341
diff -u -p -r1.341 Makerules
--- Makerules	2000/07/17 22:34:11	1.341
+++ Makerules	2000/07/26 08:16:35
@@ -948,7 +948,8 @@ clean: common-clean
 mostlyclean: common-mostlyclean
 
 do-tests-clean:
-	-rm -f $(patsubst %,$(objpfx)%.out,$(tests) $(test-srcs))
+	-rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) $(test-srcs)) \
+				     $(addsuffix -bp.out,$(tests) $(test-srcs)))
 
 # Remove the object files.
 common-mostlyclean:
@@ -957,7 +958,9 @@ common-mostlyclean:
 				     $(addsuffix .o,$(tests) $(test-srcs) \
 						    $(others) \
 						    $(sysdep-others)) \
-				     $(addsuffix .out,$(tests) $(test-srcs)))
+				     $(addsuffix -bp,$(tests) $(test-srcs)) \
+				     $(addsuffix .out,$(tests) $(test-srcs)) \
+				     $(addsuffix -bp.out,$(tests) $(test-srcs)))
 	-rm -f $(addprefix $(objpfx),$(extra-objs) $(install-lib) \
 				     $(install-lib.so) \
 				     $(install-lib.so:%.so=%_pic.a))
Index: Rules
===================================================================
RCS file: /cvs/glibc/libc/Rules,v
retrieving revision 1.95
diff -u -p -r1.95 Rules
--- Rules	2000/07/04 08:25:04	1.95
+++ Rules	2000/07/26 08:16:35
@@ -88,8 +88,11 @@ endif
 ifeq ($(cross-compiling),yes)
 tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
 else
-tests: $(tests:%=$(objpfx)%.out)
+ifeq ($(build-bounded),yes)
+tests-bp.out = $(tests:%=$(objpfx)%-bp.out)
 endif
+tests: $(tests:%=$(objpfx)%.out) $(tests-bp.out)
+endif
 
 ifeq ($(build-programs),yes)
 binaries-all = $(others) $(sysdep-others) $(tests) $(test-srcs)
@@ -113,6 +116,14 @@ $(addprefix $(objpfx),$(binaries-static)
   $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
 	$(+link-static)
+endif
+
+ifeq ($(build-bounded),yes)
+binaries-bounded = $(addsuffix -bp,$(tests) $(test-srcs))
+$(addprefix $(objpfx),$(binaries-bounded)): %-bp: %.ob \
+  $(sort $(filter $(common-objpfx)lib%,$(link-libc-bounded))) \
+  $(addprefix $(csu-objpfx),start.ob) $(+preinit) $(+postinit)
+	$(+link-bounded)
 endif
 
 ifneq "$(strip $(tests) $(test-srcs))" ""
Index: csu/Makefile
===================================================================
RCS file: /cvs/glibc/libc/csu/Makefile,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile
--- Makefile	2000/07/04 01:30:09	1.43
+++ Makefile	2000/07/26 08:16:35
@@ -34,10 +34,6 @@ extra-objs = start.o gmon-start.o \
 omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \
 			      b$(start-installed-name) $(csu-dummies))
 install-lib = $(start-installed-name) g$(start-installed-name) $(csu-dummies)
-ifeq (yes,$(build-bounded))
-extra-objs += b$(start-installed-name)
-install-lib += b$(start-installed-name)
-endif
 distribute = initfini.c gmon-start.c start.c defs.awk munch.awk \
 	     abi-note.S init.c munch-tmpl.c
 generated = version-info.h
@@ -46,6 +42,11 @@ before-compile = $(objpfx)version-info.h
 all: # Make this the default target; it will be defined in Rules.
 
 include ../Makeconfig
+
+ifeq (yes,$(build-bounded))
+extra-objs += b$(start-installed-name)
+install-lib += b$(start-installed-name)
+endif
 
 ifeq (yes,$(elf))
 before-compile += $(objpfx)abi-tag.h

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