This is the mail archive of the
mailing list for the binutils project.
Re: Bad patch for gas
On Wed, May 23, 2001 at 09:43:47PM -0700, H . J . Lu wrote:
> Under mips-elf, I now got
> # cat foo.s
> .set mips16
> .word 0
> la $2,data2
> .word 0
> # ./as-new -o /tmp/foo.o /tmp/foo.s
> /tmp/foo.s: Assembler messages:
> /tmp/foo.s:4: Error: invalid unextended operand value
Here's the code, from tc-mips.c:md_convert_frag, that is broken by
val = S_GET_VALUE (fragp->fr_symbol); (*)
Previously, resolve_symbol_value was actually setting the value of
the symbol to it's final value, ie. including the base address of
the symbol frag as well as the offset. Now, with md_convert_frag
being called with finalize_syms == 0, resolve_symbol_value doesn't
do much, and S_GET_VALUE just returns the offset of the symbol
within the frag. Oops.
Fortunately, there is an easy fix.
* write.c (write_object_file): Set finalize_syms = 1 before
size_seg is called.
(*) val = resolve_symbol_value (fragp->fr_symbol);
would have done the job here too.
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.33
diff -u -p -r1.33 write.c
--- write.c 2001/05/22 10:23:48 1.33
+++ write.c 2001/05/24 07:51:42
@@ -1574,13 +1574,14 @@ write_object_file ()
+ /* Relaxation has completed. Freeze all syms. */
+ finalize_syms = 1;
bfd_map_over_sections (stdoutput, size_seg, (char *) 0);
-#endif /* BFD_ASSEMBLER */
- /* Relaxation has completed. Freeze all syms. */
finalize_syms = 1;
+#endif /* BFD_ASSEMBLER */
#if defined (BFD_ASSEMBLER) && defined (OBJ_COFF) && defined (TE_GO32)
/* Now that the segments have their final sizes, run through the