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


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

Re: [PATCH] Re: Changed shared library loading strategy on PPC, why?


On Saturday 04 August 2001 17:34, Franz Sirl wrote:
> Ok, here is a standalone testcase for this problem.
>
> BTW, Jakub's gcc-3 patch is still missing in pre2.
>
> Franz.
>
> 	* dlfcn/Makefile: Add new testcase tststatic.
> 	* dlfcn/tststatic.c: New testcase.
> 	* dlfcn/modstatic.c: Module code for tststatic.

Oops, wrong patch attached.

Franz.

Index: dlfcn/Makefile
===================================================================
RCS file: /cvs/glibc/libc/dlfcn/Makefile,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 Makefile
--- dlfcn/Makefile	2001/07/06 04:54:45	1.16
+++ dlfcn/Makefile	2001/08/04 15:38:36
@@ -22,7 +22,7 @@ extra-libs	:= libdl
 libdl-routines	:= dlopen dlclose dlsym dlvsym dlerror dladdr eval
 distribute	:= dlopenold.c glreflib1.c glreflib2.c failtestmod.c eval.c \
 		   defaultmod1.c defaultmod2.c errmsg1mod.c modatexit.c \
-		   modcxaatexit.c
+		   modcxaatexit.c modstatic.c
 
 extra-libs-others := libdl
 
@@ -42,6 +42,12 @@ endif
 endif
 modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2 \
 		errmsg1mod modatexit modcxaatexit
+ifeq (yesyes,$(build-static)$(build-shared))
+tests += tststatic
+tests-static = tststatic
+modules-names += modstatic
+tststatic-ENV = LD_LIBRARY_PATH=$(objpfx)
+endif
 extra-objs += $(modules-names:=.os) eval.os
 generated := $(modules-names:=.so)
 
@@ -79,6 +85,11 @@ $(objpfx)tstcxaatexit: $(libdl)
 $(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
 
 $(objpfx)modatexit.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
+
+$(objpfx)tststatic: $(objpfx)/libdl.a
+$(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so
+
+$(objpfx)modstatic.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
 
 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
 # This ensures they will load libc.so for needed symbols if loaded by
--- /dev/null	Wed Jul 25 15:50:10 2001
+++ dlfcn/tststatic.c	Sat Aug  4 07:46:57 2001
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <dlfcn.h>
+
+int main (void) 
+{
+  void *handle;
+  int (*test)(int);
+  char *error;
+  int res;
+
+  handle = dlopen ("modstatic.so", RTLD_LAZY);
+  if (!handle) 
+    {
+      printf ("%s\n", dlerror());
+      exit(1);
+    }
+
+  test = dlsym(handle, "test");
+  if ((error = dlerror()) != NULL)  
+    {
+      
+      printf ("%s\n", error);
+      exit(1);
+    }
+
+  if ((res = (*test)(2)) != 4)
+    {
+      printf ("Got %i, expected 4\n", res);
+      exit (1);
+    }
+
+  dlclose(handle);
+  exit (0);
+}
--- /dev/null	Wed Jul 25 15:50:10 2001
+++ dlfcn/modstatic.c	Sat Aug  4 07:15:11 2001
@@ -0,0 +1,5 @@
+
+int test (int a)
+{
+  return a+a;
+}

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