public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Fix alpha-linux unwind info
@ 2011-08-05 18:08 Richard Henderson
  2011-08-06  6:23 ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2011-08-05 18:08 UTC (permalink / raw)
  To: binutils; +Cc: Nick Clifton, ubizjak

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49688

It turns out that given both .ent/.end (aka "legacy unwind") directives
and CFI directives, we were generating double .eh_frame entries.  Given
that the legacy directives are not able to represent personality data,
this lead to a bit of random failure as the binary search selected one
or the other of the two .eh_frame entries with equal start addresses.

The existing test for the existance of .eh_frame did not work because
we have not yet called cfi_finish.

Exposing the dw2gencfi variable seems slightly hacky, but no worse
than any other solution I could think of.

Ok?


r~

[-- Attachment #2: z --]
[-- Type: text/plain, Size: 2256 bytes --]

	* dw2gencfi.c (all_fde_data): Export.
	* dw2gencfi.h (all_fde_data): Declare.
	* config/tc-alpha.c (alpha_elf_md_end): Don't convert legacy unwind
	info to cfi unwind info if the user already has supplied some.


Index: dw2gencfi.c
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.c,v
retrieving revision 1.56
diff -u -p -r1.56 dw2gencfi.c
--- dw2gencfi.c	10 May 2011 02:36:41 -0000	1.56
+++ dw2gencfi.c	5 Aug 2011 18:05:10 -0000
@@ -287,7 +287,7 @@ struct cie_entry
 
 /* List of FDE entries.  */
 
-static struct fde_entry *all_fde_data;
+struct fde_entry *all_fde_data;
 static struct fde_entry **last_fde_data = &all_fde_data;
 
 /* List of CIEs so that they could be reused.  */
Index: dw2gencfi.h
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.h,v
retrieving revision 1.9
diff -u -p -r1.9 dw2gencfi.h
--- dw2gencfi.h	9 May 2011 13:17:56 -0000	1.9
+++ dw2gencfi.h	5 Aug 2011 18:05:10 -0000
@@ -118,6 +118,9 @@ struct fde_entry
 #endif
 };
 
+/* The list of all FDEs that have been collected.  */
+extern struct fde_entry *all_fde_data;
+
 /* Fake CFI type; outside the byte range of any real CFI insn.  */
 #define CFI_adjust_cfa_offset	0x100
 #define CFI_return_column	0x101
Index: config/tc-alpha.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.c,v
retrieving revision 1.95
diff -u -p -r1.95 tc-alpha.c
--- config/tc-alpha.c	28 Jun 2011 13:33:33 -0000	1.95
+++ config/tc-alpha.c	5 Aug 2011 18:05:10 -0000
@@ -4042,6 +4042,14 @@ alpha_elf_md_end (void)
   if (bfd_get_section_by_name (stdoutput, ".eh_frame") != NULL)
     return;
 
+  /* ??? In theory we could look for functions for which we have
+     generated unwind info via CFI directives, and those we have not.
+     Those we have not could still get their unwind info from here.
+     For now, do nothing if we've seen any CFI directives.  Note that
+     the above test will not trigger, as we've not emitted data yet.  */
+  if (all_fde_data != NULL)
+    return;
+
   /* Generate .eh_frame data for the unwind directives specified.  */
   for (p = all_frame_data; p ; p = p->next)
     if (p->prologue_sym)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fix alpha-linux unwind info
  2011-08-05 18:08 Fix alpha-linux unwind info Richard Henderson
@ 2011-08-06  6:23 ` Uros Bizjak
  2011-08-06  6:41   ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2011-08-06  6:23 UTC (permalink / raw)
  To: Richard Henderson; +Cc: binutils, Nick Clifton

On Fri, Aug 5, 2011 at 8:08 PM, Richard Henderson <rth@redhat.com> wrote:
> See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49688
>
> It turns out that given both .ent/.end (aka "legacy unwind") directives
> and CFI directives, we were generating double .eh_frame entries.  Given
> that the legacy directives are not able to represent personality data,
> this lead to a bit of random failure as the binary search selected one
> or the other of the two .eh_frame entries with equal start addresses.
>
> The existing test for the existance of .eh_frame did not work because
> we have not yet called cfi_finish.
>
> Exposing the dw2gencfi variable seems slightly hacky, but no worse
> than any other solution I could think of.

The patch works OK on native alpha [1].

BTW: An "as" assert was triggerd in BFD for:

FAIL: g++.dg/tree-prof/partition2.C compilation,  -Os  -fprofile-use
(internal compiler error)
UNRESOLVED: g++.dg/tree-prof/partition2.C execution,    -Os  -fprofile-use

/tmp/cccx2jTq.s: Assembler messages:^M
/tmp/cccx2jTq.s:122: Error: invalid operands (.text.unlikely and
.text.startup sections) for `-'^M
/home/uros/bin/as: BFD (GNU Binutils) 2.21.52.20110623 assertion fail
elf.c:2826^M
g++: internal compiler error: Segmentation fault (program as)^M
Please submit a full bug report,^M
with preprocessed source if appropriate.^M
See <http://gcc.gnu.org/bugs.html> for instructions.^M
compiler exited with status 1

On x86 linux this testcase only reports assembler error, without ICE in "as".

[1] http://gcc.gnu.org/ml/gcc-testresults/2011-08/msg00614.html

Uros.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fix alpha-linux unwind info
  2011-08-06  6:23 ` Uros Bizjak
@ 2011-08-06  6:41   ` Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2011-08-06  6:41 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Richard Henderson, binutils, Nick Clifton

On Sat, Aug 06, 2011 at 08:22:58AM +0200, Uros Bizjak wrote:
> BTW: An "as" assert was triggerd in BFD for:
> 
> FAIL: g++.dg/tree-prof/partition2.C compilation,  -Os  -fprofile-use
> (internal compiler error)
> UNRESOLVED: g++.dg/tree-prof/partition2.C execution,    -Os  -fprofile-use
> 
> /tmp/cccx2jTq.s: Assembler messages:^M
> /tmp/cccx2jTq.s:122: Error: invalid operands (.text.unlikely and
> .text.startup sections) for `-'^M

This is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49972

> /home/uros/bin/as: BFD (GNU Binutils) 2.21.52.20110623 assertion fail
> elf.c:2826^M
> g++: internal compiler error: Segmentation fault (program as)^M

and the gas segfault has already been fixed.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-06  6:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-05 18:08 Fix alpha-linux unwind info Richard Henderson
2011-08-06  6:23 ` Uros Bizjak
2011-08-06  6:41   ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).