From bda987c255396672f917107bb819a99d204c7d89 Mon Sep 17 00:00:00 2001 From: Chris Demetriou Date: Tue, 22 Jul 2008 04:58:33 +0000 Subject: [PATCH] 2008-07-22 Simon Baldwin * elflink.c (elf_link_output_extsym): Set st_size to zero for symbols from dynamic libraries. --- bfd/ChangeLog | 5 +++++ bfd/elflink.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b5967c95e5..3616c0f5c1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2008-07-22 Simon Baldwin + + * elflink.c (elf_link_output_extsym): Set st_size to zero for + symbols from dynamic libraries. + 2008-07-21 H.J. Lu PR ld/4424 diff --git a/bfd/elflink.c b/bfd/elflink.c index 69a7c6945c..488f98afdb 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