home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / config / m68k / next.c < prev    next >
C/C++ Source or Header  |  1996-06-12  |  2KB  |  64 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.    m68k.c when running on a COFF system.  */
  5.  
  6. #include "m68k/m68k.c"
  7. #include "next/nextstep.c"
  8.  
  9. void
  10. machopic_output_stub (file, symb, stub)
  11.      FILE *file;
  12.      const char *symb, *stub;
  13. {
  14.   unsigned int length;
  15.   char *binder_name, *symbol_name, *lazy_ptr_name;
  16.  
  17.   length = strlen(stub);
  18.   binder_name = alloca(length + 32);
  19.   GEN_BINDER_NAME_FOR_STUB(binder_name, stub, length);
  20.  
  21.   length = strlen(symb);
  22.   symbol_name = alloca(length + 32);
  23.   GEN_SYMBOL_NAME_FOR_SYMBOL(symbol_name, symb, length);
  24.  
  25.   lazy_ptr_name = alloca(length + 32);
  26.   GEN_LAZY_PTR_NAME_FOR_SYMBOL(lazy_ptr_name, symb, length);
  27.  
  28.   if (MACHOPIC_PURE)
  29.     machopic_picsymbol_stub_section ();
  30.   else
  31.     machopic_symbol_stub_section ();
  32.  
  33.   fprintf (file, "%s:\n", stub);
  34.   fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
  35.  
  36.   if (MACHOPIC_PURE)
  37.     {
  38.       fprintf (file, "\tmovel pc@(%s-.),a0\n\tjmp a0@\n", lazy_ptr_name);
  39.     }
  40.   else
  41.     {
  42.       fprintf (file, "\tmovel @(%s),a0\n\tjmp a0@\n", lazy_ptr_name);
  43.     }
  44.   
  45.   fprintf (file, "%s:\n", binder_name);
  46.   
  47.   if (MACHOPIC_PURE)
  48.     {
  49.       fprintf (file, "\tpea pc@(%s-.)\n", lazy_ptr_name);
  50.     }
  51.   else
  52.     {
  53.       fprintf (file, "\tmovel #%s,sp@-\n", lazy_ptr_name);
  54.     }
  55.  
  56.   fprintf (file, "\tbra dyld_stub_binding_helper\n");
  57.  
  58.   machopic_lazy_symbol_ptr_section ();
  59.   fprintf (file, "%s:\n", lazy_ptr_name);
  60.   fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
  61.   fprintf (file, "\t.long %s\n", binder_name);
  62. }
  63.  
  64.