From 4455e16773b86eebb2700b010d99df8250d9f787 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 3 Feb 2019 15:28:14 -0500 Subject: midipix target internals: provide midipix_asm_reestablish_section(). --- gcc/config/i386/midipix.c | 48 +++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/gcc/config/i386/midipix.c b/gcc/config/i386/midipix.c index 6ba5ee8b9..10ccaed2a 100644 --- a/gcc/config/i386/midipix.c +++ b/gcc/config/i386/midipix.c @@ -181,6 +181,32 @@ static void midipix_pe_create_got_entry(FILE * stream, const char * name, tree d } +static void midipix_asm_reestablish_section(FILE * asmout, section * sect) +{ + flag_got_established_section = 1; + + /* already in section? */ + if (in_section) + switch_to_section(in_section); + + /* re-establish .bss section */ + else if (sect == bss_noswitch_section) + switch_to_section(bss_section); + + /* re-establish .data section */ + else if (sect == data_section) + switch_to_section(data_section); + + /* re-establish named section */ + else if (sect) + switch_to_section(sect); + + /* re-establish .text section (default) */ + else + fputs("\t.text\n",asmout); +} + + void midipix_asm_output_got_entry( FILE * asmout, const char * name, @@ -193,26 +219,8 @@ void midipix_asm_output_got_entry( /* .got entry */ midipix_pe_create_got_entry(asmout,name,decl); - /* re-establish generic named section */ - if (in_section && in_section->common.flags & (SECTION_STYLE_MASK == SECTION_NAMED)) - targetm.asm_out.named_section( - in_section->named.name, - in_section->named.common.flags, - in_section->named.decl); - - /* re-establish .bss section */ - else if ((sect == bss_noswitch_section) || (in_section == bss_noswitch_section)) - fputs("\t.bss\n",asmout); - - /* re-establish .data section */ - else if ((sect == data_section) || (sect == data_section)) - fputs("\t.data\n",asmout); - - /* re-establish .text section (default) */ - else - fputs("\t.text\n",asmout); - - flag_got_established_section = 1; + /* re-establish current section */ + midipix_asm_reestablish_section(asmout,sect); } -- cgit v1.2.3