The attached patch fixes an oversight in hppa_profile_hook. We need to
mark the SYMBOL_REF
for _mcount as a function label. When the -mlong-call option is used,
the call to _mcount is converted
to an indirect call. In that case, we need the function pointer to
point to a procedure label
which points to a function descriptor. This is necessary to correctly
load the PIC register. Marking
the SYMBOL_REF causes this to happen.
Tested on hppa-unknown-linux-gnu with no regressions. Committed to trunk.
This bug caused a build error for gcl. Thanks to Camm Maguire for
debugging the problem.
Dave
--
John David Anglin dave.ang...@bell.net
2018-02-10 John David Anglin <dang...@gcc.gnu.org>
* config/pa/pa.c (hppa_profile_hook): Mark SYMBOL_REF for _mcount as
function label.
Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c (revision 257545)
+++ config/pa/pa.c (working copy)
@@ -4578,13 +4578,17 @@
lcla2 and load_offset_label_address insn patterns. */
rtx reg = gen_reg_rtx (SImode);
rtx_code_label *label_rtx = gen_label_rtx ();
- rtx mcount = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (Pmode, "_mcount"));
int reg_parm_stack_space = REG_PARM_STACK_SPACE (NULL_TREE);
- rtx arg_bytes, begin_label_rtx;
+ rtx arg_bytes, begin_label_rtx, mcount, sym;
rtx_insn *call_insn;
char begin_label_name[16];
bool use_mcount_pcrel_call;
+ /* Set up call destination. */
+ sym = gen_rtx_SYMBOL_REF (Pmode, "_mcount");
+ pa_encode_label (sym);
+ mcount = gen_rtx_MEM (Pmode, sym);
+
/* If we can reach _mcount with a pc-relative call, we can optimize
loading the address of the current function. This requires linker
long branch stub support. */