Initial revision
[deliverable/binutils-gdb.git] / ld / ld-gld.c
CommitLineData
2fa0b342
DHW
1/* Copyright (C) 1991 Free Software Foundation, Inc.
2
3This file is part of GLD, the Gnu Linker.
4
5GLD is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 1, or (at your option)
8any later version.
9
10GLD is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with GLD; see the file COPYING. If not, write to
17the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
18
19/*
20 * $Id$
21 *
2fa0b342
DHW
22*/
23
24/*
25 * emulate the original gld
26 *
27 * Written by Steve Chamberlain steve@cygnus.com
28 */
29
30
31#include "sysdep.h"
32#include "bfd.h"
33
34
35#include "ld.h"
36#include "config.h"
37#include "ld-emul.h"
38#include "ldfile.h"
39#include "ldmisc.h"
40
41extern boolean lang_float_flag;
42
43
44extern enum bfd_architecture ldfile_output_architecture;
45extern unsigned long ldfile_output_machine;
46extern char *ldfile_output_machine_name;
47
48extern bfd *output_bfd;
49
50
51
52static void gld_before_parse()
53{
54 ldfile_add_library_path("/lib");
55 ldfile_add_library_path("/usr/lib");
56 ldfile_add_library_path("/usr/local/lib/lib");
57 ldfile_output_architecture = bfd_arch_sparc;
58}
59
60
61static void
62gld_after_parse()
63{
64
65}
66
67static void
68gld_after_allocation()
69{
70
71}
72
73static void
74gld_before_allocation()
75{
76
77}
78
79
80static void
81gld_set_output_arch()
82{
83 /* Set the output architecture and machine if possible */
84 unsigned long machine = 0;
85 bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine);
86}
87
88static char *
89gld_choose_target()
90{
91 char *from_outside = getenv(TARGET_ENVIRON);
92 if (from_outside != (char *)NULL)
93 return from_outside;
94 return GLD_TARGET;
95}
96
97static void
98gld_syslib()
99{
100 info("%S SYSLIB ignored\n");
101}
102
103static void
104gld_hll(ignore)
105char *ignore;
106{
107 info("%S HLL ignored\n");
108}
109
1418c83b
SC
110static char *gld_script =
111#include "ld-gld.x"
112;
113
114static char *gld_script_option_Ur =
115#include "ld-gld-Ur.x"
116;
117
118static char *gld_script_option_r =
119#include "ld-gld-r.x"
120;
2fa0b342
DHW
121
122static char *gld_get_script()
123{
124 extern ld_config_type config;
125 if (config.relocateable_output == true &&
126 config.build_constructors == true) {
127 return gld_script_option_Ur;
128 }
129 if (config.relocateable_output) {
130 return gld_script_option_r;
131 }
132
133 return gld_script;
134}
135struct ld_emulation_xfer_struct ld_gld_emulation =
136{
137 gld_before_parse,
138 gld_syslib,
139 gld_hll,
140 gld_after_parse,
141 gld_after_allocation,
142 gld_set_output_arch,
143 gld_choose_target,
144 gld_before_allocation,
145 gld_get_script,
146};
147
This page took 0.027694 seconds and 4 git commands to generate.