OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [alpha/] [vms-ld.c] - Blame information for rev 247

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* VMS linker wrapper.
2
   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2007
3
   Free Software Foundation, Inc.
4
   Contributed by Douglas B. Rupp (rupp@gnat.com).
5
 
6
This file is part of GCC.
7
 
8
GCC is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3, or (at your option)
11
any later version.
12
 
13
GCC is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with GCC; see the file COPYING3.  If not see
20
<http://www.gnu.org/licenses/>.  */
21
 
22
/* This program is a wrapper around the VMS linker.
23
   It translates Unix style command line options into corresponding
24
   VMS style qualifiers and then spawns the VMS linker.  */
25
 
26
#include "config.h"
27
#include "system.h"
28
#include "coretypes.h"
29
#include "tm.h"
30
 
31
typedef struct dsc {unsigned short len, mbz; char *adr; } Descr;
32
 
33
#undef PATH_SEPARATOR
34
#undef PATH_SEPARATOR_STR
35
#define PATH_SEPARATOR ','
36
#define PATH_SEPARATOR_STR ","
37
 
38
/* Local variable declarations.  */
39
 
40
/* File specification for vms-dwarf2.o.  */
41
static char *vmsdwarf2spec = 0;
42
 
43
/* File specification for vms-dwarf2eh.o.  */
44
static char *vmsdwarf2ehspec = 0;
45
 
46
/* verbose = 1 if -v passed.  */
47
static int verbose = 0;
48
 
49
/* save_temps = 1 if -save-temps passed.  */
50
static int save_temps = 0;
51
 
52
/* By default don't generate executable file if there are errors
53
   in the link. Override with --noinhibit-exec.  */
54
static int inhibit_exec = 1;
55
 
56
/* debug = 1 if -g passed.  */
57
static int debug = 0;
58
 
59
/* By default prefer to link with shareable image libraries.
60
   Override with -static.  */
61
static int staticp = 0;
62
 
63
/* By default generate an executable, not a shareable image library.
64
   Override with -shared.  */
65
static int share = 0;
66
 
67
/* Remember if IDENTIFICATION given on command line.  */
68
static int ident = 0;
69
 
70
/* Keep track of arg translations.  */
71
static int link_arg_max = -1;
72
static const char **link_args = 0;
73
static int link_arg_index = -1;
74
 
75
/* Keep track of filenames */
76
static char optfilefullname [267];
77
static char *sharefilename = 0;
78
static char *exefilename = 0;
79
 
80
/* System search dir list. Leave blank since link handles this
81
   internally.  */
82
static char *system_search_dirs = "";
83
 
84
/* Search dir list passed on command line (with -L).  */
85
static char *search_dirs;
86
 
87
/* Local function declarations.  */
88
 
89
/* Add STR to the list of arguments to pass to the linker. Expand the list as
90
   necessary to accommodate.  */
91
static void addarg (const char *);
92
 
93
/* Check to see if NAME is a regular file, i.e. not a directory */
94
static int is_regular_file (char *);
95
 
96
/* Translate a Unix syntax file specification FILESPEC into VMS syntax.
97
   If indicators of VMS syntax found, return input string.  */
98
static char *to_host_file_spec (char *);
99
 
100
/* Locate the library named LIB_NAME in the set of paths PATH_VAL.  */
101
static char *locate_lib (char *, char *);
102
 
103
/* Given a library name NAME, i.e. foo,  Look for libfoo.lib and then
104
   libfoo.a in the set of directories we are allowed to search in.  */
105
static const char *expand_lib (char *);
106
 
107
/* Preprocess the number of args P_ARGC in ARGV.
108
   Look for special flags, etc. that must be handled first.  */
109
static void preprocess_args (int *, char **);
110
 
111
/* Preprocess the number of args P_ARGC in ARGV.  Look for
112
   special flags, etc. that must be handled for the VMS linker.  */
113
static void process_args (int *, char **);
114
 
115
/* Action routine called by decc$to_vms. NAME is a file name or
116
   directory name. TYPE is unused.  */
117
static int translate_unix (char *, int);
118
 
119
int main (int, char **);
120
 
121
static void
122
addarg (const char *str)
123
{
124
  int i;
125
 
126
  if (++link_arg_index >= link_arg_max)
127
    {
128
      const char **new_link_args
129
        = (const char **) xcalloc (link_arg_max + 1000, sizeof (char *));
130
 
131
      for (i = 0; i <= link_arg_max; i++)
132
        new_link_args [i] = link_args [i];
133
 
134
      if (link_args)
135
        free (link_args);
136
 
137
      link_arg_max += 1000;
138
      link_args = new_link_args;
139
    }
140
 
141
  link_args [link_arg_index] = str;
142
}
143
 
144
static char *
145
locate_lib (char *lib_name, char *path_val)
146
{
147
  int lib_len = strlen (lib_name);
148
  char *eptr, *sptr;
149
 
150
  for (sptr = path_val; *sptr; sptr = eptr)
151
    {
152
      char *buf, *ptr;
153
 
154
      while (*sptr == PATH_SEPARATOR)
155
        sptr ++;
156
 
157
      eptr = strchr (sptr, PATH_SEPARATOR);
158
      if (eptr == 0)
159
        eptr = strchr (sptr, 0);
160
 
161
      buf = alloca ((eptr-sptr) + lib_len + 4 + 2);
162
      strncpy (buf, sptr, eptr-sptr);
163
      buf [eptr-sptr] = 0;
164
      strcat (buf, "/");
165
      strcat (buf, lib_name);
166
      ptr = strchr (buf, 0);
167
 
168
      if (debug || staticp)
169
        {
170
          /* For debug or static links, look for shareable image libraries
171
             last.  */
172
          strcpy (ptr, ".a");
173
          if (is_regular_file (buf))
174
            return xstrdup (to_host_file_spec (buf));
175
 
176
          strcpy (ptr, ".olb");
177
          if (is_regular_file (buf))
178
            return xstrdup (to_host_file_spec (buf));
179
 
180
          strcpy (ptr, ".exe");
181
          if (is_regular_file (buf))
182
            return xstrdup (to_host_file_spec (buf));
183
        }
184
      else
185
        {
186
          /* Otherwise look for shareable image libraries first.  */
187
          strcpy (ptr, ".exe");
188
          if (is_regular_file (buf))
189
            return xstrdup (to_host_file_spec (buf));
190
 
191
          strcpy (ptr, ".a");
192
          if (is_regular_file (buf))
193
            return xstrdup (to_host_file_spec (buf));
194
 
195
          strcpy (ptr, ".olb");
196
          if (is_regular_file (buf))
197
            return xstrdup (to_host_file_spec (buf));
198
        }
199
    }
200
 
201
  return 0;
202
}
203
 
204
static const char *
205
expand_lib (char *name)
206
{
207
  char *lib, *lib_path;
208
 
209
  if (strcmp (name, "c") == 0)
210
    /* IEEE VAX C compatible library for non-prefixed (e.g. no DECC$)
211
       C RTL functions.  */
212
    return "sys$library:vaxcrtltx.olb";
213
 
214
  else if (strcmp (name, "m") == 0)
215
    /* No separate library for math functions */
216
    return "";
217
 
218
  else
219
    {
220
      lib = xmalloc (strlen (name) + 14);
221
 
222
      strcpy (lib, "lib");
223
      strcat (lib, name);
224
      lib_path = locate_lib (lib, search_dirs);
225
 
226
      if (lib_path)
227
        return lib_path;
228
    }
229
 
230
  fprintf (stderr,
231
           "Couldn't locate library: lib%s.exe, lib%s.a or lib%s.olb\n",
232
           name, name, name);
233
 
234
  exit (1);
235
}
236
 
237
static int
238
is_regular_file (char *name)
239
{
240
  int ret;
241
  struct stat statbuf;
242
 
243
  ret = stat (name, &statbuf);
244
  return !ret && S_ISREG (statbuf.st_mode);
245
}
246
 
247
static void
248
preprocess_args (int *p_argc, char **argv)
249
{
250
  int i;
251
 
252
  for (i = 1; i < *p_argc; i++)
253
    if (strlen (argv[i]) >= 6 && strncmp (argv[i], "-shared", 7) == 0)
254
      share = 1;
255
 
256
  for (i = 1; i < *p_argc; i++)
257
    if (strcmp (argv[i], "-o") == 0)
258
      {
259
        char *buff, *ptr;
260
        int out_len;
261
        int len;
262
 
263
        i++;
264
        ptr = to_host_file_spec (argv[i]);
265
        exefilename = xstrdup (ptr);
266
        out_len = strlen (ptr);
267
        buff = xmalloc (out_len + 18);
268
 
269
        if (share)
270
          strcpy (buff, "/share=");
271
        else
272
          strcpy (buff, "/exe=");
273
 
274
        strcat (buff, ptr);
275
        addarg (buff);
276
 
277
        if (share)
278
          {
279
            sharefilename = xmalloc (out_len+5);
280
            if (ptr == strchr (argv[i], ']'))
281
              strcpy (sharefilename, ++ptr);
282
            else if (ptr == strchr (argv[i], ':'))
283
              strcpy (sharefilename, ++ptr);
284
            else if (ptr == strrchr (argv[i], '/'))
285
              strcpy (sharefilename, ++ptr);
286
            else
287
              strcpy (sharefilename, argv[i]);
288
 
289
            len = strlen (sharefilename);
290
            if (strncasecmp (&sharefilename[len-4], ".exe", 4) == 0)
291
              sharefilename[len-4] = 0;
292
 
293
            for (ptr = sharefilename; *ptr; ptr++)
294
              *ptr = TOUPPER (*ptr);
295
          }
296
      }
297
}
298
 
299
static void
300
process_args (int *p_argc, char **argv)
301
{
302
  int i;
303
 
304
  for (i = 1; i < *p_argc; i++)
305
    {
306
      if (strlen (argv[i]) < 2)
307
        continue;
308
 
309
      if (strncmp (argv[i], "-L", 2) == 0)
310
        {
311
          char *nbuff, *ptr;
312
          int new_len, search_dirs_len;
313
 
314
          ptr = &argv[i][2];
315
          new_len = strlen (ptr);
316
          search_dirs_len = strlen (search_dirs);
317
 
318
          nbuff = xmalloc (new_len + 1);
319
          strcpy (nbuff, ptr);
320
 
321
          /* Remove trailing slashes.  */
322
          while (new_len > 1 && nbuff [new_len - 1] == '/')
323
            {
324
              nbuff [new_len - 1] = 0;
325
              new_len--;
326
            }
327
 
328
          search_dirs = xrealloc (search_dirs, search_dirs_len + new_len + 2);
329
          if (search_dirs_len > 0)
330
            strcat (search_dirs, PATH_SEPARATOR_STR);
331
 
332
          strcat (search_dirs, nbuff);
333
          free (nbuff);
334
        }
335
 
336
      /* -v turns on verbose option here and is passed on to gcc.  */
337
      else if (strcmp (argv[i], "-v") == 0)
338
        verbose = 1;
339
      else if (strcmp (argv[i], "-g0") == 0)
340
        addarg ("/notraceback");
341
      else if (strncmp (argv[i], "-g", 2) == 0)
342
        {
343
          addarg ("/debug");
344
          debug = 1;
345
        }
346
      else if (strcmp (argv[i], "-static") == 0)
347
        staticp = 1;
348
      else if (strcmp (argv[i], "-map") == 0)
349
        {
350
          char *buff, *ptr;
351
 
352
          buff = xmalloc (strlen (exefilename) + 5);
353
          strcpy (buff, exefilename);
354
          ptr = strchr (buff, '.');
355
          if (ptr)
356
            *ptr = 0;
357
 
358
          strcat (buff, ".map");
359
          addarg ("/map=");
360
          addarg (buff);
361
          addarg ("/full");
362
        }
363
      else if (strcmp (argv[i], "-save-temps") == 0)
364
        save_temps = 1;
365
      else if (strcmp (argv[i], "--noinhibit-exec") == 0)
366
        inhibit_exec = 0;
367
    }
368
}
369
 
370
/* The main program.  Spawn the VMS linker after fixing up the Unix-like flags
371
   and args to be what the VMS linker wants.  */
372
 
373
int
374
main (int argc, char **argv)
375
{
376
  int i;
377
  char cwdev [128], *devptr;
378
  int devlen;
379
  int optfd;
380
  FILE *optfile;
381
  char *cwd = getcwd (0, 1024);
382
  char *optfilename;
383
 
384
  devptr = strchr (cwd, ':');
385
  devlen = (devptr - cwd) + 1;
386
  strncpy (cwdev, cwd, devlen);
387
  cwdev [devlen] = '\0';
388
 
389
  search_dirs = xstrdup (system_search_dirs);
390
 
391
  addarg ("link");
392
 
393
  /* Pass to find args that have to be append first.  */
394
  preprocess_args (&argc , argv);
395
 
396
  /* Pass to find the rest of the args.  */
397
  process_args (&argc , argv);
398
 
399
  /* Create a temp file to hold args, otherwise we can easily exceed the VMS
400
     command line length limits.  */
401
  optfilename = alloca (strlen ("LDXXXXXX") + 1);
402
  strcpy (optfilename, "LDXXXXXX");
403
  optfd = mkstemp (optfilename);
404
  getcwd (optfilefullname, 256, 1); /* VMS style cwd.  */
405
  strcat (optfilefullname, optfilename);
406
  strcat (optfilefullname, ".");
407
  optfile = fdopen (optfd, "w");
408
 
409
  /* Write out the IDENTIFICATION argument first so that it can be overridden
410
     by an options file.  */
411
  for (i = 1; i < argc; i++)
412
    {
413
      int arg_len = strlen (argv[i]);
414
 
415
      if (arg_len > 6 && strncasecmp (argv[i], "IDENT=", 6) == 0)
416
        {
417
          /* Comes from command line. If present will always appear before
418
             IDENTIFICATION=... and will override.  */
419
 
420
          if (!ident)
421
            ident = 1;
422
        }
423
      else if (arg_len > 15
424
               && strncasecmp (argv[i], "IDENTIFICATION=", 15) == 0)
425
        {
426
          /* Comes from pragma Ident ().  */
427
 
428
          if (!ident)
429
            {
430
              fprintf (optfile, "case_sensitive=yes\n");
431
              fprintf (optfile, "IDENTIFICATION=\"%15.15s\"\n", &argv[i][15]);
432
              fprintf (optfile, "case_sensitive=NO\n");
433
              ident = 1;
434
            }
435
        }
436
    }
437
 
438
  for (i = 1; i < argc; i++)
439
    {
440
      int arg_len = strlen (argv[i]);
441
 
442
      if (strcmp (argv[i], "-o") == 0)
443
        i++;
444
      else if (arg_len > 2 && strncmp (argv[i], "-l", 2) == 0)
445
        {
446
          const char *libname = expand_lib (&argv[i][2]);
447
          const char *ext;
448
          int len;
449
 
450
          if ((len = strlen (libname)) > 0)
451
            {
452
              char buff [256];
453
 
454
              if (len > 4 && strcasecmp (&libname [len-4], ".exe") == 0)
455
                ext = "/shareable";
456
              else
457
                ext = "/library";
458
 
459
              if (libname[0] == '[')
460
                sprintf (buff, "%s%s", cwdev, libname);
461
              else
462
                sprintf (buff, "%s", libname);
463
 
464
              fprintf (optfile, "%s%s\n", buff, ext);
465
            }
466
        }
467
 
468
      else if (strcmp (argv[i], "-v" ) == 0
469
               || strncmp (argv[i], "-g", 2 ) == 0
470
               || strcmp (argv[i], "-static" ) == 0
471
               || strcmp (argv[i], "-map" ) == 0
472
               || strcmp (argv[i], "-save-temps") == 0
473
               || strcmp (argv[i], "--noinhibit-exec") == 0
474
               || (arg_len > 2 && strncmp (argv[i], "-L", 2) == 0)
475
               || (arg_len >= 6 && strncmp (argv[i], "-share", 6) == 0))
476
        ;
477
      else if (arg_len > 1 && argv[i][0] == '@')
478
        {
479
          FILE *atfile;
480
          char *ptr, *ptr1;
481
          struct stat statbuf;
482
          char *buff;
483
          int len;
484
 
485
          if (stat (&argv[i][1], &statbuf))
486
            {
487
              fprintf (stderr, "Couldn't open linker response file: %s\n",
488
                       &argv[i][1]);
489
              exit (1);
490
            }
491
 
492
          buff = xmalloc (statbuf.st_size + 1);
493
          atfile = fopen (&argv[i][1], "r");
494
          fgets (buff, statbuf.st_size + 1, atfile);
495
          fclose (atfile);
496
 
497
          len = strlen (buff);
498
          if (buff [len - 1] == '\n')
499
            {
500
              buff [len - 1] = 0;
501
              len--;
502
            }
503
 
504
          ptr = buff;
505
 
506
          do
507
          {
508
             ptr1 = strchr (ptr, ' ');
509
             if (ptr1)
510
               *ptr1 = 0;
511
             ptr = to_host_file_spec (ptr);
512
             if (ptr[0] == '[')
513
               fprintf (optfile, "%s%s\n", cwdev, ptr);
514
             else
515
               fprintf (optfile, "%s\n", ptr);
516
             ptr = ptr1 + 1;
517
          } while (ptr1);
518
        }
519
 
520
      /* Unix style file specs and VMS style switches look alike, so assume an
521
         arg consisting of one and only one slash, and that being first, is
522
         really a switch.  */
523
      else if ((argv[i][0] == '/') && (strchr (&argv[i][1], '/') == 0))
524
        addarg (argv[i]);
525
      else if (arg_len > 4
526
               && strncasecmp (&argv[i][arg_len-4], ".OPT", 4) == 0)
527
        {
528
          FILE *optfile1;
529
          char buff [256];
530
 
531
          optfile1 = fopen (argv[i], "r");
532
          while (fgets (buff, 256, optfile1))
533
            fputs (buff, optfile);
534
 
535
          fclose (optfile1);
536
        }
537
      else if (arg_len > 7 && strncasecmp (argv[i], "GSMATCH", 7) == 0)
538
        fprintf (optfile, "%s\n", argv[i]);
539
      else if (arg_len > 6 && strncasecmp (argv[i], "IDENT=", 6) == 0)
540
        {
541
          /* Comes from command line and will override pragma.  */
542
          fprintf (optfile, "case_sensitive=yes\n");
543
          fprintf (optfile, "IDENT=\"%15.15s\"\n", &argv[i][6]);
544
          fprintf (optfile, "case_sensitive=NO\n");
545
          ident = 1;
546
        }
547
      else if (arg_len > 15
548
               && strncasecmp (argv[i], "IDENTIFICATION=", 15) == 0)
549
        ;
550
      else
551
        {
552
          /* Assume filename arg.  */
553
          const char *addswitch = "";
554
          char buff [256];
555
          int buff_len;
556
          int is_cld = 0;
557
 
558
          argv[i] = to_host_file_spec (argv[i]);
559
          arg_len = strlen (argv[i]);
560
 
561
          if (arg_len > 4 && strcasecmp (&argv[i][arg_len-4], ".exe") == 0)
562
            addswitch = "/shareable";
563
 
564
          if (arg_len > 4 && strcasecmp (&argv[i][arg_len-4], ".cld") == 0)
565
            {
566
              addswitch = "/shareable";
567
              is_cld = 1;
568
            }
569
 
570
          if (arg_len > 2 && strcasecmp (&argv[i][arg_len-2], ".a") == 0)
571
            addswitch = "/lib";
572
 
573
          if (arg_len > 4 && strcasecmp (&argv[i][arg_len-4], ".olb") == 0)
574
            addswitch = "/lib";
575
 
576
          if (argv[i][0] == '[')
577
            sprintf (buff, "%s%s%s\n", cwdev, argv[i], addswitch);
578
          else if (strchr (argv[i], ':'))
579
            sprintf (buff, "%s%s\n", argv[i], addswitch);
580
          else
581
            sprintf (buff, "%s%s%s\n", cwd, argv[i], addswitch);
582
 
583
          buff_len = strlen (buff);
584
 
585
          if (buff_len >= 15
586
              && strcasecmp (&buff[buff_len - 15], "vms-dwarf2eh.o\n") == 0)
587
            vmsdwarf2ehspec = xstrdup (buff);
588
          else if (buff_len >= 13
589
              && strcasecmp (&buff[buff_len - 13],"vms-dwarf2.o\n") == 0)
590
            vmsdwarf2spec = xstrdup (buff);
591
          else if (is_cld)
592
            {
593
              addarg (buff);
594
              addarg (",");
595
            }
596
          else
597
            fprintf (optfile, buff);
598
        }
599
    }
600
 
601
#if 0
602
  if (share)
603
    fprintf (optfile, "symbol_vector=(main=procedure)\n");
604
#endif
605
 
606
  if (vmsdwarf2ehspec)
607
    {
608
      fprintf (optfile, "case_sensitive=yes\n");
609
      fprintf (optfile, "cluster=DWARF2eh,,,%s", vmsdwarf2ehspec);
610
      fprintf (optfile, "collect=DWARF2eh,eh_frame\n");
611
      fprintf (optfile, "case_sensitive=NO\n");
612
    }
613
 
614
  if (debug && vmsdwarf2spec)
615
    {
616
      fprintf (optfile, "case_sensitive=yes\n");
617
      fprintf (optfile, "cluster=DWARF2debug,,,%s", vmsdwarf2spec);
618
      fprintf (optfile, "collect=DWARF2debug,debug_abbrev,debug_aranges,-\n");
619
      fprintf (optfile, " debug_frame,debug_info,debug_line,debug_loc,-\n");
620
      fprintf (optfile, " debug_macinfo,debug_pubnames,debug_str,-\n");
621
      fprintf (optfile, " debug_zzzzzz\n");
622
      fprintf (optfile, "case_sensitive=NO\n");
623
    }
624
 
625
  if (debug && share)
626
    {
627
      fprintf (optfile, "case_sensitive=yes\n");
628
      fprintf (optfile, "symbol_vector=(-\n");
629
      fprintf (optfile,
630
               "%s$DWARF2.DEBUG_ABBREV/$dwarf2.debug_abbrev=DATA,-\n",
631
               sharefilename);
632
      fprintf (optfile,
633
               "%s$DWARF2.DEBUG_ARANGES/$dwarf2.debug_aranges=DATA,-\n",
634
               sharefilename);
635
      fprintf (optfile, "%s$DWARF2.DEBUG_FRAME/$dwarf2.debug_frame=DATA,-\n",
636
               sharefilename);
637
      fprintf (optfile, "%s$DWARF2.DEBUG_INFO/$dwarf2.debug_info=DATA,-\n",
638
               sharefilename);
639
      fprintf (optfile, "%s$DWARF2.DEBUG_LINE/$dwarf2.debug_line=DATA,-\n",
640
               sharefilename);
641
      fprintf (optfile, "%s$DWARF2.DEBUG_LOC/$dwarf2.debug_loc=DATA,-\n",
642
               sharefilename);
643
      fprintf (optfile,
644
               "%s$DWARF2.DEBUG_MACINFO/$dwarf2.debug_macinfo=DATA,-\n",
645
               sharefilename);
646
      fprintf (optfile,
647
               "%s$DWARF2.DEBUG_PUBNAMES/$dwarf2.debug_pubnames=DATA,-\n",
648
               sharefilename);
649
      fprintf (optfile, "%s$DWARF2.DEBUG_STR/$dwarf2.debug_str=DATA,-\n",
650
               sharefilename);
651
      fprintf (optfile, "%s$DWARF2.DEBUG_ZZZZZZ/$dwarf2.debug_zzzzzz=DATA)\n",
652
               sharefilename);
653
      fprintf (optfile, "case_sensitive=NO\n");
654
    }
655
 
656
  fclose (optfile);
657
  addarg (optfilefullname);
658
  addarg ("/opt");
659
 
660
  addarg (NULL);
661
 
662
  if (verbose)
663
    {
664
      int i;
665
 
666
      for (i = 0; i < link_arg_index; i++)
667
        printf ("%s ", link_args [i]);
668
      putchar ('\n');
669
    }
670
 
671
  {
672
    int i;
673
    int len = 0;
674
 
675
    for (i = 0; link_args[i]; i++)
676
      len = len + strlen (link_args[i]) + 1;
677
 
678
    {
679
      char *allargs = (char *) alloca (len + 1);
680
      Descr cmd;
681
      int status;
682
      int status1 = 1;
683
 
684
      for (i = 0; i < len + 1; i++)
685
        allargs [i] = 0;
686
 
687
      for (i = 0; link_args [i]; i++)
688
        {
689
          strcat (allargs, link_args [i]);
690
          strcat (allargs, " ");
691
        }
692
 
693
      cmd.adr = allargs;
694
      cmd.len = len;
695
      cmd.mbz = 0;
696
 
697
      i = LIB$SPAWN (&cmd, 0, 0, 0, 0, 0, &status);
698
      if ((i & 1) != 1)
699
        {
700
          LIB$SIGNAL (i);
701
          exit (1);
702
        }
703
 
704
      if (debug && !share)
705
        {
706
          strcpy (allargs, "@gnu:[bin]set_exe ");
707
          strcat (allargs, exefilename);
708
          strcat (allargs, " /nodebug /silent");
709
          len = strlen (allargs);
710
          cmd.adr = allargs;
711
          cmd.len = len;
712
          cmd.mbz = 0;
713
 
714
          if (verbose)
715
            printf (allargs);
716
 
717
          i = LIB$SPAWN (&cmd, 0, 0, 0, 0, 0, &status1);
718
 
719
          if ((i & 1) != 1)
720
            {
721
              LIB$SIGNAL (i);
722
              exit (1);
723
            }
724
        }
725
 
726
      if (!save_temps)
727
        remove (optfilefullname);
728
 
729
      if ((status & 1) == 1 && (status1 & 1) == 1)
730
        exit (0);
731
 
732
      if (exefilename && inhibit_exec == 1)
733
        remove (exefilename);
734
 
735
      exit (1);
736
    }
737
  }
738
}
739
 
740
static char new_host_filespec [255];
741
static char filename_buff [256];
742
 
743
static int
744
translate_unix (char *name, int type ATTRIBUTE_UNUSED)
745
{
746
  strcpy (filename_buff, name);
747
  return 0;
748
}
749
 
750
static char *
751
to_host_file_spec (char *filespec)
752
{
753
  strcpy (new_host_filespec, "");
754
  if (strchr (filespec, ']') || strchr (filespec, ':'))
755
    strcpy (new_host_filespec, filespec);
756
  else
757
    {
758
      decc$to_vms (filespec, translate_unix, 1, 1);
759
      strcpy (new_host_filespec, filename_buff);
760
    }
761
 
762
  return new_host_filespec;
763
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.