From 871781804f351f162803370b2410f9f13f822bf8 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 31 May 1996 21:46:14 +0000 Subject: [PATCH] * config/tc-mips.c (md_begin): If -64, create a .MIPS.options section rather than a .reginfo section. (mips_elf_final_processing): If -64, write out 64 bit RegInfo information. --- gas/ChangeLog | 5 +++ gas/config/tc-mips.c | 94 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 78 insertions(+), 21 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 9393d2ac6e8..39aa7c3716c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,10 @@ Fri May 31 01:08:06 1996 Ian Lance Taylor + * config/tc-mips.c (md_begin): If -64, create a .MIPS.options + section rather than a .reginfo section. + (mips_elf_final_processing): If -64, write out 64 bit RegInfo + information. + * config/tc-mips.c (load_register): If mips_isa < 3, permit a 32 bit value with the high bit set. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 23df3374961..8cd996da28f 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -774,18 +774,51 @@ md_begin () seg = now_seg; subseg = now_subseg; - sec = subseg_new (".reginfo", (subsegT) 0); - /* The ABI says this section should be loaded so that the - running program can access it. */ - (void) bfd_set_section_flags (stdoutput, sec, - (SEC_ALLOC | SEC_LOAD - | SEC_READONLY | SEC_DATA)); - (void) bfd_set_section_alignment (stdoutput, sec, 2); + if (! mips_64) + { + sec = subseg_new (".reginfo", (subsegT) 0); + /* The ABI says this section should be loaded so that the + running program can access it. */ + (void) bfd_set_section_flags (stdoutput, sec, + (SEC_ALLOC | SEC_LOAD + | SEC_READONLY | SEC_DATA)); + (void) bfd_set_section_alignment (stdoutput, sec, 2); + #ifdef OBJ_ELF - mips_regmask_frag = frag_more (sizeof (Elf32_External_RegInfo)); + mips_regmask_frag = frag_more (sizeof (Elf32_External_RegInfo)); #endif + } + else + { + /* The 64-bit ABI uses a .MIPS.options section rather than + .reginfo section. */ + sec = subseg_new (".MIPS.options", (subsegT) 0); + (void) bfd_set_section_flags (stdoutput, sec, + (SEC_ALLOC | SEC_LOAD + | SEC_READONLY | SEC_DATA)); + (void) bfd_set_section_alignment (stdoutput, sec, 3); + +#ifdef OBJ_ELF + /* Set up the option header. */ + { + Elf_Internal_Options opthdr; + char *f; + + opthdr.kind = ODK_REGINFO; + opthdr.size = (sizeof (Elf_External_Options) + + sizeof (Elf64_External_RegInfo)); + opthdr.section = 0; + opthdr.info = 0; + f = frag_more (sizeof (Elf_External_Options)); + bfd_mips_elf_swap_options_out (stdoutput, &opthdr, + (Elf_External_Options *) f); + + mips_regmask_frag = frag_more (sizeof (Elf64_External_RegInfo)); + } +#endif + } if (ECOFF_DEBUGGING) { @@ -7648,19 +7681,38 @@ mips_local_label (name) void mips_elf_final_processing () { - Elf32_RegInfo s; - - /* Write out the .reginfo section. */ - 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)); + /* Write out the register information. */ + if (! mips_64) + { + 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)); + } + else + { + Elf64_Internal_RegInfo s; + + s.ri_gprmask = mips_gprmask; + s.ri_pad = 0; + 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_elf64_swap_reginfo_out (stdoutput, &s, + ((Elf64_External_RegInfo *) + mips_regmask_frag)); + } /* Set the MIPS ELF flag bits. FIXME: There should probably be some sort of BFD interface for this. */ -- 2.30.2