This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Produce Stabs-in-ELF on IRIX 5 with -no-mdebug
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: binutils at sourceware dot org
- Date: Thu, 11 Nov 2010 12:06:47 +0100
- Subject: Produce Stabs-in-ELF on IRIX 5 with -no-mdebug
As reported in GCC PR debug/39104
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39104
stabs debug info fails on IRIX 5.3
all -gstabs* testcases in the GCC testsuite currently fail:
$ touch debug.c
$ gcc -gstabs -c debug.c
/var/tmp//ccDaTzn4.s: Assembler messages:
/var/tmp//ccDaTzn4.s:3: Warning: illegal .stabs directive, bad character
[...]
With -v, one sees that gas is invoked like this
$ /vol/gcc/bin/gas-2.20.1 -v -EB -g -no-mdebug -mabi=32 -v -o debug.o debug.s
gcc emits .stab* directives for use with Stabs-in-ELF (thus the
-no-mdebug), but the IRIX 5 binutils are configured to support both
ECOFF (and thus Stabs-in-mdebug for compatibility with IRIX 4) and ELF
(this Stabs-in-ELF). Unfortunately, gas/config/obj-elf.c isn't able to
deal with ECOFF_DEBUGGING not being a compile-time constant, which is
the case here: gas/config/obj-elf.h has
#define ECOFF_DEBUGGING mips_flag_mdebug
To fix the problem, we need to turn the preprocessor check into a
runtime check, which is exactly what the following patch does.
The gcc testcase now assembles correctly and I could verify with objdump
-g and objdump -s that the .stab/.stabstr sections are created as
expected. A full GCC mainline bootstrap is currently running. It will
take about a week to complete.
Ok for mainline and 2.21 branch if that passes?
Rainer
2010-04-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* config/obj-elf.c (elf_generate_asm_lineno): New function.
(elf_process_stab): New function.
(elf_format_ops): Always use them as generate_asm_lineno,
process_stab members.
--- gas/config/obj-elf.c~ Mon Sep 14 13:43:27 2009
+++ gas/config/obj-elf.c Sun Apr 18 00:34:40 2010
@@ -2351,6 +2351,29 @@
#endif /* SCO_ELF */
+static void
+elf_generate_asm_lineno (void)
+{
+#ifdef NEED_ECOFF_DEBUG
+ if (ECOFF_DEBUGGING)
+ ecoff_generate_asm_lineno ();
+#endif
+}
+
+static void
+elf_process_stab (segT sec,
+ int what,
+ const char *string,
+ int type,
+ int other,
+ int desc)
+{
+#ifdef NEED_ECOFF_DEBUG
+ if (ECOFF_DEBUGGING)
+ ecoff_stab (sec, what, string, type, other, desc);
+#endif
+}
+
static int
elf_separate_stab_sections (void)
{
@@ -2391,13 +2414,8 @@
0, /* s_get_type */
0, /* s_set_type */
elf_copy_symbol_attributes,
-#ifdef NEED_ECOFF_DEBUG
- ecoff_generate_asm_lineno,
- ecoff_stab,
-#else
- 0, /* generate_asm_lineno */
- 0, /* process_stab */
-#endif
+ elf_generate_asm_lineno,
+ elf_process_stab,
elf_separate_stab_sections,
elf_init_stab_section,
elf_sec_sym_ok_for_reloc,
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University