From 1d7e9d183fa77485f4af5b916342e1dfa5394cd9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 13 Mar 2012 06:04:37 +0000 Subject: [PATCH] * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Don't error on zero size dynbss symbol. * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. * elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise. * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. * elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise. * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. * elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise. * elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol): Likewise. * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. * elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol): Likewise. --- bfd/ChangeLog | 26 ++++++++++++++++++++++++++ bfd/elf-m10300.c | 11 ++--------- bfd/elf32-arm.c | 11 ++--------- bfd/elf32-cr16.c | 11 ++--------- bfd/elf32-cris.c | 11 ++--------- bfd/elf32-hppa.c | 11 ++--------- bfd/elf32-i370.c | 11 ++--------- bfd/elf32-i386.c | 11 ++--------- bfd/elf32-lm32.c | 11 ++--------- bfd/elf32-m32r.c | 11 ++--------- bfd/elf32-m68k.c | 11 ++--------- bfd/elf32-ppc.c | 9 +-------- bfd/elf32-s390.c | 11 ++--------- bfd/elf32-sh.c | 9 +-------- bfd/elf32-tic6x.c | 11 ++--------- bfd/elf32-tilepro.c | 11 ++--------- bfd/elf32-vax.c | 11 ++--------- bfd/elf64-ppc.c | 9 +-------- bfd/elf64-s390.c | 11 ++--------- bfd/elf64-sh64.c | 11 ++--------- bfd/elf64-x86-64.c | 9 +-------- bfd/elfxx-sparc.c | 9 +-------- bfd/elfxx-tilegx.c | 11 ++--------- 23 files changed, 65 insertions(+), 193 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a65e8545b4d..eacf84e4fec 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,29 @@ +2012-03-12 Alan Modra + + * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Don't warn + on zero size dynbss symbol. + * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. + * elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise. + * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. + * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. + * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. + * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. + * elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise. + * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. + * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. + * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. + * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. + * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. + * elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise. + * elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol): Likewise. + * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. + * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. + * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. + * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. + * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. + * elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol): Likewise. + 2012-03-10 Edmar Wienskoski * archures.c: Add bfd_mach_ppc_e5500 and bfd_mach_ppc_e6500. diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index d5e183df21a..428de4c9e07 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -1,6 +1,6 @@ /* Matsushita 10300 specific support for 32-bit ELF Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -5023,13 +5023,6 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info, if (!h->non_got_ref) return TRUE; - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -5047,7 +5040,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info, copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection * srel; diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 62a0b8d64a6..92315522cd5 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -1,6 +1,6 @@ /* 32-bit ELF support for ARM Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -12846,13 +12846,6 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, if (info->shared || globals->root.is_relocatable_executable) return TRUE; - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -12869,7 +12862,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rel(a).bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 0118131bead..1f2fb493337 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -1,5 +1,5 @@ /* BFD back-end for National Semiconductor's CR16 ELF - Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright 2007, 2008, 2009, 2010, 2012 Free Software Foundation, Inc. Written by M R Swami Reddy. This file is part of BFD, the Binary File Descriptor library. @@ -2446,13 +2446,6 @@ _bfd_cr16_elf_adjust_dynamic_symbol (struct bfd_link_info * info, if (!h->non_got_ref) return TRUE; - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -2470,7 +2463,7 @@ _bfd_cr16_elf_adjust_dynamic_symbol (struct bfd_link_info * info, copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection * srel; diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 563e2c075e6..c0da35917b6 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -1,6 +1,6 @@ /* CRIS-specific support for 32-bit ELF. Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011 Free Software Foundation, Inc. + 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Axis Communications AB. Written by Hans-Peter Nilsson, based on elf32-fr30.c PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c. @@ -3052,13 +3052,6 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info, if (!h->non_got_ref) return TRUE; - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -3076,7 +3069,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info, copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index dcf6df08912..10ec4f50d77 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1,6 +1,6 @@ /* BFD back-end for HP PA-RISC ELF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 + 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Original code by @@ -1898,13 +1898,6 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, } } - if (eh->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - eh->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1922,7 +1915,7 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, /* We must generate a COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the runtime process image. */ - if ((eh->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((eh->root.u.def.section->flags & SEC_ALLOC) != 0 && eh->size != 0) { htab->srelbss->size += sizeof (Elf32_External_Rela); eh->needs_copy = 1; diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 80829270331..5f713c794d3 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -1,6 +1,6 @@ /* i370-specific support for 32-bit ELF Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2010, 2011, 2012 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Hacked by Linas Vepstas for i370 linas@linas.org @@ -498,13 +498,6 @@ i370_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (info->shared) return TRUE; - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -529,7 +522,7 @@ i370_elf_adjust_dynamic_symbol (struct bfd_link_info *info, copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 01c06695956..3014a0a83aa 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1,6 +1,6 @@ /* Intel 80386/80486-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -2177,13 +2177,6 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, } } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -2197,7 +2190,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, /* We must generate a R_386_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the runtime process image. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { htab->srelbss->size += sizeof (Elf32_External_Rel); h->needs_copy = 1; diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 07add20c478..667b01c1e05 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -1,5 +1,5 @@ /* Lattice Mico32-specific support for 32-bit ELF - Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Jon Beniston This file is part of BFD, the Binary File Descriptor library. @@ -1863,13 +1863,6 @@ lm32_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1891,7 +1884,7 @@ lm32_elf_adjust_dynamic_symbol (struct bfd_link_info *info, to copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 37d995d14c3..044e328d0ed 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1,6 +1,6 @@ /* M32R-specific support for 32-bit ELF. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1922,13 +1922,6 @@ m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1950,7 +1943,7 @@ m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info, to copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index bd660e9849e..26cec399bf0 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1,6 +1,6 @@ /* Motorola 68k series support for 32-bit ELF Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 + 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -3252,13 +3252,6 @@ elf_m68k_adjust_dynamic_symbol (info, h) if (!h->non_got_ref) return TRUE; - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -3276,7 +3269,7 @@ elf_m68k_adjust_dynamic_symbol (info, h) copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index bbf54a4d672..3125c090f44 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -5045,13 +5045,6 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } - if (h->size == 0) - { - info->callbacks->einfo (_("%P: dynamic variable `%s' is zero size\n"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -5075,7 +5068,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 85a20bdc46b..fcced0f9221 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1,6 +1,6 @@ /* IBM S/390-specific support for 32-bit ELF Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2011 Free Software Foundation, Inc. + 2011, 2012 Free Software Foundation, Inc. Contributed by Carl B. Pedersen and Martin Schwidefsky. This file is part of BFD, the Binary File Descriptor library. @@ -1647,13 +1647,6 @@ elf_s390_adjust_dynamic_symbol (info, h) } } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1669,7 +1662,7 @@ elf_s390_adjust_dynamic_symbol (info, h) /* We must generate a R_390_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the runtime process image. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { htab->srelbss->size += sizeof (Elf32_External_Rela); h->needs_copy = 1; diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 8d8b28c76ac..9bc2dd5a794 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2927,13 +2927,6 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -2951,7 +2944,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info, copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index 19287fec182..6d6b59baac3 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -1,5 +1,5 @@ /* 32-bit ELF support for TI C6X - Copyright 2010, 2011 + Copyright 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Joseph Myers Bernd Schmidt @@ -2157,13 +2157,6 @@ elf32_tic6x_adjust_dynamic_symbol (struct bfd_link_info *info, if (htab == NULL) return FALSE; - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -2177,7 +2170,7 @@ elf32_tic6x_adjust_dynamic_symbol (struct bfd_link_info *info, /* We must generate a R_C6000_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the runtime process image. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { htab->srelbss->size += sizeof (Elf32_External_Rela); h->needs_copy = 1; diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index 48a99aa76e1..a907342ec85 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -1,5 +1,5 @@ /* TILEPro-specific support for 32-bit ELF. - Copyright 2011 Free Software Foundation, Inc. + Copyright 2011, 2012 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -2133,13 +2133,6 @@ tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -2154,7 +2147,7 @@ tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info, to copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rel.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { htab->srelbss->size += TILEPRO_ELF_RELA_BYTES; h->needs_copy = 1; diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 643381c5c43..2908df4712e 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -1,6 +1,6 @@ /* VAX series support for 32-bit ELF Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 + 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Matt Thomas . @@ -1036,13 +1036,6 @@ elf_vax_adjust_dynamic_symbol (info, h) if (info->shared) return TRUE; - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1060,7 +1053,7 @@ elf_vax_adjust_dynamic_symbol (info, h) copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index fc779e62fdd..f4f5d0b0f64 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -6562,13 +6562,6 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* This is a reference to a symbol defined by a dynamic object which is not a function. */ - if (h->size == 0) - { - info->callbacks->einfo (_("%P: dynamic variable `%s' is zero size\n"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -6583,7 +6576,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, to copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { htab->relbss->size += sizeof (Elf64_External_Rela); h->needs_copy = 1; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 06f96a409b9..15e1f7eaaa4 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1,6 +1,6 @@ /* IBM S/390-specific support for 64-bit ELF Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011 Free Software Foundation, Inc. + 2010, 2011, 2012 Free Software Foundation, Inc. Contributed Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of BFD, the Binary File Descriptor library. @@ -1630,13 +1630,6 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info, } } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1654,7 +1647,7 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info, /* We must generate a R_390_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the runtime process image. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { htab->srelbss->size += sizeof (Elf64_External_Rela); h->needs_copy = 1; diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 92024772676..d19bb07d5e5 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -1,6 +1,6 @@ /* SuperH SH64-specific support for 64-bit ELF Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011 Free Software Foundation, Inc. + 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -3376,13 +3376,6 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info, if (!h->non_got_ref) return TRUE; - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -3400,7 +3393,7 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info, copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { asection *srel; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 47f12952d7c..88c47f95e64 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2166,13 +2166,6 @@ elf_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, } } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -2190,7 +2183,7 @@ elf_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, /* We must generate a R_X86_64_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the runtime process image. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { const struct elf_backend_data *bed; bed = get_elf_backend_data (info->output_bfd); diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 355382e5cab..9155311c381 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -2114,13 +2114,6 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -2135,7 +2128,7 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, to copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rel.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { htab->srelbss->size += SPARC_ELF_RELA_BYTES (htab); h->needs_copy = 1; diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index c7fd60422c2..359b869b752 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -1,5 +1,5 @@ /* TILE-Gx-specific support for ELF. - Copyright 2011 Free Software Foundation, Inc. + Copyright 2011, 2012 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -2367,13 +2367,6 @@ tilegx_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } - if (h->size == 0) - { - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), - h->root.root.string); - return TRUE; - } - /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -2388,7 +2381,7 @@ tilegx_elf_adjust_dynamic_symbol (struct bfd_link_info *info, to copy the initial value out of the dynamic object and into the runtime process image. We need to remember the offset into the .rel.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) { htab->srelbss->size += TILEGX_ELF_RELA_BYTES (htab); h->needs_copy = 1; -- 2.30.2