From 53d53a0ccce9d64620df27dbec3aa58eb09d7f79 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 25 Nov 2015 08:23:47 -0500 Subject: midipix targets: GOT entries: account for a re-established section directive. signed-off by Z. Gilboa; see copying.midipix (9cd0746c) for additional information. --- gcc/config/i386/midipix.c | 9 +++++++-- gcc/config/i386/midipix.h | 3 +++ gcc/varasm.c | 11 +++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/config/i386/midipix.c b/gcc/config/i386/midipix.c index f9b6d4190..5e206f87a 100644 --- a/gcc/config/i386/midipix.c +++ b/gcc/config/i386/midipix.c @@ -33,6 +33,9 @@ #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; @@ -193,16 +196,18 @@ void midipix_asm_output_got_entry( in_section->named.decl); /* re-establish .bss section */ - else if (sect == bss_noswitch_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) + 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; } diff --git a/gcc/config/i386/midipix.h b/gcc/config/i386/midipix.h index e622c3224..925c3ad96 100644 --- a/gcc/config/i386/midipix.h +++ b/gcc/config/i386/midipix.h @@ -124,6 +124,9 @@ #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 34890b338..dcd0f8d56 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -104,6 +104,11 @@ 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 @@ -7042,7 +7047,13 @@ 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