summaryrefslogtreecommitdiff
path: root/gcc/config/i386/midipix.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/i386/midipix.c')
-rw-r--r--gcc/config/i386/midipix.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/gcc/config/i386/midipix.c b/gcc/config/i386/midipix.c
index 10ccaed2a..7603d2840 100644
--- a/gcc/config/i386/midipix.c
+++ b/gcc/config/i386/midipix.c
@@ -553,3 +553,94 @@ int midipix_symbol_ref_dllimport_p(rtx symbol)
return 0;
}
+
+bool midipix_asm_assemble_integer(rtx x, unsigned int size, int aligned_p)
+{
+ bool falt;
+ int visibility;
+ rtx xref;
+ rtx xoff;
+ tree decl;
+ section * sect;
+ const char * name;
+ const char * ptrsize;
+
+ /* xref, xoff */
+ if (GET_CODE(x) == CONST) {
+ xoff = XEXP(x, 0); /* --> PLUS */
+ xref = XEXP(xoff,0); /* --> ref */
+ xoff = XEXP(xoff,1); /* --> val */
+ } else {
+ xref = x;
+ xoff = 0;
+ }
+
+ /* extern symbol ref? */
+ falt = (GET_CODE(xref) == SYMBOL_REF)
+ && ((decl = SYMBOL_REF_DECL(xref)))
+ && (DECL_P(decl))
+ && (DECL_EXTERNAL(decl))
+ && (TREE_PUBLIC(decl));
+
+ /* visibility */
+ visibility = falt && decl
+ ? (decl->decl_with_vis.visibility == VISIBILITY_DEFAULT)
+ ? default_visibility
+ : decl->decl_with_vis.visibility
+ : 0;
+
+ /* defer? */
+ if (!falt || (visibility != VISIBILITY_DEFAULT))
+ return default_assemble_integer(x,size,aligned_p);
+
+ /* name, ptrsize, sect */
+ name = XSTR(xref,0);
+
+ ptrsize = TARGET_64BIT
+ ? winnt_ptrsize_quad
+ : winnt_ptrsize_long;
+
+ sect = xoff
+ ? data_section
+ : get_variable_section(decl,false);
+
+ /* in-section mark */
+ fputs("1:\n",asm_out_file);
+
+ /* in-section address reference */
+ fputs("\t",asm_out_file);
+ fputs(ptrsize,asm_out_file);
+ fputs("\t" "0",asm_out_file);
+
+ /* array offset */
+ if (xoff && (INTVAL(xoff) < 0)) {
+ fprintf(asm_out_file,HOST_WIDE_INT_PRINT_DEC,INTVAL(xoff));
+ } else if (xoff && INTVAL(xoff)) {
+ fputs("+",asm_out_file);
+ 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 */
+ fputs("\t",asm_out_file);
+ fputs(ptrsize,asm_out_file);
+ fputs("\t" "1b" "\n",asm_out_file);
+
+ /* sym reference */
+ fputs("\t",asm_out_file);
+ fputs(ptrsize,asm_out_file);
+ fputs("\t" "__imp_",asm_out_file);
+ assemble_name(asm_out_file,name);
+ fputs("\n\n\n",asm_out_file);
+
+ /* re-establish current section */
+ midipix_asm_reestablish_section(asm_out_file,sect);
+
+ /* all done */
+ return true;
+}