From 909272ee76c4915692763a3dde6b4b1dc21fc166 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 18 Aug 2005 01:28:26 +0000 Subject: * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Warn on zero size dynamic variables. * elf32-arm.c (elf32_arm_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-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-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 (elf64_x86_64_adjust_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. --- bfd/ChangeLog | 21 +++++++++++++++++++++ bfd/elf-m10300.c | 7 +++++++ bfd/elf32-arm.c | 7 +++++++ bfd/elf32-cris.c | 7 +++++++ bfd/elf32-hppa.c | 7 +++++++ bfd/elf32-i370.c | 7 +++++++ bfd/elf32-i386.c | 7 +++++++ bfd/elf32-m32r.c | 7 +++++++ bfd/elf32-m68k.c | 7 +++++++ bfd/elf32-ppc.c | 7 +++++++ bfd/elf32-s390.c | 7 +++++++ bfd/elf32-sh.c | 7 +++++++ bfd/elf32-vax.c | 7 +++++++ bfd/elf64-ppc.c | 7 +++++++ bfd/elf64-s390.c | 7 +++++++ bfd/elf64-sh64.c | 7 +++++++ bfd/elf64-x86-64.c | 7 +++++++ bfd/elfxx-sparc.c | 7 +++++++ 18 files changed, 140 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index af031e0..27b6231 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,24 @@ +2005-08-18 Alan Modra + + * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Warn on + zero size dynamic variables. + * elf32-arm.c (elf32_arm_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-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-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 (elf64_x86_64_adjust_dynamic_symbol): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. + 2005-08-17 H.J. Lu PR binutils/1179 diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index b3f8044..3935c85 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -4099,6 +4099,13 @@ _bfd_mn10300_elf_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 diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 2dc153f..9bc7eef 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -5388,6 +5388,13 @@ 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 diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 618210a..4580bea 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -2380,6 +2380,13 @@ elf_cris_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 diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index e3c45ec..7f20bd6 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1807,6 +1807,13 @@ 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 diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 4062489..c9c4433 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -486,6 +486,13 @@ 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 diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 48e76e9..a2f1b1c 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1462,6 +1462,13 @@ 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 diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 082f496..d2f8508 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1911,6 +1911,13 @@ 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 diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index db320c2..71f98bb 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1081,6 +1081,13 @@ elf_m68k_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 diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 168e58c..bfb1ee8 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4147,6 +4147,13 @@ ppc_elf_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 diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 713ad66..9001a51 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1683,6 +1683,13 @@ 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 diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index b62881c..364ef23 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -3915,6 +3915,13 @@ 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 diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 8faf99c..7a150ba 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -1054,6 +1054,13 @@ 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 diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 31ad3d0..3f219fa 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -5712,6 +5712,13 @@ 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) + { + (*_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 diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index d5ce602..38ce556 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1655,6 +1655,13 @@ 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 diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 9fb6c3e..337b180 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -3434,6 +3434,13 @@ 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 diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 7b06ef4..8511a16 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1247,6 +1247,13 @@ elf64_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 diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index b8b87c9..b83cd14 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -1716,6 +1716,13 @@ _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 -- cgit v1.1