]> Git Repo - binutils.git/blob - ld/gld960.em
tooldir copy of ld belongs directly in tooldir
[binutils.git] / ld / gld960.em
1 cat >ld__${EMULATION_NAME}.c <<EOF
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 1, 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 /* 
21  * emulate the Intels port of  gld
22  */
23
24
25 #include "bfd.h"
26 #include "sysdep.h"
27
28
29 #include "ld.h"
30 #include "config.h"
31 #include "ldemul.h"
32 #include "ldfile.h"
33 #include "ldmisc.h"
34
35
36 /* IMPORTS */
37 extern char *output_filename;
38 extern  boolean lang_float_flag;
39
40
41 extern enum bfd_architecture ldfile_output_architecture;
42 extern unsigned long ldfile_output_machine;
43 extern char *ldfile_output_machine_name;
44
45 extern bfd *output_bfd;
46
47
48
49 #ifdef GNU960
50
51 static void
52 gld960_before_parse()
53 {
54   static char *env_variables[] = { "G960LIB", "G960BASE", 0 };
55   char **p;
56   char *env ;
57
58   for ( p = env_variables; *p; p++ ){
59     env =  (char *) getenv(*p);
60     if (env) {
61       ldfile_add_library_path(concat(env,"/lib/libbout",""));
62     }
63   }
64   ldfile_output_architecture = bfd_arch_i960;
65 }
66
67 #else   /* not GNU960 */
68
69 static void gld960_before_parse()
70 {
71   char *env ;
72   env =  getenv("G960LIB");
73   if (env) {
74     ldfile_add_library_path(env);
75   }
76   env = getenv("G960BASE");
77   if (env) {
78     ldfile_add_library_path(concat(env,"/lib",""));
79   }
80   ldfile_output_architecture = bfd_arch_i960;
81 }
82
83 #endif  /* GNU960 */
84
85
86 static void
87 gld960_set_output_arch()
88 {
89   bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core);
90 }
91
92 static char *
93 gld960_choose_target()
94 {
95 #ifdef GNU960
96
97   output_filename = "b.out";
98   return bfd_make_targ_name(BFD_BOUT_FORMAT, 0);
99
100 #else
101
102   char *from_outside = getenv(TARGET_ENVIRON);
103   output_filename = "b.out";
104
105   if (from_outside != (char *)NULL)
106     return from_outside;
107   return "b.out.big";
108
109 #endif
110 }
111
112 static char *script = 
113 #include "gld960.x"
114 ;
115
116   
117 static char *script_reloc =
118 #include "gld960.xr"
119  ;
120
121
122 static char *
123 gld960_get_script()
124 {
125    extern ld_config_type config;
126    if (config.relocateable_output)
127      return script_reloc;
128    return script;
129
130 }
131
132 struct ld_emulation_xfer_struct ld_gld960_emulation = 
133 {
134   gld960_before_parse,
135   syslib_default,
136   hll_default,
137   after_parse_default,
138   after_allocation_default,
139   gld960_set_output_arch,
140   gld960_choose_target,
141   before_allocation_default,
142   gld960_get_script,
143   "960",
144   ""
145 };
146 EOF
This page took 0.032428 seconds and 4 git commands to generate.