Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
 
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
Line 33... Line 63...
33
$Date: 1998/03/17 16:54:15 $
63
$Date: 1998/03/17 16:54:15 $
34
$Revision: 1.4 $
64
$Revision: 1.4 $
35
$Log: dw2_config.c,v $
65
$Log: dw2_config.c,v $
36
 * Revision 1.4  1998/03/17  16:54:15  release
66
 * Revision 1.4  1998/03/17  16:54:15  release
37
 * Couple of minor fixes.
67
 * Couple of minor fixes.
38
 *
68
 *
39
 * Revision 1.3  1998/03/11  11:03:13  pwe
69
 * Revision 1.3  1998/03/11  11:03:13  pwe
40
 * DWARF optimisation info
70
 * DWARF optimisation info
41
 *
71
 *
42
 * Revision 1.2  1998/01/21  10:30:02  pwe
72
 * Revision 1.2  1998/01/21  10:30:02  pwe
43
 * labdiff change
73
 * labdiff change
Line 71... Line 101...
71
#include "basicread.h"
101
#include "basicread.h"
72
#include "target_v.h"
102
#include "target_v.h"
73
 
103
 
74
long dwarf_lab_num = 0;
104
long dwarf_lab_num = 0;
75
 
105
 
76
void out_string
-
 
77
    PROTO_N ( (s) )
-
 
78
    PROTO_T ( char * s )
-
 
79
{
-
 
80
  outs (".string \"");
-
 
81
  outs (s);
-
 
82
  outs ("\"");
-
 
83
  d_outnl ();
-
 
84
  return;
-
 
85
}
-
 
86
 
-
 
87
void start_string
-
 
88
    PROTO_N ( (s) )
-
 
89
    PROTO_T ( char * s )
-
 
90
{
-
 
91
  outs (".string \"");
-
 
92
  outs (s);
-
 
93
  return;
-
 
94
}
-
 
95
 
-
 
96
void end_string
-
 
97
    PROTO_Z ()
-
 
98
{
-
 
99
  outs ("\"");
-
 
100
  d_outnl ();
-
 
101
  return;
-
 
102
}
-
 
103
 
-
 
104
void enter_section
-
 
105
    PROTO_N ( (s) )
-
 
106
    PROTO_T ( char * s )
-
 
107
{
-
 
108
  outs (".section .");
-
 
109
  outs (s);
-
 
110
  d_outnl ();
-
 
111
  return;
-
 
112
}
-
 
113
 
-
 
114
void exit_section
-
 
115
    PROTO_Z ()
-
 
116
{
-
 
117
  outs (".previous");
-
 
118
  d_outnl ();
-
 
119
  return;
-
 
120
}
106
void
121
 
-
 
122
void outnl_comment
-
 
123
    PROTO_N ( (s) )
-
 
124
    PROTO_T ( char * s )
107
out_string(char *s)
125
{
108
{
126
  outs ("\t/");
109
  outs(".string \"");
127
  outs (s);
110
  outs(s);
-
 
111
  outs("\"");
128
  d_outnl ();
112
  d_outnl();
129
  return;
113
  return;
130
}
114
}
131
 
115
 
-
 
116
void
132
void outnl_comment_i
117
start_string(char *s)
-
 
118
{
133
    PROTO_N ( (s, i) )
119
  outs(".string \"");
-
 
120
  outs(s);
-
 
121
  return;
-
 
122
}
-
 
123
 
-
 
124
void
134
    PROTO_T ( char * s X long i )
125
end_string(void)
135
{
126
{
136
  outs ("\t/");
127
  outs("\"");
-
 
128
  d_outnl();
-
 
129
  return;
-
 
130
}
-
 
131
 
-
 
132
void
-
 
133
enter_section(char *s)
-
 
134
{
-
 
135
  outs(".section .");
137
  outs (s);
136
  outs(s);
-
 
137
  d_outnl();
-
 
138
  return;
-
 
139
}
-
 
140
 
-
 
141
void
-
 
142
exit_section(void)
-
 
143
{
-
 
144
  outs(".previous");
-
 
145
  d_outnl();
-
 
146
  return;
-
 
147
}
-
 
148
 
-
 
149
void
-
 
150
outnl_comment(char *s)
-
 
151
{
138
  outs (" ");
152
  outs("\t/");
139
  outn (i);
153
  outs(s);
140
  d_outnl ();
154
  d_outnl();
141
  return;
155
  return;
142
}
156
}
143
 
157
 
144
void out_dwf_label
158
void
145
    PROTO_N ( (l, set) )
159
outnl_comment_i(char *s, long i)
146
    PROTO_T ( long l X int set )
-
 
147
{
160
{
148
  if (!l)
-
 
149
    failer ("unknown label");
-
 
150
  outs (".Ldw");
161
  outs("\t/");
151
  outn (l);
162
  outs(s);
152
  if (set) {
163
  outs(" ");
153
    outs (":");
164
  outn(i);
154
    d_outnl ();
165
  d_outnl();
155
  }
-
 
156
  return;
166
  return;
157
}
167
}
158
 
168
 
159
void out_code_label
169
void
160
    PROTO_N ( (l) )
-
 
161
    PROTO_T ( long l )
170
out_dwf_label(long l, int set)
162
{
171
{
-
 
172
  if (!l) {
-
 
173
    failer("unknown label");
-
 
174
  }
163
  outs (local_prefix);
175
  outs(".Ldw");
164
  outn (l);
176
  outn(l);
-
 
177
  if (set) {
-
 
178
    outs(":");
-
 
179
    d_outnl();
-
 
180
  }
165
  return;
181
  return;
166
}
182
}
167
 
183
 
-
 
184
void
168
void out_dwf_dist_to_label
185
out_code_label(long l)
-
 
186
{
169
    PROTO_N ( (l) )
187
  outs(local_prefix);
-
 
188
  outn(l);
-
 
189
  return;
-
 
190
}
-
 
191
 
-
 
192
void
170
    PROTO_T ( long l )
193
out_dwf_dist_to_label(long l)
171
{
194
{
172
  out_dwf_label (l, 0);
195
  out_dwf_label(l, 0);
173
  outs (" - . - 4");
196
  outs(" - . - 4");
174
  return;
197
  return;
175
}
198
}
176
 
199
 
177
void out_dwf_labdiff
200
void
178
    PROTO_N ( (lo, hi) )
-
 
179
    PROTO_T ( long lo X long hi )
201
out_dwf_labdiff(long lo, long hi)
180
{
202
{
181
  if (hi == lo)
203
  if (hi == lo) {
182
    outn ((long)0);
204
    outn((long)0);
183
  else {
205
  } else {
184
    out_dwf_label (hi, 0);
206
    out_dwf_label(hi, 0);
185
    outs (" - ");
207
    outs(" - ");
186
    out_dwf_label (lo, 0);
208
    out_dwf_label(lo, 0);
187
  }
209
  }
188
  return;
210
  return;
189
}
211
}
190
 
212
 
191
void out_ext_label
213
void
192
    PROTO_N ( (s) )
-
 
193
    PROTO_T ( char * s )
214
out_ext_label(char *s)
194
{
215
{
195
  outs (".globl ");
216
  outs(".globl ");
196
  outs (s);
217
  outs(s);
197
  d_outnl ();
218
  d_outnl();
198
  outs (s);
219
  outs(s);
199
  outs(":");
220
  outs(":");
200
  d_outnl ();
221
  d_outnl();
201
  return;
222
  return;
202
}
223
}
203
 
224
 
204
void out_producer
225
void
205
    PROTO_N ( (s) )
-
 
206
    PROTO_T ( char * s )
226
out_producer(char *s)
207
{
227
{
208
  outs (".string \"");
228
  outs(".string \"");
209
  outs (s);
229
  outs(s);
210
  outs ("   with TenDRA 80x86/Solaris installer ");
230
  outs("   with TenDRA 80x86/Solaris installer ");
211
  outn ((long)target_version) ;
231
  outn((long)target_version);
212
  outs (".") ;
232
  outs(".");
213
  outn ((long)target_revision) ;
233
  outn((long)target_revision);
214
  outs ("\"");
234
  outs("\"");
215
  d_outnl ();
235
  d_outnl();
216
  return;
-
 
217
}
-
 
218
 
-
 
219
 
-
 
220
static char * first_data = NULL;
-
 
221
static char * first_ro = NULL;
-
 
222
 
-
 
223
void note_data
-
 
224
    PROTO_N ( (s) )
-
 
225
    PROTO_T ( char * s )
-
 
226
{
-
 
227
  if (!first_data)
-
 
228
    first_data = s;
-
 
229
  return;
236
  return;
230
}
237
}
-
 
238
 
-
 
239
 
-
 
240
static char *first_data = NULL;
-
 
241
static char *first_ro = NULL;
231
 
242
 
232
void note_ro
243
void
-
 
244
note_data(char *s)
-
 
245
{
-
 
246
  if (!first_data) {
233
    PROTO_N ( (s) )
247
    first_data = s;
-
 
248
  }
-
 
249
  return;
-
 
250
}
-
 
251
 
-
 
252
void
234
    PROTO_T ( char * s )
253
note_ro(char *s)
235
{
254
{
236
  if (!first_ro)
255
  if (!first_ro) {
237
    first_ro = s;
256
    first_ro = s;
-
 
257
  }
238
  return;
258
  return;
239
}
259
}
240
 
260
 
-
 
261
void
241
void dw2_data_aranges
262
dw2_data_aranges(void)
242
    PROTO_Z ()
-
 
243
{
263
{
244
  long lab_data = 0, lab_ro = 0;
264
  long lab_data = 0, lab_ro = 0;
245
  if (first_data) {
265
  if (first_data) {
246
    lab_data = next_dwarf_label ();
266
    lab_data = next_dwarf_label();
247
    if (do_prom) {
267
    if (do_prom) {
248
      outs (".bss ");
268
      outs(".bss ");
249
      out_dwf_label (lab_data, 0);
269
      out_dwf_label(lab_data, 0);
250
      outs (", 0");
270
      outs(", 0");
251
      d_outnl();
271
      d_outnl();
252
    }
-
 
253
    else {
272
    } else {
254
      outs(".data");
273
      outs(".data");
255
      d_outnl();
274
      d_outnl();
256
      out_dwf_label (lab_data, 1);
275
      out_dwf_label(lab_data, 1);
257
    }
276
    }
258
  }
277
  }
259
  if (first_ro) {
278
  if (first_ro) {
260
    lab_ro = next_dwarf_label ();
279
    lab_ro = next_dwarf_label();
261
    out_readonly_section();
280
    out_readonly_section();
262
    d_outnl();
281
    d_outnl();
263
    out_dwf_label (lab_ro, 1);
282
    out_dwf_label(lab_ro, 1);
264
  }
283
  }
265
  outs(".text");
284
  outs(".text");
266
  d_outnl();
285
  d_outnl();
267
  enter_section ("debug_aranges");
286
  enter_section("debug_aranges");
268
  if (first_data) {
287
  if (first_data) {
269
    out32 (); outs (first_data); d_outnl ();
288
    out32(); outs(first_data); d_outnl();
270
    out32 (); out_dwf_label (lab_data, 0); outs (" - ");
289
    out32(); out_dwf_label(lab_data, 0); outs(" - ");
271
	outs (first_data); d_outnl ();
290
    outs(first_data); d_outnl();
272
  }
291
  }
273
  if (first_ro) {
292
  if (first_ro) {
274
    out32 (); outs (first_ro); d_outnl ();
293
    out32(); outs(first_ro); d_outnl();
275
    out32 (); out_dwf_label (lab_ro, 0); outs (" - ");
294
    out32(); out_dwf_label(lab_ro, 0); outs(" - ");
276
	outs (first_ro); d_outnl ();
295
    outs(first_ro); d_outnl();
277
  }
296
  }
278
  exit_section ();
297
  exit_section();
279
  return;
298
  return;
280
}
299
}