patch for IA-64 function call miscompilation
Jim Wilson
wilson@cygnus.com
Thu Aug 24 13:51:00 GMT 2000
This fixes miscompilation of do_slurp_coff_armap in bfd/archive.c.
The call to bfd_getb32 was converted from a direct call to an register
indirect call by cse, but that fails because IA-64 uses function descriptors,
and thus register indirect calls need a different instruction sequence. We
fix this by obfuscating function SYMBOL_REFs a bit so that they won't get
cse'd into call instructions. This just returns us to the same code we had
a few months ago before some recent optimization changes.
2000-08-24 Jim Wilson <wilson@cygnus.com>
* config/ia64/ia64.md (movdi): Don't call gen_movdi_symbolic if
we have a SYMBOL_REF with SYMBOL_REF_FLAG set.
Index: ia64.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/ia64/ia64.md,v
retrieving revision 1.36
diff -p -r1.36 ia64.md
*** ia64.md 2000/08/20 19:03:03 1.36
--- ia64.md 2000/08/24 20:43:22
***************
*** 358,364 ****
type of PIC address load. If this function gets deferred, we
may acquire information that changes the value of the
sdata_symbolic_operand predicate. */
! if (rtx_equal_function_value_matters)
emit_insn (gen_movdi_symbolic (operands[0], operands[1]));
else
ia64_expand_load_address (operands[0], operands[1]);
--- 358,372 ----
type of PIC address load. If this function gets deferred, we
may acquire information that changes the value of the
sdata_symbolic_operand predicate. */
! /* But don't delay for function pointers. Loading a function address
! actually loads the address of the descriptor not the function.
! If we represent these as SYMBOL_REFs, then they get cse'd with
! calls, and we end up with calls to the descriptor address instead of
! calls to the function address. Functions are not candidates for
! sdata anyways. */
! if (rtx_equal_function_value_matters
! && ! (GET_CODE (operands[1]) == SYMBOL_REF
! && SYMBOL_REF_FLAG (operands[1])))
emit_insn (gen_movdi_symbolic (operands[0], operands[1]));
else
ia64_expand_load_address (operands[0], operands[1]);
More information about the Gcc-patches
mailing list