home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer) / NeXT_Developer-3.3.iso / NextDeveloper / Source / GNU / cc / config / i386 / next.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-29  |  1.3 KB  |  56 lines

  1. /* next.c:  Functions for NeXT as target machine for GNU C compiler.  */
  2.  
  3. /* Note that the include below means that we can't debug routines in
  4.    i386.c when running on a COFF system.  */
  5.  
  6. #include "i386/i386.c"
  7. #include "nextstep.c"
  8.  
  9. void
  10. machopic_output_stub (file, symb, stub)
  11.      FILE *file;
  12.      const char *symb, *stub;
  13. {
  14.   static int label = 0;
  15.   label += 1;
  16.  
  17.   if (MACHOPIC_PURE)
  18.     machopic_picsymbol_stub_section ();
  19.   else
  20.     machopic_symbol_stub_section ();
  21.  
  22.   fprintf (file, "%s:\n", stub);
  23.   fprintf (file, "\t.indirect_symbol %s\n", symb);
  24.  
  25.   if (MACHOPIC_PURE)
  26.     {
  27.       fprintf (file, "\tcall LPC$%d\nLPC$%d:\tpopl %%eax\n", label, label);
  28.       fprintf (file, "\tmovl L%s$lazy_ptr-LPC$%d(%%eax),%%edx\n", symb, label);
  29.       fprintf (file, "\tjmp %%edx\n");
  30.     }
  31.   else
  32.     {
  33.       fprintf (file, "\tjmp *L%s$lazy_ptr\n", symb);
  34.     }
  35.   
  36.   fprintf (file, "%s_binder:\n", stub);
  37.   
  38.   if (MACHOPIC_PURE)
  39.     {
  40.       fprintf (file, "\tlea L%s$lazy_ptr-LPC$%d(%%eax),%%eax\n", symb, label);
  41.       fprintf (file, "\tpushl %%eax\n");
  42.     }
  43.   else
  44.     {
  45.       fprintf (file, "\t pushl $L%s$lazy_ptr\n", symb);
  46.     }
  47.  
  48.   fprintf (file, "\tjmp dyld_stub_binding_helper\n");
  49.  
  50.   machopic_lazy_symbol_ptr_section ();
  51.   fprintf (file, "L%s$lazy_ptr:\n", symb);
  52.   fprintf (file, "\t.indirect_symbol %s\n", symb);
  53.   fprintf (file, "\t.long %s_binder\n", stub);
  54. }
  55.  
  56.