From 1b1487d3a6c086cb01bf4520229d58314e6a37e2 Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 8 Feb 2019 12:17:22 -0500 Subject: midipix targets: create .got entries in .dsosyms, support interposition. --- gcc/config/i386/midipix.c | 34 +++++++++++++++++++++++----------- gcc/config/i386/midipix.h | 16 +++++----------- 2 files changed, 28 insertions(+), 22 deletions(-) (limited to 'gcc') diff --git a/gcc/config/i386/midipix.c b/gcc/config/i386/midipix.c index 4b29c0917..0d81e0d25 100644 --- a/gcc/config/i386/midipix.c +++ b/gcc/config/i386/midipix.c @@ -144,23 +144,32 @@ static void midipix_pe_create_got_entry(FILE * stream, const char * name, tree d if ((visibility == VISIBILITY_PROTECTED) || (visibility == VISIBILITY_INTERNAL)) return; + /* dsostrs$... */ fputs("\n",stream); fputs(GAS_SECTION,stream); + fputs(GOTSTRS_SECTION_NAME,stream); + fputs("$",stream); + assemble_name(stream,name); + fputs(GOT_SECTION_ATTR,stream); - if (decl->decl_with_vis.weak_flag) { - fputs(GOT_SECTION_NAME,stream); - - } else if (decl->decl_with_vis.visibility == VISIBILITY_INTERNAL) { - fputs(INTERNAL_SECTION_NAME,stream); - - } else { - fputs(GOT_SECTION_NAME,stream); - } + /* .symstr_... */ + fputs("\n.symstr_",stream); + assemble_name(stream,name); + fputs(":\n\t",stream); + fputs(".ascii\t\"",stream); + assemble_name(stream,name); + fputs("\\0\"\n",stream); + fputs("\t.linkonce discard\n\n",stream); + /* dsosyms$... */ + fputs("\n",stream); + fputs(GAS_SECTION,stream); + fputs(GOTSYMS_SECTION_NAME,stream); fputs("$",stream); assemble_name(stream,name); fputs(GOT_SECTION_ATTR,stream); + /* __imp_... */ fputs("\n\t.global __imp_",stream); assemble_name(stream,name); fputs("\n__imp_",stream); @@ -169,8 +178,11 @@ static void midipix_pe_create_got_entry(FILE * stream, const char * name, tree d fputs(ptrsize,stream); fputs("\t",stream); assemble_name(stream,name); - fputs("\n",stream); - fputs("\t.linkonce discard\n\n",stream); + fputs("\n\t",stream); + fputs(ptrsize,stream); + fputs("\t.symstr_",stream); + assemble_name(stream,name); + fputs("\n\t.linkonce discard\n\n",stream); } diff --git a/gcc/config/i386/midipix.h b/gcc/config/i386/midipix.h index de9166582..f87cdc5c5 100644 --- a/gcc/config/i386/midipix.h +++ b/gcc/config/i386/midipix.h @@ -181,21 +181,15 @@ #undef RODATA_SECTION_NAME #define RODATA_SECTION_NAME ".rdata,\"r\"" -#undef GOT_SECTION_NAME -#define GOT_SECTION_NAME ".got" +#undef GOTSYMS_SECTION_NAME +#define GOTSYMS_SECTION_NAME ".dsosyms" + +#undef GOTSTRS_SECTION_NAME +#define GOTSTRS_SECTION_NAME ".gotstrs" #undef GOTREFS_SECTION_NAME #define GOTREFS_SECTION_NAME ".gotrefs" -#undef PROTECTED_SECTION_NAME -#define PROTECTED_SECTION_NAME GOT_SECTION_NAME - -#undef HIDDEN_SECTION_NAME -#define HIDDEN_SECTION_NAME ".hidden" - -#undef INTERNAL_SECTION_NAME -#define INTERNAL_SECTION_NAME ".intern" - #undef GOT_SECTION_ATTR #define GOT_SECTION_ATTR ",\"r\"" -- cgit v1.2.3