This is the mail archive of the binutils@sources.redhat.com 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]
Other format: [Raw text]

Re: Remove a fudge from tc-ppc.c:md_apply_fix3


On Wed, May 08, 2002 at 12:23:41AM -0700, Geoff Keating wrote:
> The way I'd look at this patch is this:
> 
> 1. Does the patch actually fix any known bug?
> 2. Can you write a testsuite that exercises all the code paths that
>    the patch affects?
> 
> If the answer to both questions is 'no', the patch is all risk and no
> reward, and so there's no point committing it.

Hey, it's a code cleanup.  Perhaps I overstated the risk and
understated my confidence in messing around in this area.  Amusingly,
most of my attempts to generate testcases uncovered further bugs.
For instance:

----
foo = 0x1234
 .text
 beq foo@brtaken
----

callabs.s: Assembler messages:
callabs.s:3: Error: syntax error; found `@' but expected `,'
callabs.s:3: Error: junk at end of line: `@brtaken'

----
 .text
 beq foo@brtaken
foo = 0x1234
----

Gas failure, reloc value 178
callabs.s: Assembler messages:
callabs.s:4: Internal error, aborting at .../tc-ppc.c line 5506 in
md_apply_fix3

----
foo = 0x1234
 .text
 .weak foo
 beq foo
----

00000000 <.text>:
   0:   41 82 12 34     beq-    1234 <foo>

with no reloc.  This appears to be a generic bug.

----
 .text
 beq foo
foo = 0x1234
----

00000000 <.text>:
   0:   41 82 12 34     beq-    1234 <foo>
                        0: R_PPC_REL14  foo+0x1234

oops, 2xfoo, another generic bug.

----
 .text
 .weak foo
 beq foo
foo = 0x1234
----

00000000 <.text>:
   0:   41 82 12 34     beq-    1234 <foo>
                        0: R_PPC_REL14  foo+0x1234

Ha, finally got one that is fixed by the patch.  After, we get

00000000 <.text>:
   0:   41 82 00 00     beq-    0 <.text>
                        0: R_PPC_REL14  foo

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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