Commit 196bea21 by Mike Stump Committed by Mike Stump

tlink.c (scan_linker_output): Parse linker messages from darwin9's linker better.

	* tlink.c (scan_linker_output): Parse linker messages from
	darwin9's linker better.

From-SVN: r122283
parent a2266ea9
2007-02-23 Mike Stump <mrs@apple.com>
* tlink.c (scan_linker_output): Parse linker messages from
darwin9's linker better.
2007-02-23 Steve Ellcey <sje@cup.hp.com> 2007-02-23 Steve Ellcey <sje@cup.hp.com>
PR debug/29614 PR debug/29614
......
...@@ -607,12 +607,17 @@ scan_linker_output (const char *fname) ...@@ -607,12 +607,17 @@ scan_linker_output (const char *fname)
{ {
FILE *stream = fopen (fname, "r"); FILE *stream = fopen (fname, "r");
char *line; char *line;
int skip_next_line = 0;
while ((line = tfgets (stream)) != NULL) while ((line = tfgets (stream)) != NULL)
{ {
char *p = line, *q; char *p = line, *q;
symbol *sym; symbol *sym;
int end; int end;
int ok = 0;
if (skip_next_line)
continue;
while (*p && ISSPACE ((unsigned char) *p)) while (*p && ISSPACE ((unsigned char) *p))
++p; ++p;
...@@ -654,6 +659,19 @@ scan_linker_output (const char *fname) ...@@ -654,6 +659,19 @@ scan_linker_output (const char *fname)
demangled *dem = 0; demangled *dem = 0;
q = 0; q = 0;
/* On darwin9, we look for "foo" referenced from:\n.*\n */
if (strcmp (oldq, "referenced from:") == 0)
{
/* We have to remember that we found a symbol to tweak. */
ok = 1;
/* We actually want to start from the first word on the line. */
oldq = p;
/* Since the format is multiline, we have to skip the next line. */
skip_next_line = 1;
}
/* First try `GNU style'. */ /* First try `GNU style'. */
p = strchr (oldq, '`'); p = strchr (oldq, '`');
if (p) if (p)
...@@ -681,7 +699,8 @@ scan_linker_output (const char *fname) ...@@ -681,7 +699,8 @@ scan_linker_output (const char *fname)
/* We need to check for certain error keywords here, or we would /* We need to check for certain error keywords here, or we would
mistakenly use GNU ld's "In function `foo':" message. */ mistakenly use GNU ld's "In function `foo':" message. */
if (q && (strstr (oldq, "ndefined") if (q && (ok
|| strstr (oldq, "ndefined")
|| strstr (oldq, "nresolved") || strstr (oldq, "nresolved")
|| strstr (oldq, "nsatisfied") || strstr (oldq, "nsatisfied")
|| strstr (oldq, "ultiple"))) || strstr (oldq, "ultiple")))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment