Make the mcore even more paranoid about section switching

This commit is contained in:
Nick Clifton 1999-06-23 09:27:09 +00:00
parent 1008451944
commit 16b93d8878
3 changed files with 75 additions and 22 deletions

View File

@ -1,3 +1,21 @@
1999-06-23 Nick Clifton <nickc@cygnus.com>
* config/tc-mcore.c (md_pseudo_table): Add .comm for ELF and allow
.section for COFF.
(mcore_s_text): Call obj_elf_text for ELF target.
(mcore_s_data): Call obj_elf_data for ELF target.
(mcore_s_section): No longer ELF specific. Call obj_coff_section
for COFF target.
(mcore_s_bss): New function: Dump literal table before changing
sections.
(mcore_s_comm): New function: Dump literal table before changing
sections.
* config/obj-elf.c (obj_elf_common, obj_elf_data, obj_elf_text):
No longer static functions.
* config/obj-elf.h (obj_elf_common, obj_elf_data, obj_elf_text):
Provide prototypes for these functions.
1999-06-22 Ian Lance Taylor <ian@zembu.com>
* subsegs.c (subseg_text_p): Rewrite non BFD_ASSEMBLER case to use

View File

@ -65,12 +65,9 @@ static void obj_elf_type PARAMS ((int));
static void obj_elf_ident PARAMS ((int));
static void obj_elf_weak PARAMS ((int));
static void obj_elf_local PARAMS ((int));
static void obj_elf_common PARAMS ((int));
static void obj_elf_symver PARAMS ((int));
static void obj_elf_vtable_inherit PARAMS ((int));
static void obj_elf_vtable_entry PARAMS ((int));
static void obj_elf_data PARAMS ((int));
static void obj_elf_text PARAMS ((int));
static void obj_elf_subsection PARAMS ((int));
static void obj_elf_popsection PARAMS ((int));
@ -256,7 +253,7 @@ elf_file_symbol (s)
#endif
}
static void
void
obj_elf_common (is_common)
int is_common;
{
@ -867,7 +864,7 @@ obj_elf_section (push)
/* Change to the .data section. */
static void
void
obj_elf_data (i)
int i;
{
@ -886,7 +883,7 @@ obj_elf_data (i)
/* Change to the .text section. */
static void
void
obj_elf_text (i)
int i;
{

View File

@ -52,10 +52,13 @@ static void dump_literals PARAMS ((int));
static void check_literals PARAMS ((int, int));
static void mcore_s_text PARAMS ((int));
static void mcore_s_data PARAMS ((int));
#ifdef OBJ_ELF
static void mcore_s_section PARAMS ((int));
static void mcore_s_bss PARAMS ((int));
#ifdef OBJ_ELF
static void mcore_s_comm PARAMS ((int));
#endif
/* Several places in this file insert raw instructions into the
object. They should use MCORE_INST_XXX macros to get the opcodes
and then use these two macros to crack the MCORE_INST value into
@ -163,7 +166,6 @@ const pseudo_typeS md_pseudo_table[] =
{ "import", s_ignore, 0 },
{ "literals", mcore_s_literals, 0 },
{ "page", listing_eject, 0 },
{ "bss", s_lcomm_bytes, 1 },
/* The following are to intercept the placement of data into the text
section (eg addresses for a switch table), so that the space they
@ -195,13 +197,15 @@ const pseudo_typeS md_pseudo_table[] =
/* Allow for the effect of section changes. */
{ "text", mcore_s_text, 0 },
{ "data", mcore_s_data, 0 },
#ifdef OBJ_ELF
{ "bss", mcore_s_bss, 1 },
#ifdef OBJ_EF
{ "comm", mcore_s_comm, 0 },
#endif
{ "section", mcore_s_section, 0 },
{ "section.s", mcore_s_section, 0 },
{ "sect", mcore_s_section, 0 },
{ "sect.s", mcore_s_section, 0 },
#endif
{ 0, 0, 0 }
};
@ -302,13 +306,20 @@ mcore_stringer (append_zero)
check_literals (2, 0);
}
/* Handle the section changing pseudo-ops. These call through to the
normal implementations, but they dump the literal pool first. */
static void
mcore_s_text (ignore)
int ignore;
{
dump_literals (0);
#ifdef OBJ_ELF
obj_elf_text (ignore);
#else
s_text (ignore);
#endif
}
static void
@ -317,9 +328,47 @@ mcore_s_data (ignore)
{
dump_literals (0);
#ifdef OBJ_ELF
obj_elf_data (ignore);
#else
s_data (ignore);
#endif
}
static void
mcore_s_section (ignore)
int ignore;
{
dump_literals (0);
#ifdef OBJ_ELF
obj_elf_section (ignore);
#endif
#ifdef OBJ_COFF
obj_coff_section (ignore);
#endif
}
static void
mcore_s_bss (needs_align)
int needs_align;
{
dump_literals (0);
s_lcomm_bytes (needs_align);
}
#ifdef OBJ_ELF
static void
mcore_s_comm (needs_align)
int needs_align;
{
dump_literals (0);
obj_elf_common (needs_align);
}
#endif
/* This function is called once, at assembler startup time. This should
set up all the tables, etc that the MD part of the assembler needs. */
void
@ -2169,15 +2218,4 @@ mcore_fix_adjustable (fixP)
return 1;
}
/* Handle the .section pseudo-op. This is like the usual one, but it
dumps the literal pool before changing the section. */
static void
mcore_s_section (ignore)
int ignore;
{
dump_literals (0);
obj_elf_section (ignore);
}
#endif /* OBJ_ELF */