* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
2012-01-23 7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
@ 2012-01-23 7:53 ` jakub at gcc dot gnu.org
2012-01-23 8:19 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23 7:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51957
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.6.3
Target Milestone|--- |4.7.0
Known to fail| |4.7.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
2012-01-23 7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
2012-01-23 7:53 ` [Bug target/51957] " jakub at gcc dot gnu.org
@ 2012-01-23 8:19 ` jakub at gcc dot gnu.org
2012-01-23 10:53 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23 8:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51957
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-23 07:25:19 UTC ---
Compile with -m64 -g -O2 -fprofile-generate (*.gcda file missing), look for
DW_OP_deref in .debug_loc section.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
2012-01-23 7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
2012-01-23 7:53 ` [Bug target/51957] " jakub at gcc dot gnu.org
2012-01-23 8:19 ` jakub at gcc dot gnu.org
@ 2012-01-23 10:53 ` jakub at gcc dot gnu.org
2012-01-23 10:54 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23 10:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51957
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-23 10:48:05 UTC ---
The problem is that during var-tracking adjust_insn doesn't
avoid_constant_pool_reference because we have:
(debug_insn 116 33 34 5 (var_location:DI D#3 (reg:DI 2 2)) -1
(nil))
...
(debug_insn 114 37 113 5 (var_location:DI D#2 (mem/u/c:DI (plus:DI
(debug_expr:DI D#3)
(const:DI (unspec:DI [
(symbol_ref/u:DI ("*.LC0") [flags 0x2])
] UNSPEC_TOCREL))) [8 S8 A8])) -1
(nil))
and thus rs6000_delegitimize_address doesn't do anything (as there is
DEBUG_EXPR not REG 2 directly). This means the UNSPEC_TOCREL stuff gets down
into mem_loc_descriptor (with (reg:DI 2) in it). There it is successfully
delegitimized and we do:
case MEM:
{
rtx new_rtl = avoid_constant_pool_reference (rtl);
if (new_rtl != rtl)
{
mem_loc_result = mem_loc_descriptor (new_rtl, mode, mem_mode,
initialized);
if (mem_loc_result != NULL)
return mem_loc_result;
}
}
mem_loc_result = mem_loc_descriptor (XEXP (rtl, 0),
get_address_mode (rtl), mode,
VAR_INIT_STATUS_INITIALIZED);
While mem_loc_descriptor here (unlike loc_descriptor or some other places)
tries
avoid_constant_pool_reference first, mem_loc_descriptor for that fails (because
(symbol_ref "w") is external and so it falls back to DW_OP_deref on the .LC0
symbol (but that is apparently what ppc64 ld doesn't like). On other targets,
trying to fallback to the original mem can be a win, if say we end up
dereferencing some word in .got and the linker is fine with it, we can provide
the value to the debugger.
So I'd say that ppc64 should have some target hook that would say that (at
least certain kind of) mem/u/c (on ppc64 if we can limit them to .toc section
references if possible) should never be referenced in the
.debug_info/.debug_loc (or could it be on the symbol_ref's only, can we from
the symbol_ref find out that it is a symbol from .toc section?).
Alan, what do you think about this?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
2012-01-23 7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2012-01-23 10:53 ` jakub at gcc dot gnu.org
@ 2012-01-23 10:54 ` jakub at gcc dot gnu.org
2012-01-23 14:05 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23 10:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51957
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-23 10:51:39 UTC ---
To reject just .toc related SYMBOL_REFs, guess we'd need to set
#define SYMBOL_FLAG_TOC_SECTION (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
or so flag on the symbol refs when creating them and test it in the target
hook.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
2012-01-23 7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2012-01-23 10:54 ` jakub at gcc dot gnu.org
@ 2012-01-23 14:05 ` jakub at gcc dot gnu.org
2012-01-24 8:00 ` jakub at gcc dot gnu.org
2012-01-24 8:05 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23 14:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51957
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-01-23
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-23 13:51:44 UTC ---
Created attachment 26428
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26428
gcc47-pr51957.patch
Untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
2012-01-23 7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
` (4 preceding siblings ...)
2012-01-23 14:05 ` jakub at gcc dot gnu.org
@ 2012-01-24 8:00 ` jakub at gcc dot gnu.org
2012-01-24 8:05 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-24 8:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51957
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-24 07:24:44 UTC ---
Author: jakub
Date: Tue Jan 24 07:24:34 2012
New Revision: 183468
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183468
Log:
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.
Added:
trunk/gcc/testsuite/gcc.dg/pr51957-1.c
trunk/gcc/testsuite/gcc.dg/pr51957-1.h
trunk/gcc/testsuite/gcc.dg/pr51957-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.c
trunk/gcc/doc/tm.texi
trunk/gcc/doc/tm.texi.in
trunk/gcc/dwarf2out.c
trunk/gcc/target.def
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
2012-01-23 7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
` (5 preceding siblings ...)
2012-01-24 8:00 ` jakub at gcc dot gnu.org
@ 2012-01-24 8:05 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-24 8:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51957
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-24 07:49:57 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread