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]

Re: A static binary patch (A new patch)


> 
> hjl@lucon.org (H.J. Lu) writes:
> 
> > That is what my "ld.so --verify" patch is for.
> 
> No you haven't.  You want everything to be slower and possibly more
> unreliable just because of your problem.  Create completely
> independent rules then you don't have to change the others.
> 

Here is a new patch.


----
Wed Aug 25 09:59:15 1999  H.J. Lu  <hjl@gnu.org>

	* Makeconfig (built-program-cmd): When shared library is
	enabled, if $(tests-static) is not empty, try "ld.so --verify"
	on the binary before running it and don't use the dynamic
	linker if it is not dynamically linked.

	* Rules (binaries-static): Add $(tests-static).

Index: Makeconfig
===================================================================
RCS file: /work/cvs/gnu/glibc/Makeconfig,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makeconfig
--- Makeconfig	1999/08/08 17:01:06	1.1.1.1
+++ Makeconfig	1999/08/25 17:45:15
@@ -478,12 +478,22 @@ sysdep-library-path = \
 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
 				       $(filter -Wl$(comma)-rpath-link=%,\
 						$(sysdep-LDFLAGS)))))
-define built-program-cmd
+define run-built-program-cmd
 $(elf-objpfx)$(rtld-installed-name) \
 	--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
 	$(built-program-file)
 endef
-endif
+ifeq ("",$(tests-static))
+built-program-cmd = $(run-built-program-cmd)
+else
+define built-program-cmd 
+	$(shell $(elf-objpfx)$(rtld-installed-name) --verify \
+			$(built-program-file) > /dev/null 2>&1; \
+		if [ $$? = 0 ]; then echo $(run-built-program-cmd); \
+		else echo $(built-program-file); fi)
+endef
+endif	# tests-static
+endif	# build-shared
 
 ifndef LD
 LD := ld -X
Index: Rules
===================================================================
RCS file: /work/cvs/gnu/glibc/Rules,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 Rules
--- Rules	1999/08/23 16:16:40	1.1.1.2
+++ Rules	1999/08/25 17:12:22
@@ -93,7 +93,7 @@ endif
 
 ifeq ($(build-programs),yes)
 binaries-all = $(others) $(sysdep-others) $(tests) $(test-srcs)
-binaries-static = $(others-static)
+binaries-static = $(others-static) $(tests-static)
 else
 binaries-all = $(tests) $(test-srcs)
 binaries-static =

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