This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Commit: LD: Fix cross reference maps of common symbols
- From: Nick Clifton <nick at nickclifton dot clara dot co dot uk>
- To: "binutils >> \"binutils at sourceware dot org\"" <binutils at sourceware dot org>
- Date: Wed, 12 Jun 2013 08:45:18 +0100
- Subject: Commit: LD: Fix cross reference maps of common symbols
Hi Guys,
I am applying the patch below to fix a problem with the linker's
generation of cross reference maps. Definitions are supposed to be
listed before references, but if the definition was for a common
symbol then it was just being treated as an ordinary reference. The
patch fixes this and updates the documentation to make it clear that
common definitions come before references.
Cheers
Nick
ld/ChangeLog
2013-06-12 Nick Clifton <nickc@redhat.com>
* ldcref.c (output_one_cref): Place common definitions after
ordinary definitions but before references.
Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/cvsfiles/gnupro/ld/ld.texinfo,v
retrieving revision 1.16
diff -u -3 -p -r1.16 ld.texinfo
--- ld/ld.texinfo 31 Dec 2008 12:19:23 -0000 1.16
+++ ld/ld.texinfo 11 Jun 2013 08:14:17 -0000
@@ -1204,7 +1204,9 @@ The format of the table is intentionally
easily processed by a script if necessary. The symbols are printed out,
sorted by name. For each symbol, a list of file names is given. If the
symbol is defined, the first file listed is the location of the
-definition. The remaining files contain references to the symbol.
+definition. If the symbol is defined as a common value then any files
+where this happens appear next. Finally any files that reference the
+symbol are listed.
@cindex common allocation
@kindex --no-define-common
Index: ld/ldcref.c
===================================================================
RCS file: /cvs/cvsfiles/gnupro/ld/ldcref.c,v
retrieving revision 1.9
diff -u -3 -p -r1.9 ldcref.c
--- ld/ldcref.c 31 Dec 2008 12:19:23 -0000 1.9
+++ ld/ldcref.c 11 Jun 2013 08:14:17 -0000
@@ -444,7 +444,21 @@ output_one_cref (FILE *fp, struct cref_h
for (r = h->refs; r != NULL; r = r->next)
{
- if (! r->def)
+ if (r->common)
+ {
+ while (len < FILECOL)
+ {
+ putc (' ', fp);
+ ++len;
+ }
+ lfinfo (fp, "%B\n", r->abfd);
+ len = 0;
+ }
+ }
+
+ for (r = h->refs; r != NULL; r = r->next)
+ {
+ if (! r->def && ! r->common)
{
while (len < FILECOL)
{