This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Don't canonicalize functions pointers in page 0 on hppa-linux


This is a small update to the recently installed patch to canonicalize
function pointers on hppa-linux.  It fixes a segmentation fault in vim.
Low addresses are never used for functions and in a normal link .text
doesn't start until at least 0x10000.  The hpux port doesn't canonicalize
in page 0, so I decided to make the linux port the same.

Tested on hppa-linux.  Installed on main.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2002-12-09  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* pa/fptr.c (__canonicalize_funcptr_for_compare): Don't canonicalize
	function pointers in page 0.

Index: config/pa/fptr.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/pa/fptr.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 fptr.c
--- config/pa/fptr.c	5 Dec 2002 01:57:27 -0000	1.1
+++ config/pa/fptr.c	9 Dec 2002 18:57:49 -0000
@@ -64,11 +64,11 @@ __canonicalize_funcptr_for_compare (fptr
   static fixup_t fixup;
   unsigned int *plabel, *got;
 
-  /* -1 is special.  It is used in crtend to mark the end of a list of
-     function pointers.  Also return immediately if the plabel bit is
-     not set in the function pointer.  In this case, the function pointer
-     points directly to the function.  */
-  if ((int) fptr == -1 || !((int) fptr & 2))
+  /* -1 and page 0 are special.  -1 is used in crtend to mark the end of
+     a list of function pointers.  Also return immediately if the plabel
+     bit is not set in the function pointer.  In this case, the function
+     pointer points directly to the function.  */
+  if ((int) fptr == -1 || (unsigned int) fptr < 4096 || !((int) fptr & 2))
     return (unsigned int) fptr;
 
   /* The function pointer points to a function descriptor (plabel).  If


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