aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorChris Demetriou <cgd@google.com>2008-07-22 04:58:33 +0000
committerChris Demetriou <cgd@google.com>2008-07-22 04:58:33 +0000
commitbda987c255396672f917107bb819a99d204c7d89 (patch)
tree21694237972b117f1670c1b63ef032ba0d5f07e1 /bfd/elflink.c
parentcfd8ab242a3fcae371bdd4cd83c9a59b36fcfd51 (diff)
downloadfsf-binutils-gdb-bda987c255396672f917107bb819a99d204c7d89.zip
fsf-binutils-gdb-bda987c255396672f917107bb819a99d204c7d89.tar.gz
fsf-binutils-gdb-bda987c255396672f917107bb819a99d204c7d89.tar.bz2
2008-07-22 Simon Baldwin <simonb@google.com>
* elflink.c (elf_link_output_extsym): Set st_size to zero for symbols from dynamic libraries.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 69a7c69..488f98a 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -8619,6 +8619,15 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
}
+ /* If this is a symbol defined in a dynamic library, don't use the
+ symbol size from the dynamic library. Relinking an executable
+ against a new library may introduce gratuitous changes in the
+ executable's symbols if we keep the size. */
+ if (sym.st_shndx == SHN_UNDEF
+ && !h->def_regular
+ && h->def_dynamic)
+ sym.st_size = 0;
+
/* If a non-weak symbol with non-default visibility is not defined
locally, it is a fatal error. */
if (! finfo->info->relocatable