From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Bowman To: "'gas2@cygnus.com'" Cc: "'ian@cygnus.com'" Subject: Patch for binutils (GAS-980418) for VxWorks on MIPS Date: Sat, 18 Apr 1998 14:07:00 -0000 Message-id: <3521B963898BD111AA6A006008A84516079BB7@SERVER> X-SW-Source: 1998/msg00156.html This patch supersedes the one I submitted about gas980329. It contains the two fixes that email contained, and another which fixes a bug exposed by allowing stabs to be emitted into separate sections. I've since been in contact with some other users of ELF on VxWorks (PowerPC), and they seem to have the same trouble (can't debug output from gas), so perhaps someone can help make this patch more general? Under VxWorks 5.3.1 [The Tornado 1.0.1 release] for the MIPS targets, gas cannot create a debuggable image. This occurs since the Tornado target server requires a separate .stab & .stabstr section. It cannot deal with the .mdebug ecoff section. The fix is to three things: 1: configure: accept 'mips-wrs-vxworks' as a valid configuration target 2: obj-elf.h: allow output to separate sections. The comment that was there indicated this had been removed due to an Irix 6 limitation. This may not affect any of the other ELF targets, but I cannot say for certain: it certainly does not affect the VxWorks MIPS platform. 3: cons_worker (md_flush_pending_output): only do this if not in a debugging section (otherwise we'll emit delay slots for stabs) This patch is against GAS-980418 The Changelog entries would be something like: bfd: Sun Mar 29 18:32:00 1998 Don Bowman * config.bfd: add mips*el-wrs-vxworks and mips*-wrs-vxworks gas: Sun Mar 29 18:32:00 1998 Don Bowman * configure: add mips*el-wrs-vxworks and mips*-wrs-vxworks * configure.in: add mips*el-wrs-vxworks and mips*-wrs-vxworks * obj-elf.h: allow separate stab sections and non-ecoff debugging for MIPS * acconfig.h: add MIPS_STABS_ELF as a configurable option * read.c (cons_worker): don't flush pending output if in a debugging section The following patch was generated by running: $ diff -up -r gas-980418 gas-980418.modified --------------START OF PATCH----------------- diff -r -up gas-980418/bfd/config.bfd gas-980418.modified/bfd/config.bfd --- gas-980418/bfd/config.bfd Sat Apr 18 04:16:48 1998 +++ gas-980418.modified/bfd/config.bfd Sat Apr 18 12:30:51 1998 @@ -423,11 +423,11 @@ case "${targ}" in targ_defvec=ecoff_big_vec targ_selvecs=ecoff_little_vec ;; - mips*el-*-elf*) + mips*el-*-elf* | mips*el-wrs-vxworks) targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; - mips*-*-elf* | mips*-*-rtems*) + mips*-*-elf* | mips*-*-rtems* | mips*-wrs-vxworks) targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; diff -r -up gas-980418/gas/acconfig.h gas-980418.modified/gas/acconfig.h --- gas-980418/gas/acconfig.h Sat Apr 18 04:10:23 1998 +++ gas-980418.modified/gas/acconfig.h Sat Apr 18 12:30:51 1998 @@ -77,3 +77,6 @@ /* Needed only for SCO 5. */ #undef SCO_ELF + +/* needed for non irix ELF targets */ +#undef MIPS_STABS_ELF diff -r -up gas-980418/gas/config/obj-elf.h gas-980418.modified/gas/config/obj-elf.h --- gas-980418/gas/config/obj-elf.h Sat Apr 18 04:10:35 1998 +++ gas-980418.modified/gas/config/obj-elf.h Sat Apr 18 12:30:51 1998 @@ -141,12 +141,17 @@ extern void obj_elf_init_stab_section PA #define ECOFF_DEBUGGING 1 #endif + /* For now, always set ECOFF_DEBUGGING for a MIPS target. */ #ifdef TC_MIPS +#ifdef MIPS_STABS_ELF +#define ECOFF_DEBUGGING 0 +#else #define ECOFF_DEBUGGING 1 -#endif +#endif /* MIPS_STABS_ELF */ +#endif /* TC_MIPS */ -#if ECOFF_DEBUGGING +#if (ECOFF_DEBUGGING == 1) || defined(MIPS_STABS_ELF) /* If we are generating ECOFF debugging information, we need some additional fields for each symbol. */ @@ -157,6 +162,7 @@ extern void obj_elf_init_stab_section PA struct localsym *ecoff_symbol; \ valueT ecoff_extern_size; +#ifndef MIPS_STABS_ELF /* We smuggle stabs in ECOFF rather than using a separate section. The Irix linker can not handle a separate stabs section. */ #undef SEPARATE_STAB_SECTIONS @@ -167,6 +173,7 @@ extern void obj_elf_init_stab_section PA #define OBJ_GENERATE_ASM_LINENO(filename, lineno) \ ecoff_generate_asm_lineno ((filename), (lineno)) +#endif /* MIPS_STABS_ELF */ #endif /* ECOFF_DEBUGGING */ extern void elf_frob_symbol PARAMS ((struct symbol *, int *)); diff -r -up gas-980418/gas/config.in gas-980418.modified/gas/config.in --- gas-980418/gas/config.in Sat Apr 18 04:10:24 1998 +++ gas-980418.modified/gas/config.in Sat Apr 18 12:30:52 1998 @@ -108,6 +108,9 @@ /* Needed only for SCO 5. */ #undef SCO_ELF +/* needed for non irix ELF targets */ +#undef MIPS_STABS_ELF + /* Define if you have the remove function. */ #undef HAVE_REMOVE diff -r -up gas-980418/gas/configure gas-980418.modified/gas/configure --- gas-980418/gas/configure Sat Apr 18 04:26:23 1998 +++ gas-980418.modified/gas/configure Sat Apr 18 12:30:52 1998 @@ -1559,6 +1559,11 @@ EOF mips-*-lnews*) fmt=ecoff em=lnews ;; mips-*-riscos*) fmt=ecoff ;; mips-*-sysv*) fmt=ecoff ;; + mips-*-vxworks) fmt=elf + cat >> confdefs.h <<\EOF +#define MIPS_STABS_ELF 1 +EOF +;; mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*) fmt=elf ;; mn10200-*-*) fmt=elf bfd_gas=yes ;; diff -r -up gas-980418/gas/configure.in gas-980418.modified/gas/configure.in --- gas-980418/gas/configure.in Sat Apr 18 04:26:22 1998 +++ gas-980418.modified/gas/configure.in Sat Apr 18 12:30:52 1998 @@ -230,6 +230,9 @@ changequote([,])dnl mips-*-lnews*) fmt=ecoff em=lnews ;; mips-*-riscos*) fmt=ecoff ;; mips-*-sysv*) fmt=ecoff ;; + mips-*-vxworks) fmt=elf + AC_DEFINE(MIPS_STABS_ELF) + ;; mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*) fmt=elf ;; mn10200-*-*) fmt=elf bfd_gas=yes ;; diff -r -up gas-980418/gas/read.c gas-980418.modified/gas/read.c --- gas-980418/gas/read.c Sat Apr 18 04:10:31 1998 +++ gas-980418.modified/gas/read.c Sat Apr 18 16:48:36 1998 @@ -3216,7 +3216,8 @@ cons_worker (nbytes, rva) char stopc; #ifdef md_flush_pending_output - md_flush_pending_output (); + if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_DEBUGGING) == 0) + md_flush_pending_output (); #endif if (flag_mri) diff -r -up gas-980418/ld/configure.tgt gas-980418.modified/ld/configure.tgt --- gas-980418/ld/configure.tgt Sat Apr 18 04:24:02 1998 +++ gas-980418.modified/ld/configure.tgt Sat Apr 18 12:30:52 1998 @@ -157,6 +157,7 @@ mips*vr5000el-*-elf*) targ_emul=elf32l43 mips*vr5000-*-elf*) targ_emul=elf32b4300 ;; mips*el-*-elf*) targ_emul=elf32elmip ;; mips*-*-elf*) targ_emul=elf32ebmip ;; +mips*-wrs-vxworks*) targ_emul=elf32ebmip ;; mips*-*-rtems*) targ_emul=elf32ebmip ;; mips*el-*-linux-gnu*) targ_emul=elf32lsmip targ_extra_emuls="elf32bsmip mipslit mipsbig" --------------END OF PATCH------------------ --don bowman ( don@pixsci.com 519-884-4196 x2235 )