From f2a663d3a34f7daa3d9a357f0c7e3bbb97fa7d74 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 12 Oct 1993 21:31:29 +0000 Subject: [PATCH] * config/tc-mips.c: If OBJ_ELF, include elf/mips.h. (mips_regmask_frag): New static variable, if OBJ_ELF. (md_begin): If OBJ_ELF, create .reginfo section and set mips_regmask_frag to a frag. (mips_elf_final_processing): New function, if OBJ_ELF. Set mips_regmask_frag to register mask information. * config/tc-mips.h (elf_tc_final_processing): New macro, defined if OBJ_ELF. --- gas/ChangeLog | 11 ++++++++++ gas/config/tc-mips.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/gas/ChangeLog b/gas/ChangeLog index 46d211f5d5d..7d8ea713e28 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,14 @@ +Tue Oct 12 17:26:15 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * config/tc-mips.c: If OBJ_ELF, include elf/mips.h. + (mips_regmask_frag): New static variable, if OBJ_ELF. + (md_begin): If OBJ_ELF, create .reginfo section and set + mips_regmask_frag to a frag. + (mips_elf_final_processing): New function, if OBJ_ELF. Set + mips_regmask_frag to register mask information. + * config/tc-mips.h (elf_tc_final_processing): New macro, defined + if OBJ_ELF. + Tue Oct 12 03:33:26 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) * messages.c (as_fatal): Use myname when printing messages. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index e03a4bc30ca..31af840985d 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -42,6 +42,12 @@ #include "opcode/mips.h" +#ifdef OBJ_ELF +#include "elf/mips.h" + +static char *mips_regmask_frag; +#endif + #define AT 1 #define GP 28 #define RA 31 @@ -389,6 +395,28 @@ md_begin () bfd_set_gp_size (stdoutput, g_switch_value); #endif +#ifdef OBJ_ELF + /* Create a .reginfo section for register masks. */ + { + segT seg; + subsegT subseg; + segT regsec; + + seg = now_seg; + subseg = now_subseg; + regsec = subseg_new (".reginfo", (subsegT) 0); + + /* I don't know why this section should be loaded, but the ABI + says that SHF_ALLOC should be set. */ + bfd_set_section_flags (stdoutput, regsec, + SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA); + + mips_regmask_frag = frag_more (sizeof (Elf32_External_RegInfo)); + + subseg_set (seg, subseg); + } +#endif /* OBJ_ELF */ + #ifndef OBJ_ECOFF md_obj_begin (); #endif @@ -4441,6 +4469,29 @@ mips_define_label (sym) insn_label = sym; } +#ifdef OBJ_ELF + +/* Write out the .reginfo section for a MIPS ELF file. */ + +void +mips_elf_final_processing () +{ + Elf32_RegInfo s; + + s.ri_gprmask = mips_gprmask; + s.ri_cprmask[0] = mips_cprmask[0]; + s.ri_cprmask[1] = mips_cprmask[1]; + s.ri_cprmask[2] = mips_cprmask[2]; + s.ri_cprmask[3] = mips_cprmask[3]; + /* The gp_value field is set by the MIPS ELF backend. */ + + bfd_mips_elf32_swap_reginfo_out (stdoutput, &s, + ((Elf32_External_RegInfo *) + mips_regmask_frag)); +} + +#endif /* OBJ_ELF */ + #ifndef OBJ_ECOFF /* These functions should really be defined by the object file format, -- 2.30.2