This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix another IRIX bootstrap issue
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Geoffrey Keating <gkeating at apple dot com>
- Date: Tue, 11 Apr 2006 17:04:32 -0600 (MDT)
- Subject: [PATCH] Fix another IRIX bootstrap issue
The following patch fixes a serious regression on IRIX that causes
the compiler to segmentation fault when attempting to compile any
file. The problem was introduced by Geoff's DWARF for darwin patch,
which interacts poorly with targets that use DWARF for unwind info
but not for debugging?! The problem is that on the affected platforms
we can call "output_call_frame_info", without first calling the
initialization function "dwarf2out_init". This then clashes with
the following hunk for the darwin dwarf changes:
http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01092.html
- switch_to_section (get_section (DEBUG_FRAME_SECTION, SECTION_DEBUG, NULL));
+ switch_to_section (debug_frame_section);
On IRIX, debug_frame_section hasn't been initalized/allocated, so we
dump core after dereferencing a NULL pointer in switch_to_section.
The patch below restores some aspect of the previous behaviour, by
initializing debug_frame_section with a call to get_section if it
hasn't previously been set. This seems like an appropriate solution,
but often the "obvious" fix is not always the corect fix. It also
isn't clear if anywhere else needs to be guarded by a similar test.
The following patch has been tested on mips-sgi-irix6.5 where it
allows boostrap to get as far as a comparison failure after stage3,
previously this bug would break the bootstrap compiling the first
file of libgcc during stage1.
Ok for mainline?
2006-04-11 Roger Sayle <roger@eyesopen.com>
* dwarf2out.c (output_call_frame_info): Create debug_frame_section
if it hasn't been initialized by dwarf2out_init.
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 112856)
+++ dwarf2out.c (working copy)
@@ -2219,7 +2219,12 @@
if (for_eh)
switch_to_eh_frame_section ();
else
- switch_to_section (debug_frame_section);
+ {
+ if (!debug_frame_section)
+ debug_frame_section = get_section (DEBUG_FRAME_SECTION,
+ SECTION_DEBUG, NULL);
+ switch_to_section (debug_frame_section);
+ }
ASM_GENERATE_INTERNAL_LABEL (section_start_label, FRAME_BEGIN_LABEL, for_eh);
ASM_OUTPUT_LABEL (asm_out_file, section_start_label);
Roger
--