This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
patch for i386-pe `ld -r' problem
- To: binutils at sources dot redhat dot com
- Subject: patch for i386-pe `ld -r' problem
- From: Philip Blundell <pb at futuretv dot com>
- Date: Thu, 09 Nov 2000 11:02:26 +0000
This patch seems to fix my problem with the symbol table getting corrupted
during partial links. Is this OK?
Thanks
p.
2000-11-09 Philip Blundell <pb@futuretv.com>
* libcoff.h (coff_tdata): Add `strings_written' flag.
(obj_coff_strings_written): New accessor macro for above.
* cofflink.c (_bfd_coff_final_link): Say that we wrote the
strings.
* coffcode.h (coff_write_object_contents): No need to write out
the string table if it's already been done.
Index: coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.47
diff -u -p -u -r1.47 coffcode.h
--- coffcode.h 2000/10/06 19:47:51 1.47
+++ coffcode.h 2000/11/09 07:15:08
@@ -3795,7 +3795,7 @@ coff_write_object_contents (abfd)
return false;
}
#ifdef COFF_LONG_SECTION_NAMES
- else if (long_section_names)
+ else if (long_section_names && ! obj_coff_strings_written (abfd))
{
/* If we have long section names we have to write out the string
table even if there are no symbols. */
Index: cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 cofflink.c
--- cofflink.c 2000/07/03 18:45:18 1.18
+++ cofflink.c 2000/11/09 07:15:19
@@ -1102,6 +1102,8 @@ _bfd_coff_final_link (abfd, info)
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
return false;
+
+ obj_coff_strings_written (abfd) = true;
}
_bfd_stringtab_free (finfo.strtab);
Index: libcoff.h
===================================================================
RCS file: /cvs/src/src/bfd/libcoff.h,v
retrieving revision 1.12
diff -u -p -u -r1.12 libcoff.h
--- libcoff.h 2000/07/08 12:08:43 1.12
+++ libcoff.h 2000/11/09 07:15:23
@@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suit
#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
+#define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written)
#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
@@ -83,6 +84,8 @@ typedef struct coff_tdata
char *strings;
/* If this is true, the strings may not be freed. */
boolean keep_strings;
+ /* If this is true, the strings have been written out already. */
+ boolean strings_written;
/* is this a PE format coff file */
int pe;