Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
7 7u83 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
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
33
 
34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
42
 
43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
45
 
46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
49
 
50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
53
 
54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
/**********************************************************************
62
$Author: release $
63
$Date: 1998/03/17 16:54:15 $
64
$Revision: 1.4 $
65
$Log: dw2_config.c,v $
66
 * Revision 1.4  1998/03/17  16:54:15  release
67
 * Couple of minor fixes.
68
 *
69
 * Revision 1.3  1998/03/11  11:03:13  pwe
70
 * DWARF optimisation info
71
 *
72
 * Revision 1.2  1998/01/21  10:30:02  pwe
73
 * labdiff change
74
 *
75
 * Revision 1.1.1.1  1998/01/17  15:55:52  release
76
 * First version to be checked into rolling release.
77
 *
78
 * Revision 1.6  1998/01/09  14:47:55  pwe
79
 * prep restructure
80
 *
81
 * Revision 1.5  1997/12/04  20:01:30  pwe
82
 * ANDF-DE V1.9
83
 *
84
 * Revision 1.4  1997/10/23  09:37:29  pwe
85
 * extra_diags
86
 *
87
 * Revision 1.3  1997/10/10  18:26:02  pwe
88
 * prep ANDF-DE revision
89
 *
90
 * Revision 1.2  1997/03/24  11:15:46  pwe
91
 * dwarf2 option/default
92
 *
93
 * Revision 1.1  1997/03/20  16:24:39  pwe
94
 * dwarf2
95
 *
96
**********************************************************************/
97
 
98
#include "dw2_config.h"
99
#include "flags.h"
100
#include "machine.h"
101
#include "basicread.h"
102
#include "target_v.h"
103
 
104
long dwarf_lab_num = 0;
105
 
7 7u83 106
void
107
out_string(char *s)
2 7u83 108
{
7 7u83 109
  outs(".string \"");
110
  outs(s);
111
  outs("\"");
112
  d_outnl();
2 7u83 113
  return;
114
}
115
 
7 7u83 116
void
117
start_string(char *s)
2 7u83 118
{
7 7u83 119
  outs(".string \"");
120
  outs(s);
2 7u83 121
  return;
122
}
123
 
7 7u83 124
void
125
end_string(void)
2 7u83 126
{
7 7u83 127
  outs("\"");
128
  d_outnl();
2 7u83 129
  return;
130
}
131
 
7 7u83 132
void
133
enter_section(char *s)
2 7u83 134
{
7 7u83 135
  outs(".section .");
136
  outs(s);
137
  d_outnl();
2 7u83 138
  return;
139
}
140
 
7 7u83 141
void
142
exit_section(void)
2 7u83 143
{
7 7u83 144
  outs(".previous");
145
  d_outnl();
2 7u83 146
  return;
147
}
148
 
7 7u83 149
void
150
outnl_comment(char *s)
2 7u83 151
{
7 7u83 152
  outs("\t/");
153
  outs(s);
154
  d_outnl();
2 7u83 155
  return;
156
}
157
 
7 7u83 158
void
159
outnl_comment_i(char *s, long i)
2 7u83 160
{
7 7u83 161
  outs("\t/");
162
  outs(s);
163
  outs(" ");
164
  outn(i);
165
  d_outnl();
2 7u83 166
  return;
167
}
168
 
7 7u83 169
void
170
out_dwf_label(long l, int set)
2 7u83 171
{
7 7u83 172
  if (!l) {
173
    failer("unknown label");
174
  }
175
  outs(".Ldw");
176
  outn(l);
2 7u83 177
  if (set) {
7 7u83 178
    outs(":");
179
    d_outnl();
2 7u83 180
  }
181
  return;
182
}
183
 
7 7u83 184
void
185
out_code_label(long l)
2 7u83 186
{
7 7u83 187
  outs(local_prefix);
188
  outn(l);
2 7u83 189
  return;
190
}
191
 
7 7u83 192
void
193
out_dwf_dist_to_label(long l)
2 7u83 194
{
7 7u83 195
  out_dwf_label(l, 0);
196
  outs(" - . - 4");
2 7u83 197
  return;
198
}
199
 
7 7u83 200
void
201
out_dwf_labdiff(long lo, long hi)
2 7u83 202
{
7 7u83 203
  if (hi == lo) {
204
    outn((long)0);
205
  } else {
206
    out_dwf_label(hi, 0);
207
    outs(" - ");
208
    out_dwf_label(lo, 0);
2 7u83 209
  }
210
  return;
211
}
212
 
7 7u83 213
void
214
out_ext_label(char *s)
2 7u83 215
{
7 7u83 216
  outs(".globl ");
217
  outs(s);
218
  d_outnl();
219
  outs(s);
2 7u83 220
  outs(":");
7 7u83 221
  d_outnl();
2 7u83 222
  return;
223
}
224
 
7 7u83 225
void
226
out_producer(char *s)
2 7u83 227
{
7 7u83 228
  outs(".string \"");
229
  outs(s);
230
  outs("   with TenDRA 80x86/Solaris installer ");
231
  outn((long)target_version);
232
  outs(".");
233
  outn((long)target_revision);
234
  outs("\"");
235
  d_outnl();
2 7u83 236
  return;
237
}
238
 
239
 
7 7u83 240
static char *first_data = NULL;
241
static char *first_ro = NULL;
2 7u83 242
 
7 7u83 243
void
244
note_data(char *s)
2 7u83 245
{
7 7u83 246
  if (!first_data) {
2 7u83 247
    first_data = s;
7 7u83 248
  }
2 7u83 249
  return;
250
}
251
 
7 7u83 252
void
253
note_ro(char *s)
2 7u83 254
{
7 7u83 255
  if (!first_ro) {
2 7u83 256
    first_ro = s;
7 7u83 257
  }
2 7u83 258
  return;
259
}
260
 
7 7u83 261
void
262
dw2_data_aranges(void)
2 7u83 263
{
264
  long lab_data = 0, lab_ro = 0;
265
  if (first_data) {
7 7u83 266
    lab_data = next_dwarf_label();
2 7u83 267
    if (do_prom) {
7 7u83 268
      outs(".bss ");
269
      out_dwf_label(lab_data, 0);
270
      outs(", 0");
2 7u83 271
      d_outnl();
7 7u83 272
    } else {
2 7u83 273
      outs(".data");
274
      d_outnl();
7 7u83 275
      out_dwf_label(lab_data, 1);
2 7u83 276
    }
277
  }
278
  if (first_ro) {
7 7u83 279
    lab_ro = next_dwarf_label();
2 7u83 280
    out_readonly_section();
281
    d_outnl();
7 7u83 282
    out_dwf_label(lab_ro, 1);
2 7u83 283
  }
284
  outs(".text");
285
  d_outnl();
7 7u83 286
  enter_section("debug_aranges");
2 7u83 287
  if (first_data) {
7 7u83 288
    out32(); outs(first_data); d_outnl();
289
    out32(); out_dwf_label(lab_data, 0); outs(" - ");
290
    outs(first_data); d_outnl();
2 7u83 291
  }
292
  if (first_ro) {
7 7u83 293
    out32(); outs(first_ro); d_outnl();
294
    out32(); out_dwf_label(lab_ro, 0); outs(" - ");
295
    outs(first_ro); d_outnl();
2 7u83 296
  }
7 7u83 297
  exit_section();
2 7u83 298
  return;
299
}