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]
Other format: [Raw text]

PATCH: More protected symbol tests


glibc/ld don't handle addresss of some protected symbols right. Here is
a testcase for glibc. I am not certain where the bug is. It could be
in glibc and/or ld.

H.J.
---
2003-03-26  H.J. Lu <hjl at gnu dot org>

	* elf/vismain.c (do_test): Add tests for addresss of intnormal,
	protintcom and protintdata.

	* elf/vismod.h (getintnormal): New prototype.
	(getintcom): Likewise.
	(getintdata): Likewise.

	* elf/vismod1.c (intnormal): New definition.
	(protintcom): Likewise.
	(protintdata): Likewise.
	(getintnormal): New function.
	(getintcom): Likewise.
	(getintdata): Likewise.

--- elf/vismain.c.protected	2001-07-05 21:54:46.000000000 -0700
+++ elf/vismain.c	2003-03-26 12:21:07.000000000 -0800
@@ -38,6 +38,10 @@ const char *protvarlocal = __FILE__;
 extern const char *protvarinmod;
 extern const char *protvaritcpt;
 
+extern int intnormal;
+extern int protintcom;
+extern int protintdata;
+
 int
 do_test (void)
 {
@@ -240,6 +244,23 @@ pointers to `protitcpt' in mod1 or mod2 
       res = 1;
     }
 
+  /* Check for int.  */
+  if (&intnormal != getintnormal ())
+    {
+      puts ("`intnormal' in main and mod1 don't have same address");
+      res = 1;
+    }
+  if (&protintcom != getintcom ())
+    {
+      puts ("`protintcom' in main and mod1 don't have same address");
+      res = 1;
+    }
+  if (&protintdata != getintdata ())
+    {
+      puts ("`protintdata' in main and mod1 don't have same address");
+      res = 1;
+    }
+
   return res;
 }
 
--- elf/vismod.h.protected	2000-12-17 09:07:45.000000000 -0800
+++ elf/vismod.h	2003-03-26 12:19:38.000000000 -0800
@@ -25,3 +25,6 @@ extern int protinmod (void);
 extern int protitcpt (void);
 extern int protlocal (void);
 
+extern int *getintnormal (void);
+extern int *getintcom (void);
+extern int *getintdata (void);
--- elf/vismod1.c.protected	2001-07-05 21:54:46.000000000 -0700
+++ elf/vismod1.c	2003-03-26 12:19:40.000000000 -0800
@@ -102,3 +102,29 @@ getvaritcpt1 (void)
 {
   return protvaritcpt;
 }
+
+int intnormal;
+
+int protintcom;
+asm (".protected protintcom");
+
+int protintdata = 1;
+asm (".protected protintdata");
+
+int *
+getintnormal (void)
+{
+  return &intnormal;
+}
+
+int *
+getintcom (void)
+{
+  return &protintcom;
+}
+
+int *
+getintdata (void)
+{
+  return &protintdata;
+}


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