diff options
-rw-r--r-- | gcc/config/i386/midipix.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/config/i386/midipix.c b/gcc/config/i386/midipix.c index 01f40c5a5..896e3bef2 100644 --- a/gcc/config/i386/midipix.c +++ b/gcc/config/i386/midipix.c @@ -580,6 +580,8 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p) const char * name; const char * ptrsize; const char * secname; + const char * sortname; + char namebuf[2048]; /* filter out c++ constructors */ if (flag_assume_static_linking) @@ -637,12 +639,6 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p) fprintf (asm_out_file,HOST_WIDE_INT_PRINT_DEC,INTVAL(xoff)); } - /* .gotrefs section */ - fputs("\n\n",asm_out_file); - fputs(GAS_SECTION,asm_out_file); - fputs(GOTREFS_SECTION_NAME,asm_out_file); - fputs("\n",asm_out_file); - /* back reference: section name */ if (!in_section) gcc_unreachable(); @@ -674,6 +670,24 @@ bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p) gcc_unreachable(); } + if (!(sortname = strchr(secname,'$'))) { + sortname = secname; + } else if (sortname-secname >= sizeof(namebuf)) { + gcc_unreachable(); + } else { + memcpy(namebuf,secname,sortname-secname); + namebuf[sortname-secname] = 0; + sortname = namebuf; + } + + /* .gotrefs section */ + fputs("\n\n",asm_out_file); + fputs(GAS_SECTION,asm_out_file); + fputs(GOTREFS_SECTION_NAME,asm_out_file); + fputs("$",asm_out_file); + fputs(sortname,asm_out_file); + fputs("\n",asm_out_file); + /* back reference: section rva */ fputs("\t.rva",asm_out_file); fprintf(asm_out_file,"\t%s\n",secname); |