diff mbox

Fix PR debug/46704

Message ID 201101070034.31774.ebotcazou@adacore.com
State New
Headers show

Commit Message

Eric Botcazou Jan. 6, 2011, 11:34 p.m. UTC
This is the failure of the Ada compiler to re-build itself, a regression 
present on the mainline.  The error message is:

ada/a-charac.o:(.debug_aranges+0x6): undefined reference to `.Ldebug_info0'
ada/ada.o:(.debug_aranges+0x6): undefined reference to `.Ldebug_info0'
ada/alloc.o:(.debug_aranges+0x6): undefined reference to `.Ldebug_info0'
ada/g-htable.o:(.debug_aranges+0x6): undefined reference to `.Ldebug_info0'
ada/g-spchge.o:(.debug_aranges+0x6): undefined reference to `.Ldebug_info0'
ada/get_scos.o:(.debug_aranges+0x6): more undefined references to
`.Ldebug_info0' follow

The problem is that, when a spec file (*.ads) is essentially empty, some size 
functions may nevertheless be generated and, when -fkeep-inline-functions is 
in effect, emitted in the assembly code.  No debug info is generated for them 
but FDEs are (on x86-64) so a debug_aranges section will be generated but no 
debug_info section; now the former references a label in the latter.

Fixed by conditionalizing the generation of the debug_aranges section on it 
being not empty (arange_table_in_use) instead of on the presence of FDEs.

Bootstrapped/regtested on x86_64-suse-linux, applied on mainline as obvious.


2011-01-06  Eric Botcazou  <ebotcazou@adacore.com>

	PR debug/46704
	* dwarf2out.c (dwarf2out_finish): Output the debug_aranges section
	only when it is not empty.
diff mbox

Patch

Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 168508)
+++ dwarf2out.c	(working copy)
@@ -23324,7 +23324,7 @@  dwarf2out_finish (const char *filename)
 
   /* Output the address range information.  We only put functions in the arange
      table, so don't write it out if we don't have any.  */
-  if (fde_table_in_use)
+  if (arange_table_in_use)
     {
       switch_to_section (debug_aranges_section);
       output_aranges ();