From 13e4ec00bfb4c07ecf06ba9c2e7462a0dc98b3d8 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 5 Feb 2019 03:01:23 -0500 Subject: midipix_asm_reestablish_section(): better integrate with gcc's varasm logic. --- gcc/config/i386/midipix.c | 22 ++++++++++++++-------- gcc/config/i386/midipix.h | 3 --- gcc/varasm.c | 11 ----------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/gcc/config/i386/midipix.c b/gcc/config/i386/midipix.c index 9e381124a..10d83f801 100644 --- a/gcc/config/i386/midipix.c +++ b/gcc/config/i386/midipix.c @@ -33,9 +33,6 @@ #include "function.h" #include "cgraph.h" -/* got support */ -int flag_got_established_section = 0; - /* common specs */ const int TARGET_NOP_FUN_DLLIMPORT = 0; const int use_pe_aligned_common = 1; @@ -179,11 +176,14 @@ 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; + section * tree_section; + + tree_section = in_section; + in_section = 0; /* already in section? */ - if (in_section) - switch_to_section(in_section); + if (tree_section) + switch_to_section(tree_section); /* re-establish .bss section */ else if (sect == bss_noswitch_section) @@ -193,7 +193,11 @@ static void midipix_asm_reestablish_section(FILE * asmout, section * sect) else if (sect == data_section) switch_to_section(data_section); - /* re-establish named section */ + /* no-switch section */ + else if (sect && (sect->common.flags & SECTION_NOSWITCH)) + (void)0; + + /* re-establish generic section */ else if (sect) switch_to_section(sect); @@ -598,7 +602,9 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p) sect = xoff ? data_section - : get_variable_section(decl,false); + : in_section + ? get_variable_section(decl,false) + : 0; /* in-section mark */ fputs("1:\n",asm_out_file); diff --git a/gcc/config/i386/midipix.h b/gcc/config/i386/midipix.h index 304735a20..de9166582 100644 --- a/gcc/config/i386/midipix.h +++ b/gcc/config/i386/midipix.h @@ -124,9 +124,6 @@ #undef TARGET_PECOFF #define TARGET_PECOFF (1) -#undef TARGET_ASSEMBLY_GOT_ENTRIES -#define TARGET_ASSEMBLY_GOT_ENTRIES (1) - #undef HAS_INIT_SECTION #define HAS_INIT_SECTION (1) diff --git a/gcc/varasm.c b/gcc/varasm.c index dcd0f8d56..34890b338 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -104,11 +104,6 @@ static alias_set_type const_alias_set; static bool saw_no_split_stack; - -#ifdef TARGET_ASSEMBLY_GOT_ENTRIES -extern int flag_got_established_section; -#endif - static const char *strip_reg_name (const char *); static int contains_pointers_p (tree); #ifdef ASM_OUTPUT_EXTERNAL @@ -7047,13 +7042,7 @@ output_section_asm_op (const void *directive) void switch_to_section (section *new_section) { -#ifdef TARGET_ASSEMBLY_GOT_ENTRIES - if (flag_got_established_section) - flag_got_established_section = 0; - else if (in_section == new_section) -#else if (in_section == new_section) -#endif return; if (new_section->common.flags & SECTION_FORGET) -- cgit v1.2.3