aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>2000-07-26 18:18:43 +0000
committerGreg McGary <greg@mcgary.org>2000-07-26 18:18:43 +0000
commitac556388135e5bf0578cb24bc958870ff3a0f00c (patch)
tree4c3c8c7213d349cd412270e4346b94f85d7521e0
parente04b831ab49dfb24f1c1a70b3816bff5515cbab9 (diff)
downloadglibc-ac556388135e5bf0578cb24bc958870ff3a0f00c.tar
glibc-ac556388135e5bf0578cb24bc958870ff3a0f00c.tar.gz
glibc-ac556388135e5bf0578cb24bc958870ff3a0f00c.tar.bz2
glibc-ac556388135e5bf0578cb24bc958870ff3a0f00c.zip
* 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.
-rw-r--r--Makeconfig19
-rw-r--r--Makerules7
-rw-r--r--Rules13
-rw-r--r--csu/Makefile9
4 files changed, 40 insertions, 8 deletions
diff --git a/Makeconfig b/Makeconfig
index da3c88f0e0..b36bf7e6fe 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -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-objpfx)libc_pic.a
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,10 @@ run-program-prefix = $(elf-objpfx)$(rtld-installed-name) \
else
run-program-prefix =
endif
-built-program-cmd = $(run-program-prefix) $(built-program-file)
+# Never use $(run-program-prefix) for the statically-linked %-bp test programs
+built-program-cmd = $(patsubst %,$(run-program-prefix),\
+ $(filter-out %-bp,$(built-program-file))) \
+ $(built-program-file)
ifndef LD
LD := ld -X
diff --git a/Makerules b/Makerules
index ff79700b22..51a809515f 100644
--- a/Makerules
+++ b/Makerules
@@ -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))
diff --git a/Rules b/Rules
index f3d8bdd746..9881848646 100644
--- a/Rules
+++ b/Rules
@@ -88,7 +88,10 @@ 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)
@@ -115,6 +118,14 @@ $(addprefix $(objpfx),$(binaries-static)): %: %.o \
$(+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))" ""
# These are the implicit rules for making test outputs
# from the test programs and whatever input files are present.
diff --git a/csu/Makefile b/csu/Makefile
index 2b697a7079..b57d3a7235 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -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
@@ -47,6 +43,11 @@ 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
generated += abi-tag.h