tlink.c 17.8 KB
Newer Older
1 2 3
/* Scan linker error messages for missing template instantiations and provide
   them.

4
   Copyright (C) 1995, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5
   Free Software Foundation, Inc.
6 7
   Contributed by Jason Merrill (jason@cygnus.com).

8
This file is part of GCC.
9

10 11 12 13
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
14

15 16 17 18
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.
19 20

You should have received a copy of the GNU General Public License
21
along with GCC; see the file COPYING.  If not, write to the Free
Kelley Cook committed
22 23
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.  */
24 25

#include "config.h"
26
#include "system.h"
27 28
#include "coretypes.h"
#include "tm.h"
29
#include "intl.h"
30 31
#include "obstack.h"
#include "hashtab.h"
32
#include "demangle.h"
33
#include "collect2.h"
34 35 36 37 38 39 40

#define MAX_ITERATIONS 17

/* Defined in the automatically-generated underscore.c.  */
extern int prepends_underscore;

static int tlink_verbose;
41 42

static char initial_cwd[MAXPATHLEN + 1];
43

44
/* Hash table boilerplate for working with htab_t.  We have hash tables
Jason Merrill committed
45
   for symbol names, file names, and demangled symbols.  */
46 47 48

typedef struct symbol_hash_entry
{
49
  const char *key;
50 51 52 53 54 55 56 57
  struct file_hash_entry *file;
  int chosen;
  int tweaking;
  int tweaked;
} symbol;

typedef struct file_hash_entry
{
58
  const char *key;
59 60 61 62 63 64 65 66
  const char *args;
  const char *dir;
  const char *main;
  int tweaking;
} file;

typedef struct demangled_hash_entry
{
67
  const char *key;
68 69 70
  const char *mangled;
} demangled;

71 72
/* Hash and comparison functions for these hash tables.  */

73 74
static int hash_string_eq (const void *, const void *);
static hashval_t hash_string_hash (const void *);
75 76

static int
77
hash_string_eq (const void *s1_p, const void *s2_p)
78
{
Kazu Hirata committed
79 80
  const char *const *s1 = (const char *const *) s1_p;
  const char *s2 = (const char *) s2_p;
81 82 83 84
  return strcmp (*s1, s2) == 0;
}

static hashval_t
85
hash_string_hash (const void *s_p)
86
{
Kazu Hirata committed
87
  const char *const *s = (const char *const *) s_p;
88 89 90 91
  return (*htab_hash_string) (*s);
}

static htab_t symbol_table;
92

93 94 95 96 97 98 99 100
static struct symbol_hash_entry * symbol_hash_lookup (const char *, int);
static struct file_hash_entry * file_hash_lookup (const char *);
static struct demangled_hash_entry *demangled_hash_lookup (const char *, int);
static void symbol_push (symbol *);
static symbol * symbol_pop (void);
static void file_push (file *);
static file * file_pop (void);
static void tlink_init (void);
101
static int tlink_execute (const char *, char **, const char *, const char *);
102 103 104 105 106 107 108 109 110 111 112
static char * frob_extension (const char *, const char *);
static char * obstack_fgets (FILE *, struct obstack *);
static char * tfgets (FILE *);
static char * pfgets (FILE *);
static void freadsym (FILE *, file *, int);
static void read_repo_file (file *);
static void maybe_tweak (char *, file *);
static int recompile_files (void);
static int read_repo_files (char **);
static void demangle_new_symbols (void);
static int scan_linker_output (const char *);
Kaveh R. Ghazi committed
113

Jason Merrill committed
114 115
/* Look up an entry in the symbol hash table.  */

116
static struct symbol_hash_entry *
117
symbol_hash_lookup (const char *string, int create)
118
{
119
  void **e;
120
  e = htab_find_slot_with_hash (symbol_table, string,
Kazu Hirata committed
121
				(*htab_hash_string) (string),
122 123 124 125
				create ? INSERT : NO_INSERT);
  if (e == NULL)
    return NULL;
  if (*e == NULL)
126
    {
127
      struct symbol_hash_entry *v;
128
      *e = v = XCNEW (struct symbol_hash_entry);
129
      v->key = xstrdup (string);
130
    }
131
  return *e;
132 133
}

134 135
static htab_t file_table;

Jason Merrill committed
136 137
/* Look up an entry in the file hash table.  */

138
static struct file_hash_entry *
139
file_hash_lookup (const char *string)
140
{
141
  void **e;
142
  e = htab_find_slot_with_hash (file_table, string,
Kazu Hirata committed
143
				(*htab_hash_string) (string),
144 145
				INSERT);
  if (*e == NULL)
146
    {
147
      struct file_hash_entry *v;
148
      *e = v = XCNEW (struct file_hash_entry);
149
      v->key = xstrdup (string);
150
    }
151
  return *e;
152 153
}

154 155
static htab_t demangled_table;

Jason Merrill committed
156 157
/* Look up an entry in the demangled name hash table.  */

158
static struct demangled_hash_entry *
159
demangled_hash_lookup (const char *string, int create)
160
{
161
  void **e;
162
  e = htab_find_slot_with_hash (demangled_table, string,
Kazu Hirata committed
163
				(*htab_hash_string) (string),
164 165 166 167 168 169
				create ? INSERT : NO_INSERT);
  if (e == NULL)
    return NULL;
  if (*e == NULL)
    {
      struct demangled_hash_entry *v;
170
      *e = v = XCNEW (struct demangled_hash_entry);
171 172 173
      v->key = xstrdup (string);
    }
  return *e;
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
}

/* Stack code.  */

struct symbol_stack_entry
{
  symbol *value;
  struct symbol_stack_entry *next;
};
struct obstack symbol_stack_obstack;
struct symbol_stack_entry *symbol_stack;

struct file_stack_entry
{
  file *value;
  struct file_stack_entry *next;
};
struct obstack file_stack_obstack;
struct file_stack_entry *file_stack;

static void
195
symbol_push (symbol *p)
196
{
197
  struct symbol_stack_entry *ep = obstack_alloc
198 199 200 201 202 203 204
    (&symbol_stack_obstack, sizeof (struct symbol_stack_entry));
  ep->value = p;
  ep->next = symbol_stack;
  symbol_stack = ep;
}

static symbol *
205
symbol_pop (void)
206 207 208 209 210 211 212 213 214 215 216 217
{
  struct symbol_stack_entry *ep = symbol_stack;
  symbol *p;
  if (ep == NULL)
    return NULL;
  p = ep->value;
  symbol_stack = ep->next;
  obstack_free (&symbol_stack_obstack, ep);
  return p;
}

static void
218
file_push (file *p)
219 220 221 222 223 224
{
  struct file_stack_entry *ep;

  if (p->tweaking)
    return;

225
  ep = obstack_alloc
226 227 228 229 230 231 232 233
    (&file_stack_obstack, sizeof (struct file_stack_entry));
  ep->value = p;
  ep->next = file_stack;
  file_stack = ep;
  p->tweaking = 1;
}

static file *
234
file_pop (void)
235 236 237 238 239 240 241 242 243 244 245 246 247 248
{
  struct file_stack_entry *ep = file_stack;
  file *p;
  if (ep == NULL)
    return NULL;
  p = ep->value;
  file_stack = ep->next;
  obstack_free (&file_stack_obstack, ep);
  p->tweaking = 0;
  return p;
}

/* Other machinery.  */

Jason Merrill committed
249 250
/* Initialize the tlink machinery.  Called from do_tlink.  */

251
static void
252
tlink_init (void)
253
{
254
  const char *p;
255

256 257 258 259 260 261
  symbol_table = htab_create (500, hash_string_hash, hash_string_eq,
			      NULL);
  file_table = htab_create (500, hash_string_hash, hash_string_eq,
			    NULL);
  demangled_table = htab_create (500, hash_string_hash, hash_string_eq,
				 NULL);
262

263 264 265 266 267 268 269 270 271 272 273 274 275 276
  obstack_begin (&symbol_stack_obstack, 0);
  obstack_begin (&file_stack_obstack, 0);

  p = getenv ("TLINK_VERBOSE");
  if (p)
    tlink_verbose = atoi (p);
  else
    {
      tlink_verbose = 1;
      if (vflag)
	tlink_verbose = 2;
      if (debug)
	tlink_verbose = 3;
    }
277 278

  getcwd (initial_cwd, sizeof (initial_cwd));
279 280 281
}

static int
282 283
tlink_execute (const char *prog, char **argv, const char *outname,
	       const char *errname)
284
{
285 286
  struct pex_obj *pex;

287
  pex = collect_execute (prog, argv, outname, errname);
288
  return collect_wait (prog, pex);
Kazu Hirata committed
289
}
290 291

static char *
292
frob_extension (const char *s, const char *ext)
293
{
294
  const char *p = strrchr (s, '/');
295 296
  if (! p)
    p = s;
297
  p = strrchr (p, '.');
298 299 300 301 302 303 304 305
  if (! p)
    p = s + strlen (s);

  obstack_grow (&temporary_obstack, s, p - s);
  return obstack_copy0 (&temporary_obstack, ext, strlen (ext));
}

static char *
306
obstack_fgets (FILE *stream, struct obstack *ob)
307 308 309 310 311 312 313
{
  int c;
  while ((c = getc (stream)) != EOF && c != '\n')
    obstack_1grow (ob, c);
  if (obstack_object_size (ob) == 0)
    return NULL;
  obstack_1grow (ob, '\0');
314
  return XOBFINISH (ob, char *);
315 316 317
}

static char *
318
tfgets (FILE *stream)
319 320 321 322 323
{
  return obstack_fgets (stream, &temporary_obstack);
}

static char *
324
pfgets (FILE *stream)
325
{
Geoffrey Keating committed
326
  return xstrdup (tfgets (stream));
327 328 329 330
}

/* Real tlink code.  */

Jason Merrill committed
331 332
/* Subroutine of read_repo_file.  We are reading the repo file for file F,
   which is coming in on STREAM, and the symbol that comes next in STREAM
333
   is offered, chosen or provided if CHOSEN is 0, 1 or 2, respectively.
Jason Merrill committed
334 335 336

   XXX "provided" is unimplemented, both here and in the compiler.  */

337
static void
338
freadsym (FILE *stream, file *f, int chosen)
339 340 341 342
{
  symbol *sym;

  {
343
    const char *name = tfgets (stream);
344 345 346 347 348
    sym = symbol_hash_lookup (name, true);
  }

  if (sym->file == NULL)
    {
Jason Merrill committed
349 350
      /* We didn't have this symbol already, so we choose this file.  */

351 352 353 354 355 356
      symbol_push (sym);
      sym->file = f;
      sym->chosen = chosen;
    }
  else if (chosen)
    {
Jason Merrill committed
357 358
      /* We want this file; cast aside any pretender.  */

359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
      if (sym->chosen && sym->file != f)
	{
	  if (sym->chosen == 1)
	    file_push (sym->file);
	  else
	    {
	      file_push (f);
	      f = sym->file;
	      chosen = sym->chosen;
	    }
	}
      sym->file = f;
      sym->chosen = chosen;
    }
}

Jason Merrill committed
375 376
/* Read in the repo file denoted by F, and record all its information.  */

377
static void
378
read_repo_file (file *f)
379 380
{
  char c;
381
  FILE *stream = fopen (f->key, "r");
382 383

  if (tlink_verbose >= 2)
384
    fprintf (stderr, _("collect: reading %s\n"), f->key);
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417

  while (fscanf (stream, "%c ", &c) == 1)
    {
      switch (c)
	{
	case 'A':
	  f->args = pfgets (stream);
	  break;
	case 'D':
	  f->dir = pfgets (stream);
	  break;
	case 'M':
	  f->main = pfgets (stream);
	  break;
	case 'P':
	  freadsym (stream, f, 2);
	  break;
	case 'C':
	  freadsym (stream, f, 1);
	  break;
	case 'O':
	  freadsym (stream, f, 0);
	  break;
	}
      obstack_free (&temporary_obstack, temporary_firstobj);
    }
  fclose (stream);
  if (f->args == NULL)
    f->args = getenv ("COLLECT_GCC_OPTIONS");
  if (f->dir == NULL)
    f->dir = ".";
}

Jason Merrill committed
418 419 420 421 422
/* We might want to modify LINE, which is a symbol line from file F.  We do
   this if either we saw an error message referring to the symbol in
   question, or we have already allocated the symbol to another file and
   this one wants to emit it as well.  */

423
static void
424
maybe_tweak (char *line, file *f)
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
{
  symbol *sym = symbol_hash_lookup (line + 2, false);

  if ((sym->file == f && sym->tweaking)
      || (sym->file != f && line[0] == 'C'))
    {
      sym->tweaking = 0;
      sym->tweaked = 1;

      if (line[0] == 'O')
	line[0] = 'C';
      else
	line[0] = 'O';
    }
}

Jason Merrill committed
441
/* Update the repo files for each of the object files we have adjusted and
442
   recompile.  */
Jason Merrill committed
443

444
static int
445
recompile_files (void)
446 447 448
{
  file *f;

Kean Johnston committed
449 450
  putenv (xstrdup ("COMPILER_PATH="));
  putenv (xstrdup ("LIBRARY_PATH="));
Kazu Hirata committed
451

452 453
  while ((f = file_pop ()) != NULL)
    {
454 455 456 457
      char *line;
      const char *p, *q;
      char **argv;
      struct obstack arg_stack;
458 459
      FILE *stream = fopen (f->key, "r");
      const char *const outname = frob_extension (f->key, ".rnw");
460 461 462 463 464 465 466 467 468 469 470 471 472 473
      FILE *output = fopen (outname, "w");

      while ((line = tfgets (stream)) != NULL)
	{
	  switch (line[0])
	    {
	    case 'C':
	    case 'O':
	      maybe_tweak (line, f);
	    }
	  fprintf (output, "%s\n", line);
	}
      fclose (stream);
      fclose (output);
474 475 476 477 478 479 480
      /* On Windows "rename" returns -1 and sets ERRNO to EACCESS if
	 the new file name already exists.  Therefore, we explicitly
	 remove the old file first.  */
      if (remove (f->key) == -1)
	fatal_perror ("removing .rpo file");
      if (rename (outname, f->key) == -1)
	fatal_perror ("renaming .rpo file");
481

482 483
      if (!f->args)
	{
484
	  error ("repository file '%s' does not contain command-line "
485 486 487
		 "arguments", f->key);
	  return 0;
	}
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530

      /* Build a null-terminated argv array suitable for
	 tlink_execute().  Manipulate arguments on the arg_stack while
	 building argv on the temporary_obstack.  */

      obstack_init (&arg_stack);
      obstack_ptr_grow (&temporary_obstack, c_file_name);

      for (p = f->args; *p != '\0'; p = q + 1)
	{
	  /* Arguments are delimited by single-quotes.  Find the
	     opening quote.  */
	  p = strchr (p, '\'');
	  if (!p)
	    goto done;

	  /* Find the closing quote.  */
	  q = strchr (p + 1, '\'');
	  if (!q)
	    goto done;

	  obstack_grow (&arg_stack, p + 1, q - (p + 1));

	  /* Replace '\'' with '.  This is how set_collect_gcc_options
	     encodes a single-quote.  */
	  while (q[1] == '\\' && q[2] == '\'' && q[3] == '\'')
	    {
	      const char *r;

	      r = strchr (q + 4, '\'');
	      if (!r)
		goto done;

	      obstack_grow (&arg_stack, q + 3, r - (q + 3));
	      q = r;
	    }

	  obstack_1grow (&arg_stack, '\0');
	  obstack_ptr_grow (&temporary_obstack, obstack_finish (&arg_stack));
	}
    done:
      obstack_ptr_grow (&temporary_obstack, f->main);
      obstack_ptr_grow (&temporary_obstack, NULL);
531
      argv = XOBFINISH (&temporary_obstack, char **);
532 533

      if (tlink_verbose)
534
	fprintf (stderr, _("collect: recompiling %s\n"), f->main);
535

536
      if (chdir (f->dir) != 0
537
	  || tlink_execute (c_file_name, argv, NULL, NULL) != 0
538
	  || chdir (initial_cwd) != 0)
539 540 541 542
	return 0;

      read_repo_file (f);

543
      obstack_free (&arg_stack, NULL);
544 545 546 547 548
      obstack_free (&temporary_obstack, temporary_firstobj);
    }
  return 1;
}

Jason Merrill committed
549 550 551
/* The first phase of processing: determine which object files have
   .rpo files associated with them, and read in the information.  */

552
static int
553
read_repo_files (char **object_lst)
554 555 556 557 558
{
  char **object = object_lst;

  for (; *object; object++)
    {
559
      const char *p;
560 561
      file *f;

562 563 564 565 566 567
      /* Don't bother trying for ld flags.  */
      if (*object[0] == '-')
	continue;

      p = frob_extension (*object, ".rpo");

568 569 570 571 572 573 574 575 576 577 578 579 580 581
      if (! file_exists (p))
	continue;

      f = file_hash_lookup (p);

      read_repo_file (f);
    }

  if (file_stack != NULL && ! recompile_files ())
    return 0;

  return (symbol_stack != NULL);
}

Jason Merrill committed
582 583
/* Add the demangled forms of any new symbols to the hash table.  */

584
static void
585
demangle_new_symbols (void)
586 587 588 589 590 591
{
  symbol *sym;

  while ((sym = symbol_pop ()) != NULL)
    {
      demangled *dem;
592
      const char *p = cplus_demangle (sym->key, DMGL_PARAMS | DMGL_ANSI);
593 594 595 596 597

      if (! p)
	continue;

      dem = demangled_hash_lookup (p, true);
598
      dem->mangled = sym->key;
599 600 601
    }
}

Jason Merrill committed
602 603 604
/* Step through the output of the linker, in the file named FNAME, and
   adjust the settings for each symbol encountered.  */

605
static int
606
scan_linker_output (const char *fname)
607 608 609 610 611 612 613 614 615
{
  FILE *stream = fopen (fname, "r");
  char *line;

  while ((line = tfgets (stream)) != NULL)
    {
      char *p = line, *q;
      symbol *sym;
      int end;
Kazu Hirata committed
616

Kazu Hirata committed
617
      while (*p && ISSPACE ((unsigned char) *p))
618 619 620 621 622
	++p;

      if (! *p)
	continue;

Kazu Hirata committed
623
      for (q = p; *q && ! ISSPACE ((unsigned char) *q); ++q)
624 625 626 627 628
	;

      /* Try the first word on the line.  */
      if (*p == '.')
	++p;
629 630
      if (!strncmp (p, USER_LABEL_PREFIX, strlen (USER_LABEL_PREFIX)))
	p += strlen (USER_LABEL_PREFIX);
631 632 633 634 635

      end = ! *q;
      *q = 0;
      sym = symbol_hash_lookup (p, false);

636 637 638
      /* Some SVR4 linkers produce messages like
	 ld: 0711-317 ERROR: Undefined symbol: .g__t3foo1Zi
	 */
Kazu Hirata committed
639
      if (! sym && ! end && strstr (q + 1, "Undefined symbol: "))
640
	{
Kazu Hirata committed
641
	  char *p = strrchr (q + 1, ' ');
642 643 644
	  p++;
	  if (*p == '.')
	    p++;
645 646
	  if (!strncmp (p, USER_LABEL_PREFIX, strlen (USER_LABEL_PREFIX)))
	    p += strlen (USER_LABEL_PREFIX);
647 648 649
	  sym = symbol_hash_lookup (p, false);
	}

650
      if (! sym && ! end)
651
	/* Try a mangled name in quotes.  */
652
	{
Kazu Hirata committed
653
	  const char *oldq = q + 1;
654 655 656
	  demangled *dem = 0;
	  q = 0;

657
	  /* First try `GNU style'.  */
658
	  p = strchr (oldq, '`');
659
	  if (p)
660
	    p++, q = strchr (p, '\'');
661
	  /* Then try "double quotes".  */
662 663
	  else if (p = strchr (oldq, '"'), p)
	    p++, q = strchr (p, '"');
664 665 666 667
	  else {
	    /* Then try entire line.  */
	    q = strchr (oldq, 0);
	    if (q != oldq)
Mike Stump committed
668
	      p = (char *)oldq;
669
	  }
670

671
	  if (p)
672 673 674 675 676 677 678 679 680
	    {
	      /* Don't let the strstr's below see the demangled name; we
		 might get spurious matches.  */
	      p[-1] = '\0';

	      /* powerpc64-linux references .foo when calling function foo.  */
	      if (*p == '.')
		p++;
	    }
681

682 683 684
	  /* We need to check for certain error keywords here, or we would
	     mistakenly use GNU ld's "In function `foo':" message.  */
	  if (q && (strstr (oldq, "ndefined")
Jason Merrill committed
685
		    || strstr (oldq, "nresolved")
686
		    || strstr (oldq, "nsatisfied")
687
		    || strstr (oldq, "ultiple")))
688
	    {
689 690 691 692 693
	      *q = 0;
	      dem = demangled_hash_lookup (p, false);
	      if (dem)
		sym = symbol_hash_lookup (dem->mangled, false);
	      else
Kazu Hirata committed
694
		{
695 696 697
		  if (!strncmp (p, USER_LABEL_PREFIX,
				strlen (USER_LABEL_PREFIX)))
		    p += strlen (USER_LABEL_PREFIX);
698 699
		  sym = symbol_hash_lookup (p, false);
		}
700 701 702 703
	    }
	}

      if (sym && sym->tweaked)
704
	{
705
	  error ("'%s' was assigned to '%s', but was not defined "
706 707
		 "during recompilation, or vice versa", 
		 sym->key, sym->file->key);
708 709 710
	  fclose (stream);
	  return 0;
	}
711 712 713
      if (sym && !sym->tweaking)
	{
	  if (tlink_verbose >= 2)
714
	    fprintf (stderr, _("collect: tweaking %s in %s\n"),
715
		     sym->key, sym->file->key);
716 717 718
	  sym->tweaking = 1;
	  file_push (sym->file);
	}
Kazu Hirata committed
719

720 721 722
      obstack_free (&temporary_obstack, temporary_firstobj);
    }

723
  fclose (stream);
724 725 726
  return (file_stack != NULL);
}

Jason Merrill committed
727 728 729 730 731 732 733 734 735
/* Entry point for tlink.  Called from main in collect2.c.

   Iteratively try to provide definitions for all the unresolved symbols
   mentioned in the linker error messages.

   LD_ARGV is an array of arguments for the linker.
   OBJECT_LST is an array of object files that we may be able to recompile
     to provide missing definitions.  Currently ignored.  */

736
void
737
do_tlink (char **ld_argv, char **object_lst ATTRIBUTE_UNUSED)
738
{
739
  int exit = tlink_execute ("ld", ld_argv, ldout, lderrout);
740 741 742 743 744 745 746 747 748 749 750 751 752

  tlink_init ();

  if (exit)
    {
      int i = 0;

      /* Until collect does a better job of figuring out which are object
	 files, assume that everything on the command line could be.  */
      if (read_repo_files (ld_argv))
	while (exit && i++ < MAX_ITERATIONS)
	  {
	    if (tlink_verbose >= 3)
753 754 755 756
	      {
		dump_file (ldout, stdout);
		dump_file (lderrout, stderr);
	      }
757
	    demangle_new_symbols ();
758 759
	    if (! scan_linker_output (ldout)
		&& ! scan_linker_output (lderrout))
760 761 762 763
	      break;
	    if (! recompile_files ())
	      break;
	    if (tlink_verbose)
764
	      fprintf (stderr, _("collect: relinking\n"));
765
	    exit = tlink_execute ("ld", ld_argv, ldout, lderrout);
766 767 768
	  }
    }

769
  dump_file (ldout, stdout);
770
  unlink (ldout);
771 772
  dump_file (lderrout, stderr);
  unlink (lderrout);
773 774 775 776 777 778
  if (exit)
    {
      error ("ld returned %d exit status", exit);
      collect_exit (exit);
    }
}