[patch] Fix bug gas/1896

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] Fix bug gas/1896

John David Anglin-4
This change fixes gas/1896.  The problem was the SOM target wasn't
reducing 32-bit relocations.  The FIXME comment explains why this
was done.  The problem noted in the FIXME was fixed in the last
change to md_apply_fix.  Thus, I don't believe that we need to
reject reduction of 32-bit HPPA relocations under HP-UX.

There may still be a gas bug as I think the .set should have
resulted in the symbol here being used in the first .long.  I imagine
most ports reduce the value and don't see this problem.

I've had to modifify the regexp in redef2.d, weakref1.d and
reloc.exp to accomodate the new output.

Ok?

Dave
--
J. David Anglin                                  [hidden email]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2005-11-24  John David Anglin  <[hidden email]>

        Bug gas/1896
        * config/tc-hppa.c (hppa_fix_adjustable): Don't reject for reduction
        R_HPPA relocations that are 32-bits wide.

        * gas/all/redef2.d: Allow "$DATA$" as well as ".data" in matches.
        * gas/all/weakref1.d: Allow "$CODE$" as well as ".text" in matches.
        * gas/hppa/reloc/reloc.exp: Adjust regexp for new output.

Index: config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.128
diff -u -3 -p -r1.128 tc-hppa.c
--- config/tc-hppa.c 16 Nov 2005 08:00:31 -0000 1.128
+++ config/tc-hppa.c 24 Nov 2005 21:43:11 -0000
@@ -8396,12 +8396,8 @@ pa_lsym (unused)
    any fixup which creates entries in the DLT (eg they use "T" field
    selectors).
 
-   Reject reductions involving symbols with external scope; such
-   reductions make life a living hell for object file editors.
-
-   FIXME.  Also reject R_HPPA relocations which are 32bits wide in
-   the code space.  The SOM BFD backend doesn't know how to pull the
-   right bits out of an instruction.  */
+   ??? Reject reductions involving symbols with external scope; such
+   reductions make life a living hell for object file editors.  */
 
 int
 hppa_fix_adjustable (fixp)
@@ -8414,17 +8410,6 @@ hppa_fix_adjustable (fixp)
 
   hppa_fix = (struct hppa_fix_struct *) fixp->tc_fix_data;
 
-#ifdef OBJ_SOM
-  /* Reject reductions of symbols in 32bit relocs unless they
-     are fake labels.  */
-  if (fixp->fx_r_type == R_HPPA
-      && hppa_fix->fx_r_format == 32
-      && strncmp (S_GET_NAME (fixp->fx_addsy),
-  FAKE_LABEL_NAME,
-  strlen (FAKE_LABEL_NAME)))
-    return 0;
-#endif
-
 #ifdef OBJ_ELF
   /* LR/RR selectors are implicitly used for a number of different relocation
      types.  We must ensure that none of these types are adjusted (see below)
Index: testsuite/gas/all/redef2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/all/redef2.d,v
retrieving revision 1.3
diff -u -3 -p -r1.3 redef2.d
--- testsuite/gas/all/redef2.d 21 Nov 2005 04:30:32 -0000 1.3
+++ testsuite/gas/all/redef2.d 24 Nov 2005 21:43:11 -0000
@@ -5,9 +5,9 @@
 
 RELOCATION RECORDS FOR .*
 .*
-0+00.*(here|\.data)
+0+00.*(here|\.data|\$DATA\$)
 0+08.*xtrn
-0+10.*(sym|\.data(\+0x0+10)?)
+0+10.*(sym|(\.data|\$DATA\$)(\+0x0+10)?)
 #...
 Contents of section (\.data|\$DATA\$):
  0000 00000000 11111111 00000000 22222222[ ]+................[ ]*
Index: testsuite/gas/all/weakref1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/all/weakref1.d,v
retrieving revision 1.3
diff -u -3 -p -r1.3 weakref1.d
--- testsuite/gas/all/weakref1.d 20 Nov 2005 22:03:25 -0000 1.3
+++ testsuite/gas/all/weakref1.d 24 Nov 2005 21:43:11 -0000
@@ -83,14 +83,14 @@ OFFSET +TYPE +VALUE *
 [0-9a-f]+ [^ ]*  +uh8
 [0-9a-f]+ [^ ]*  +uh9
 [0-9a-f]+ [^ ]*  +uh9
-[0-9a-f]+ [^ ]*  +(ld1|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(ld2|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(ld3|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(ld4|\.text)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(ld1|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(ld2|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(ld3|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(ld4|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
 [0-9a-f]+ [^ ]*  +ud5
-[0-9a-f]+ [^ ]*  +(gd6|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(gd7|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(ld8|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(ld8|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(ld9|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(ld9|\.text)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(gd6|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(gd7|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(ld8|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(ld8|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(ld9|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
+[0-9a-f]+ [^ ]*  +(ld9|\.text|\$CODE\$)(\+0x[0-9a-f]+)?
Index: testsuite/gas/hppa/reloc/reloc.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/hppa/reloc/reloc.exp,v
retrieving revision 1.12
diff -u -3 -p -r1.12 reloc.exp
--- testsuite/gas/hppa/reloc/reloc.exp 5 Aug 2005 17:55:15 -0000 1.12
+++ testsuite/gas/hppa/reloc/reloc.exp 24 Nov 2005 21:43:12 -0000
@@ -636,9 +636,9 @@ proc do_apply_test {} {
 
     while 1 {
  expect {
-    -re "^ +\[0-9\]+ 0000 00000000\[^\n\]*\n" { set x [expr $x+1] }
-    -re "^ +\[0-9\]+ 0004 00000000\[^\n\]*\n" { set x [expr $x+1] }
-    -re "^ +\[0-9\]+ 0008 00000000\[^\n\]*\n" { set x [expr $x+1] }
+    -re "^ +\[0-9\]+ 0000 00000044\[^\n\]*\n" { set x [expr $x+1] }
+    -re "^ +\[0-9\]+ 0004 00000058\[^\n\]*\n" { set x [expr $x+1] }
+    -re "^ +\[0-9\]+ 0008 0000006C\[^\n\]*\n" { set x [expr $x+1] }
     -re "\[^\n\]*\n" { }
     timeout { perror "timeout\n"; break }
     eof { break }
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Fix bug gas/1896

Alan Modra
On Thu, Nov 24, 2005 at 07:09:24PM -0500, John David Anglin wrote:
> I've had to modifify the regexp in redef2.d, weakref1.d and
> reloc.exp to accomodate the new output.
>
> Ok?

These are fine.  You don't really need to ask for approval for a tweak
like this.

--
Alan Modra
IBM OzLabs - Linux Technology Centre
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Fix bug gas/1896

John David Anglin-4
> > Ok?
>
> These are fine.  You don't really need to ask for approval for a tweak
> like this.

Actually, I was wondering more why the hack in hppa_fix_adjustable had
been around for 10-15 years and if I'd missed something.

Dave
--
J. David Anglin                                  [hidden email]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Fix bug gas/1896

Alan Modra
On Thu, Nov 24, 2005 at 08:35:12PM -0500, John David Anglin wrote:
> Actually, I was wondering more why the hack in hppa_fix_adjustable had
> been around for 10-15 years and if I'd missed something.

You'll have to ask Jeff Law about that one.

--
Alan Modra
IBM OzLabs - Linux Technology Centre