From c74e2f82fa2512e160cf5ec38778da393cc6a6d4 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 18 Aug 2005 01:28:26 +0000 Subject: [PATCH] * 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 af031e0b8c..27b6231106 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 b3f80449db..3935c85edd 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 2dc153f51a..9bc7eefe4b 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 618210a121..4580beabd9 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 e3c45ec9ef..7f20bd6aa2 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 406248937b..c9c4433780 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 48e76e916e..a2f1b1c660 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 082f496ccd..d2f850891e 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 db320c229c..71f98bb671 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 168e58cdaf..bfb1ee8390 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 713ad66acd..9001a51cde 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 b62881ce53..364ef237dd 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 8faf99c519..7a150ba739 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 31ad3d0e30..3f219fa9d7 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 d5ce602257..38ce556446 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 9fb6c3e7e1..337b1809c8 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 7b06ef4a71..8511a1643c 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 b8b87c9128..b83cd140d8 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 -- 2.11.0