From da3ab8b405378387b7551977f39383e496eb2491 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 20 Feb 2019 15:04:59 -0500 Subject: midipix targets: symbol reference optimization: use image-relative relocations. --- gcc/config/i386/midipix.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/gcc/config/i386/midipix.c b/gcc/config/i386/midipix.c index 0d81e0d25..8d17ad4bf 100644 --- a/gcc/config/i386/midipix.c +++ b/gcc/config/i386/midipix.c @@ -179,7 +179,7 @@ static void midipix_pe_create_got_entry(FILE * stream, const char * name, tree d fputs("\t",stream); assemble_name(stream,name); fputs("\n\t",stream); - fputs(ptrsize,stream); + fputs(".rva",stream); fputs("\t.symstr_",stream); assemble_name(stream,name); fputs("\n\t.linkonce discard\n\n",stream); @@ -576,6 +576,7 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p) section * sect; const char * name; const char * ptrsize; + const char * rvapad; extern int flag_constructor_decl; /* filter out c++ constructors */ @@ -610,12 +611,16 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p) if (!falt || (visibility != VISIBILITY_DEFAULT)) return default_assemble_integer(x,size,aligned_p); - /* name, ptrsize, sect */ + /* name, ptrsize, rvapad, sect */ name = XSTR(xref,0); - ptrsize = TARGET_64BIT - ? winnt_ptrsize_quad - : winnt_ptrsize_long; + if (TARGET_64BIT) { + ptrsize = winnt_ptrsize_quad; + rvapad = "\t.long 0\n"; + } else { + ptrsize = winnt_ptrsize_long; + rvapad = ""; + }; sect = xoff ? data_section @@ -646,16 +651,17 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p) fputs("\n",asm_out_file); /* back reference */ - fputs("\t",asm_out_file); - fputs(ptrsize,asm_out_file); + fputs("\t.rva",asm_out_file); fputs("\t" "1b" "\n",asm_out_file); + fputs(rvapad,asm_out_file); /* sym reference */ - fputs("\t",asm_out_file); - fputs(ptrsize,asm_out_file); + fputs("\t.rva",asm_out_file); fputs("\t" "__imp_",asm_out_file); assemble_name(asm_out_file,name); - fputs("\n\n\n",asm_out_file); + fputs("\n",asm_out_file); + fputs(rvapad,asm_out_file); + fputs("\n",asm_out_file); /* re-establish current section */ midipix_asm_reestablish_section(asm_out_file,sect); -- cgit v1.2.3