-y support
[platform/upstream/binutils.git] / ld / h8300hms.c
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  Written by Steve Chamberlain steve@cygnus.com
21
22  The controller which tells the gnu linker how to behave like one for
23  the Hitach H8/300 with IEEE records.
24 */
25
26 #include "bfd.h"
27 #include "sysdep.h"
28
29 #include "ld.h"
30 #include "config.h"
31 #include "ldemul.h"
32 #include "ldfile.h"
33 #include "ldmisc.h"
34
35 extern  boolean lang_float_flag;
36
37
38 extern enum bfd_architecture ldfile_output_architecture;
39 extern unsigned long ldfile_output_machine;
40 extern char *ldfile_output_machine_name;
41
42 extern bfd *output_bfd;
43
44
45
46 static void h8300hms_before_parse()
47 {
48   ldfile_output_architecture = bfd_arch_h8300;
49 }
50
51
52 static void 
53 h8300hms_after_parse()
54 {
55
56 }
57
58 static void
59 h8300hms_after_allocation()
60 {
61
62 }
63
64 static void
65 h8300hms_before_allocation()
66 {
67
68 }
69
70
71 static void
72 h8300hms_set_output_arch()
73 {
74   /* Set the output architecture and machine if possible */
75   bfd_set_arch_mach(output_bfd,
76                     ldfile_output_architecture, ldfile_output_machine);
77 }
78
79 static char *
80 h8300hms_choose_target()
81 {
82   char *from_outside = getenv(TARGET_ENVIRON);
83   if (from_outside != (char *)NULL)
84     return from_outside;
85   return H8300HMS_TARGET;
86 }
87
88 static void
89 h8300hms_syslib()
90 {
91   info("%S SYSLIB ignored\n");
92 }
93
94 static void
95 h8300hms_hll(ignore)
96 char  *ignore;
97 {
98   info("%S HLL ignored\n");
99 }
100
101 static char *h8300hms_script =  
102 #include "h8300hms.x"
103 ;
104 static char *h8300hms_script_option_Ur  =  
105 #include "h8300hms.x"
106 ;
107 static char *h8300hms_script_option_r  =  
108 #include "h8300hms.x"
109 ;
110
111 static char *h8300hms_get_script()
112 {                            
113   extern ld_config_type config;
114   if (config.relocateable_output == true &&
115       config.build_constructors == true) {
116     return h8300hms_script_option_Ur;
117   }
118   if (config.relocateable_output) {
119     return h8300hms_script_option_r;
120   }
121         
122   return h8300hms_script;
123 }
124 struct ld_emulation_xfer_struct ld_h8300hms_emulation = 
125 {
126   h8300hms_before_parse,
127   h8300hms_syslib,
128   h8300hms_hll,
129   h8300hms_after_parse,
130   h8300hms_after_allocation,
131   h8300hms_set_output_arch,
132   h8300hms_choose_target,
133   h8300hms_before_allocation,
134   h8300hms_get_script,
135 };