| 1 | /* Copyright (C) 1991 Free Software Foundation, Inc. |
| 2 | |
| 3 | This file is part of GLD, the Gnu Linker. |
| 4 | |
| 5 | GLD is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 1, or (at your option) |
| 8 | any later version. |
| 9 | |
| 10 | GLD is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with GLD; see the file COPYING. If not, write to |
| 17 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 18 | |
| 19 | /* |
| 20 | * $Id$ |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * emulate the original gld running on an m68kv system |
| 25 | * |
| 26 | * Written by David Wood @ New York University |
| 27 | */ |
| 28 | |
| 29 | |
| 30 | #include "sysdep.h" |
| 31 | #include "bfd.h" |
| 32 | |
| 33 | #include "ld.h" |
| 34 | #include "config.h" |
| 35 | #include "ldemul.h" |
| 36 | #include "ldfile.h" |
| 37 | #include "ldmisc.h" |
| 38 | |
| 39 | extern boolean lang_float_flag; |
| 40 | |
| 41 | |
| 42 | extern enum bfd_architecture ldfile_output_architecture; |
| 43 | extern unsigned long ldfile_output_machine; |
| 44 | extern char *ldfile_output_machine_name; |
| 45 | |
| 46 | extern bfd *output_bfd; |
| 47 | |
| 48 | |
| 49 | |
| 50 | static void gldm68kv_before_parse() |
| 51 | { |
| 52 | #ifndef NOTDEF /* Cross developing for now */ |
| 53 | ldfile_add_library_path("/usr/triton/lib/68kgcc-lib/lib"); |
| 54 | ldfile_add_library_path("/usr/triton/lib/68kgcc-lib/usr/lib"); |
| 55 | ldfile_add_library_path("/usr/triton/lib/68kgcc-lib/usr/local/lib"); |
| 56 | #endif |
| 57 | ldfile_output_architecture = bfd_arch_m68k; |
| 58 | } |
| 59 | |
| 60 | |
| 61 | static void |
| 62 | gldm68kv_after_parse() |
| 63 | { |
| 64 | |
| 65 | } |
| 66 | |
| 67 | static void |
| 68 | gldm68kv_after_allocation() |
| 69 | { |
| 70 | |
| 71 | } |
| 72 | |
| 73 | static void |
| 74 | gldm68kv_before_allocation() |
| 75 | { |
| 76 | |
| 77 | } |
| 78 | |
| 79 | static void |
| 80 | gldm68kv_set_output_arch() |
| 81 | { |
| 82 | /* Set the output architecture and machine if possible */ |
| 83 | unsigned long machine = 0; |
| 84 | bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine); |
| 85 | } |
| 86 | |
| 87 | static char * |
| 88 | gldm68kv_choose_target() |
| 89 | { |
| 90 | char *from_outside = getenv(TARGET_ENVIRON); |
| 91 | if (from_outside != (char *)NULL) |
| 92 | return from_outside; |
| 93 | return GLDm68kv_TARGET; |
| 94 | } |
| 95 | |
| 96 | static void |
| 97 | gldm68kv_syslib() |
| 98 | { |
| 99 | info("%S SYSLIB ignored\n"); |
| 100 | } |
| 101 | |
| 102 | static void |
| 103 | gldm68kv_hll(ignore) |
| 104 | char *ignore; |
| 105 | { |
| 106 | info("%S HLL ignored\n"); |
| 107 | } |
| 108 | |
| 109 | static char *gldm68kv_script = |
| 110 | #include "ldgldm68kv.x" |
| 111 | ; |
| 112 | |
| 113 | static char *gldm68kv_script_option_Ur = |
| 114 | #include "ldgldm68kvUr.x" |
| 115 | ; |
| 116 | static char *gldm68kv_script_option_r = |
| 117 | #include "ldgldm68kvr.x" |
| 118 | ; |
| 119 | static char *gldm68kv_get_script() |
| 120 | { |
| 121 | extern ld_config_type config; |
| 122 | if (config.relocateable_output == true && |
| 123 | config.build_constructors == true) { |
| 124 | return gldm68kv_script_option_Ur; |
| 125 | } |
| 126 | if (config.relocateable_output) { |
| 127 | return gldm68kv_script_option_r; |
| 128 | } |
| 129 | |
| 130 | return gldm68kv_script; |
| 131 | } |
| 132 | struct ld_emulation_xfer_struct ld_gldm68kv_emulation = |
| 133 | { |
| 134 | gldm68kv_before_parse, |
| 135 | gldm68kv_syslib, |
| 136 | gldm68kv_hll, |
| 137 | gldm68kv_after_parse, |
| 138 | gldm68kv_after_allocation, |
| 139 | gldm68kv_set_output_arch, |
| 140 | gldm68kv_choose_target, |
| 141 | gldm68kv_before_allocation, |
| 142 | gldm68kv_get_script, |
| 143 | }; |
| 144 | |