Strange link script support
[platform/upstream/binutils.git] / ld / mri.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 /* This bit does the tree decoration when MRI style link scripts are parsed */
21
22 /*
23   contributed by Steve Chamberlain
24                  sac@cygnus.com
25
26 */
27
28 #include "bfd.h"
29 #include "sysdep.h" 
30 #include "ldlang.h"
31 #include "mri.h"
32 #include "ldexp.h"
33
34 void
35 DEFUN(mri_output_section, (name, vma),
36       CONST char *name AND
37       etree_type *vma)
38
39 {
40   lang_output_section_statement_type *os;
41
42   os =  lang_output_section_statement_lookup(name);
43
44   if (os->addr_tree == (etree_type *)NULL) {
45     os->addr_tree = vma;
46   }
47
48   os->flags = 0;
49   os->block_value = 0;
50 }
51
52 /* if any ABSOLUTE <name> are in the script, only load those files
53 marked thus */
54
55 void DEFUN(mri_only_load,(name), CONST char *name)
56 {
57   lang_output_section_statement_type *os;
58
59   os =  lang_output_section_statement_lookup(name);
60
61   os->flags = 0;
62   os->block_value = 0;
63
64 }
65
66
67 void
68 DEFUN(mri_load,(name), 
69       CONST char *name)
70 {
71
72   lang_add_input_file(name, lang_input_file_is_file_enum, (char *)NULL);
73 }
74
75
76 void
77 DEFUN(mri_order,(name),
78       CONST char *name)
79 {
80 einfo("Ignoring ORDER %s for the moment\n", name);
81
82 }
83
84 void 
85 DEFUN(mri_name,(name),
86       CONST char *name)
87 {
88   lang_add_output(name);
89
90 }
91
92
93 void
94 DEFUN(mri_format,(name),
95       CONST char *name)
96 {
97   if (strcmp(name, "S") == 0)
98   {
99     lang_add_output_format("srec");
100   }
101   else if (strcmp(name, "IEEE") == 0)
102   {
103     lang_add_output_format("ieee");
104   }
105   else {
106     einfo("%P%F: unknown format type %s\n", name);
107   }
108 }