aboutsummaryrefslogtreecommitdiff
path: root/bfd/cofflink.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-07-24 03:16:50 +0000
committerIan Lance Taylor <ian@airs.com>1999-07-24 03:16:50 +0000
commit7fd9c191355658e46a200799e25042a5e492a4d2 (patch)
tree02aa1c842370517c2f48a438967c8ecfd8c89ff9 /bfd/cofflink.c
parent7d923127c03bdb24c4aeeb07a4a9648aad823f5f (diff)
downloadgdb-7fd9c191355658e46a200799e25042a5e492a4d2.zip
gdb-7fd9c191355658e46a200799e25042a5e492a4d2.tar.gz
gdb-7fd9c191355658e46a200799e25042a5e492a4d2.tar.bz2
1999-07-23 Donn Terry <donn@interix.com>
* libcoff-in.h (coff_link_hash_entry): Add coff_link_hash_flags field, and define COFF_LINK_HASH_PE_SECTION_SYMBOL. * cofflink.c (coff_link_add_symbols): If PE, handle section symbols specially. * libcoff.h: Rebuild.
Diffstat (limited to 'bfd/cofflink.c')
-rw-r--r--bfd/cofflink.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 679e7a8..f874832 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -351,6 +351,7 @@ coff_link_add_symbols (abfd, info)
flagword flags;
asection *section;
bfd_vma value;
+ boolean addit;
/* This symbol is externally visible. */
@@ -392,11 +393,41 @@ coff_link_add_symbols (abfd, info)
|| (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK))
flags = BSF_WEAK;
- if (! (bfd_coff_link_add_one_symbol
- (info, abfd, name, flags, section, value,
- (const char *) NULL, copy, false,
- (struct bfd_link_hash_entry **) sym_hash)))
- goto error_return;
+ addit = true;
+
+ /* In the PE format, section symbols actually refer to the
+ start of the output section. We handle them specially
+ here. */
+ if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
+ {
+ *sym_hash = coff_link_hash_lookup (coff_hash_table (info),
+ name, false, copy, false);
+ if (*sym_hash != NULL)
+ {
+ if (((*sym_hash)->coff_link_hash_flags
+ & COFF_LINK_HASH_PE_SECTION_SYMBOL) == 0
+ && (*sym_hash)->root.type != bfd_link_hash_undefined
+ && (*sym_hash)->root.type != bfd_link_hash_undefweak)
+ (*_bfd_error_handler)
+ ("Warning: symbol `%s' is both section and non-section",
+ name);
+
+ addit = false;
+ }
+ }
+
+ if (addit)
+ {
+ if (! (bfd_coff_link_add_one_symbol
+ (info, abfd, name, flags, section, value,
+ (const char *) NULL, copy, false,
+ (struct bfd_link_hash_entry **) sym_hash)))
+ goto error_return;
+ }
+
+ if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
+ (*sym_hash)->coff_link_hash_flags |=
+ COFF_LINK_HASH_PE_SECTION_SYMBOL;
if (section == bfd_com_section_ptr
&& (*sym_hash)->root.type == bfd_link_hash_common