diff options
author | Christopher Faylor <me+cygwin@cgf.cx> | 2004-07-03 16:07:51 +0000 |
---|---|---|
committer | Christopher Faylor <me+cygwin@cgf.cx> | 2004-07-03 16:07:51 +0000 |
commit | c87db184a7dd1e5542b807ae6d29db02b8ea0f5e (patch) | |
tree | 7b731760ae09b88e4dcdc976bc50a97c2d8478d5 /bfd | |
parent | 3b91255ea0fa465d5c79abc774e6c7aec13ca513 (diff) | |
download | gdb-c87db184a7dd1e5542b807ae6d29db02b8ea0f5e.zip gdb-c87db184a7dd1e5542b807ae6d29db02b8ea0f5e.tar.gz gdb-c87db184a7dd1e5542b807ae6d29db02b8ea0f5e.tar.bz2 |
2004-07-04 Aaron W. LaFramboise <aaron98wiridge9@aaronwl.com>
* bfd/cofflink.c (_bfd_coff_generic_relocate_section): Resolve PE weak
externals properly.
* src/gas/config/obj-coff.c (obj_coff_weak): New .weak syntax for PE weak
externals.
* binutils/doc/binutils.texi (nm): Clarify weak symbol description.
* gas/config/tc-i386.c (tc_gen_reloc): Use addend for weak symbols in TE_PE.
* gas/doc/as.texinfo (Weak): Document PE weak symbols.
* ld/ld.texinfo (WIN32): Document PE weak symbols.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/cofflink.c | 29 |
2 files changed, 32 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e8e452f..1984946 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2004-07-03 Aaron W. LaFramboise <aaron98wiridge9@aaronwl.com> + + * cofflink.c (_bfd_coff_generic_relocate_section): Resolve PE weak + externals properly. + 2004-07-02 Martin Schwidefsky <schwidefsky@de.ibm.com> * config.bfd: Add want64 to configuration target s390-*-linux*. diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 1af86ab..af6dd3d 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -2923,16 +2923,41 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { + /* Defined weak symbols are a GNU extension. */ asection *sec; sec = h->root.u.def.section; val = (h->root.u.def.value + sec->output_section->vma + sec->output_offset); - } + } else if (h->root.type == bfd_link_hash_undefweak) - val = 0; + { + if (h->class == C_NT_WEAK && h->numaux == 1) + { + /* See _Microsoft Portable Executable and Common Object + * File Format Specification_, section 5.5.3. + * Note that weak symbols without aux records are a GNU + * extension. + * FIXME: All weak externals are treated as having + * characteristics IMAGE_WEAK_EXTERN_SEARCH_LIBRARY (2). + * There are no known uses of the other two types of + * weak externals. + */ + asection *sec; + struct coff_link_hash_entry *h2 = + input_bfd->tdata.coff_obj_data->sym_hashes[ + h->aux->x_sym.x_tagndx.l]; + + sec = h2->root.u.def.section; + val = h2->root.u.def.value + sec->output_section->vma + + sec->output_offset; + } + else + /* This is a GNU extension. */ + val = 0; + } else if (! info->relocatable) { |