This is the mail archive of the mailing list for the binutils project.

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

Re: [Patch]: Re: gas 2.10.91 from 20000920 cvs is broken under hpux

> > It doesn't see right that a simple function such as the one above should
> > need an argument relocation stub.  If I change the return type to void, then
> > both values are 256 and no stub is needed.   I haven't been able to 
> > find where the bits for fx_arg_reloc are defined.  Does this seem right?
> There is a problem here but it doesn't appear to be with binutils.  Rather,
> it is with gcc.  The .EXPORT statement generated for the above function is:
> However, the .CALL generated doesn't include RTNVAL=GR:
>         .CALL ARGW0=GR
> Since the .CALL is missing a RTNVAL=GR, the two don't match and an argument
> relocation stub is being generated for all functions with a return in a GR.

Changed my mind about the problem being in gcc.  The default when an
argument description is omitted from a .CALL statement is ARG = NO.
NO means the argument cannot be relocated.  Thus, the definition of
arg_reloc_stub_needed needs to be fixed to check all four args and the
return separately.

A possible fix is attached below.  Note there is another small fix
to pa_align as well.

There is one test failure: reduce.s.  The new code no longer generates
a R_PCREL_CALL call to foo.  However, I believe that this is correct
since foo is `static' (ie., not exported) and an argument relocation
stub is not required for the call.

---	Tue Sep 26 16:15:18 2000
+++	Tue Sep 26 16:15:32 2000
@@ -1,5 +1,5 @@     file format som     file format som
 OFFSET   TYPE              VALUE 
@@ -9,7 +9,6 @@
 00000008 R_ENTRY           *ABS*+0x08000008
 00000008 R_CODE_ONE_SYMBOL  $CODE$+0x00000004
 0000000c R_CODE_ONE_SYMBOL  $CODE$+0x00000004
-00000014 R_PCREL_CALL      foo+0x40000000
 00000028 R_EXIT            *ABS*+0x00000010
J. David Anglin                        
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-09-26  J. David Anglin  <>

	* config/tc-hppa.c (arg_reloc_stub_needed): Use
	pa_arg_reloc_stub_needed to check arguments and return separately.
	(pa_arg_reloc_stub_needed): New function.
	(arg_reloc_check): New macro.
	(pa_align): Declare argument `bytes'.

--- config/tc-hppa.c.alan	Mon Sep 25 15:24:54 2000
+++ config/tc-hppa.c	Tue Sep 26 15:27:28 2000
@@ -4323,8 +4323,24 @@
 #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC)
+#define arg_reloc_check(a, b, m) \
+  (((a) & (m)) && ((b) & (m)) && (((a) & (m)) != ((b) & (m))))
+/* Check all arguments and return value to see if caller and callee
+   agree on their location. */
+static int
+pa_arg_reloc_stub_needed (caller, callee)
+  unsigned int caller, callee;
+  return (arg_reloc_check (caller, callee, 0x003)
+    || arg_reloc_check (caller, callee, 0x00c)
+    || arg_reloc_check (caller, callee, 0x030)
+    || arg_reloc_check (caller, callee, 0x0c0)
+    || arg_reloc_check (caller, callee, 0x300));
 #define arg_reloc_stub_needed(CALLER, CALLEE) \
-  ((CALLEE) && (CALLER) && ((CALLEE) != (CALLER)))
+  pa_arg_reloc_stub_needed ((CALLER), (CALLEE))
 #define arg_reloc_stub_needed(CALLER, CALLEE) 0
@@ -5831,6 +5847,7 @@
    alignment of the subspace if necessary.  */
 static void
 pa_align (bytes)
+  int bytes;
   /* We must have a valid space and subspace.  */
   pa_check_current_space_and_subspace ();

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