On Mon, Jan 23, 2012 at 1:29 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> profiledbootstrap currently fails on powerpc64-linux (64-bit). The problem > is that the linker errors on .toc section references from within > non-allocated sections. Alan changed the linker some months ago to > not die with assertion failure, but error out on these, and the attached > testcase reduced from cp/parser.c during bootstrap shows that we still > can hit it in some cases. The problem here is that var-tracking.c > (adjust_insn) isn't able to delegitimize it, because the UNSPEC_TOCREL > isn't added there to r2 register, but to a debug_expr (which only afterwards > is found to contain r2 value). So the UNSPEC_TOCREL makes it through to > mem_loc_descriptor, where it is already properly delegitimized into a > (mem (symbol_ref (".LC0")) where .LC0 is a constant pool (.toc) symbol. > We in some places try to prefer avoid_constant_pool_reference values over > the mems, in this case avoid_constant_pool returns (symbol_ref "w"), which > is a non-local symbol which isn't const_ok_for_output though. So > mem_loc_descriptor on the avoid_constant_pool_reference value fails and we > try the original (mem (symbol_ref (".LC0")) - on other targets this is still > useful, if we know the right value is in say some .got entry etc. and we > can reference that location from within the .debug_info, we win. > Unfortunately the ppc64 linker doesn't like this, so we need to reject > those. The following patch adds a target hook and rejects there from > emitting into .debug_info/.debug_loc any SYMBOL_REFs that are in the > .toc section. > > Bootstrapped/regtested on x86_64-linux and i686-linux, profiledbootstrapped > on powerpc64-linux (both --with-cpu=default32 and defaulting to 64-bit, > the last one failed without this patch), powerpc64-linux regtest is in > progress (but the testcase in the patch has been tested already to > fail without the patch and succeed with the patch). > Ok for trunk? > > 2012-01-23 Jakub Jelinek <ja...@redhat.com> > > PR target/51957 > * target.def (const_not_ok_for_debug_p): New hook. > * doc/tm.texi.in (TARGET_CONST_NOT_OK_FOR_DEBUG_P): New hook > documentation. > * doc/tm.texi: Regenerated. > * dwarf2out.c (const_ok_for_output_1): If > targetm.const_not_ok_for_debug_p returns true, fail. > * config/rs6000/rs6000.c (rs6000_const_not_ok_for_debug_p): New > function. > (TARGET_CONST_NOT_OK_FOR_DEBUG_P): Redefine. > > * gcc.dg/pr51957-1.c: New test. > * gcc.dg/pr51957-1.h: New file. > * gcc.dg/pr51957-2.c: New test. Okay. Thanks, David