home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / gnu / djgpp / src / binutils.2 / ld / ldemul.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-30  |  2.8 KB  |  160 lines

  1. /* clearing house for ld emulation states
  2. Copyright (C) 1991 Free Software Foundation, Inc.
  3.  
  4. This file is part of GLD, the Gnu Linker.
  5.  
  6. GLD is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GLD is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GLD; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #include "bfd.h"
  21. #include "sysdep.h"
  22.  
  23. #include "config.h"
  24. #include "ld.h"
  25. #include "ldemul.h"
  26. #include "ldmisc.h"
  27. #include "ldemul-list.h"
  28.  
  29. ld_emulation_xfer_type *ld_emulation;
  30. extern bfd *output_bfd;
  31. extern enum bfd_architecture ldfile_output_architecture;
  32. extern unsigned long ldfile_output_machine;
  33.  
  34. void
  35. ldemul_hll(name)
  36. char *name;
  37. {
  38.   ld_emulation->hll(name);
  39. }
  40.  
  41.  
  42. void ldemul_syslib(name)
  43. char *name;
  44. {
  45.   ld_emulation->syslib(name);
  46. }
  47.  
  48. void
  49. ldemul_after_parse()
  50. {
  51.   ld_emulation->after_parse();
  52. }
  53.  
  54. void
  55. ldemul_before_parse()
  56. {
  57.   ld_emulation->before_parse();
  58. }
  59.  
  60. void 
  61. ldemul_after_allocation()
  62. {
  63.   ld_emulation->after_allocation();
  64. }
  65.  
  66. void 
  67. ldemul_before_allocation()
  68. {
  69.   if (ld_emulation->before_allocation) {
  70.     ld_emulation->before_allocation();
  71.   }
  72. }
  73.  
  74.  
  75. void
  76. ldemul_set_output_arch()
  77. {
  78.   ld_emulation->set_output_arch();
  79. }
  80.  
  81. char *
  82. ldemul_get_script()
  83. {
  84.   return ld_emulation->get_script();
  85. }
  86.  
  87. char *
  88. ldemul_choose_target()
  89. {
  90.   return ld_emulation->choose_target();
  91. }
  92.  
  93. char *
  94. ldemul_default_target()
  95. {
  96.   char *from_outside = getenv(TARGET_ENVIRON);
  97.   if (from_outside != (char *)NULL)
  98.     return from_outside;
  99.   return ld_emulation->target_name;
  100. }
  101.  
  102. void 
  103. after_parse_default()
  104. {
  105.  
  106. }
  107.  
  108. void
  109. after_allocation_default()
  110. {
  111.  
  112. }
  113.  
  114. void
  115. before_allocation_default()
  116. {
  117.  
  118. }
  119.  
  120. void
  121. set_output_arch_default()
  122. {
  123.   /* Set the output architecture and machine if possible */
  124.   bfd_set_arch_mach(output_bfd,
  125.                 ldfile_output_architecture, ldfile_output_machine);
  126. }
  127.  
  128. void
  129. syslib_default(ignore)
  130.      char  *ignore;
  131. {
  132.   info("%S SYSLIB ignored\n");
  133. }
  134.  
  135. void
  136. hll_default(ignore)
  137.      char  *ignore;
  138. {
  139.   info("%S HLL ignored\n");
  140. }
  141.  
  142. ld_emulation_xfer_type *ld_emulations[] = { EMULATION_LIST };
  143.  
  144. void
  145. ldemul_choose_mode(target)
  146. char *target;
  147. {
  148.     ld_emulation_xfer_type **eptr = ld_emulations;
  149.     /* Ignore "gld" prefix. */
  150.     if (target[0] == 'g' && target[1] == 'l' && target[2] == 'd')
  151.     target += 3;
  152.     for (; *eptr; eptr++) {
  153.     if (strcmp(target, (*eptr)->emulation_name) == 0) {
  154.         ld_emulation = *eptr;
  155.         return;
  156.     }
  157.     }
  158.     einfo("%P%F unrecognised emulation mode: %s\n",target);
  159. }
  160.