From: Ian Lance Taylor Date: Mon, 11 Oct 1993 21:40:10 +0000 (+0000) Subject: * write.c (write_contents): Don't crash if seginfo is NULL. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f37449aaf3d3e3f611a02a7fa7a4642cbc47e658;p=binutils-gdb.git * write.c (write_contents): Don't crash if seginfo is NULL. * config/obj-ecoff.c (ecoff_frob_file): Write out register masks by modifying .reginfo section, not by directly modifying BFD backend data. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index b278f9e5cd5..eab96694cda 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +Mon Oct 11 17:18:51 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * write.c (write_contents): Don't crash if seginfo is NULL. + + * config/obj-ecoff.c (ecoff_frob_file): Write out register masks + by modifying .reginfo section, not by directly modifying BFD + backend data. + Mon Oct 11 14:11:32 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) * config/ho-sunos.h: remove extern time declaration diff --git a/gas/config/obj-ecoff.c b/gas/config/obj-ecoff.c index 5e66e3a7d4f..9d5a913f102 100644 --- a/gas/config/obj-ecoff.c +++ b/gas/config/obj-ecoff.c @@ -4605,16 +4605,33 @@ ecoff_frob_file () #undef SET + /* Fill in the register masks. */ + { + asection *regsec; + struct ecoff_reginfo s; + + regsec = bfd_make_section (stdoutput, REGINFO); + know (regsec != NULL); + + if (bfd_get_section_contents (stdoutput, regsec, (PTR) &s, + (file_ptr) 0, sizeof s) == false) + as_fatal ("Can't read REGINFO section"); + #ifdef TC_MIPS - /* Get the MIPS register masks. It's probably not worth setting up - a generic interface for this. */ - ecoff_data (stdoutput)->gprmask = mips_gprmask; - ecoff_data (stdoutput)->cprmask[0] = mips_cprmask[0]; - ecoff_data (stdoutput)->cprmask[1] = mips_cprmask[1]; - ecoff_data (stdoutput)->cprmask[2] = mips_cprmask[2]; - ecoff_data (stdoutput)->cprmask[3] = mips_cprmask[3]; + /* Fill in the MIPS register masks. It's probably not worth + setting up a generic interface for this. */ + s.gprmask = mips_gprmask; + s.cprmask[0] = mips_cprmask[0]; + s.cprmask[1] = mips_cprmask[1]; + s.cprmask[2] = mips_cprmask[2]; + s.cprmask[3] = mips_cprmask[3]; #endif + if (bfd_set_section_contents (stdoutput, regsec, (PTR) &s, + (file_ptr) 0, sizeof s) == false) + as_fatal ("Can't write REGINFO section"); + } + ecoff_data (stdoutput)->raw_size = offset; ecoff_data (stdoutput)->raw_syments = buf; diff --git a/gas/write.c b/gas/write.c index ea0349cb31a..38771b460f5 100644 --- a/gas/write.c +++ b/gas/write.c @@ -718,7 +718,8 @@ write_contents (abfd, sec, xxx) fragS *f; /* Write out the frags. */ - if (! (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS)) + if (seginfo == NULL + || ! (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS)) return; for (f = seginfo->frchainP->frch_root;