This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Gas segfaults when --emulation=mipsecoff is used


Hi,

 When trying to assemble using --emulation=mipsecoff with an ELF/ECOFF
MIPS assembler one might expect a segfault.  This is because some
functions are null pointers for ECOFF but they are called because for ELF
they would be valid.

 The following patch solves the problem for me.  Actually, S_SET_SIZE
reference could alternatively be removed from ecoff.c but I guess it was
put there for a reason (future expansion?).  Otherwise, it's only used by
ELF routines.

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

Mon Oct 11 1999  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>

        * config/obj-multi.h (obj_frob_file_after_relocs): Only
        call this_format->frob_file_after_relocs if non-NULL.
        (S_SET_SIZE): Only call this_format->s_set_size if
        non-NULL.

diff -u --recursive --new-file binutils.macro/gas/config/obj-multi.h binutils/gas/config/obj-multi.h
--- binutils.macro/gas/config/obj-multi.h	Fri Sep 24 14:10:22 1999
+++ binutils/gas/config/obj-multi.h	Fri Oct  8 13:43:09 1999
@@ -14,8 +14,10 @@
 	 ? this_format->frob_file ()			\
 	 : (void) 0)
 
-#define obj_frob_file_after_relocs			\
-	(this_format->frob_file_after_relocs)
+#define obj_frob_file_after_relocs()			\
+	(this_format->frob_file_after_relocs		\
+	 ? this_format->frob_file_after_relocs ()	\
+	 : (void) 0)
 
 #define obj_ecoff_set_ext				\
 	(this_format->ecoff_set_ext)
@@ -37,8 +39,10 @@
 #define S_GET_SIZE					\
 	(this_format->s_get_size)
 
-#define S_SET_SIZE					\
-	(this_format->s_set_size)
+#define S_SET_SIZE(sym,sz)				\
+	(this_format->s_set_size			\
+	 ? this_format->s_set_size (sym, sz)		\
+	 : (void) 0)
 
 #define S_GET_ALIGN					\
 	(this_format->s_get_align)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]