aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-03-28 16:53:32 +1030
committerAlan Modra <amodra@gmail.com>2019-03-28 17:10:31 +1030
commit242a115951fe55e62036bac555017eb817ca1aa6 (patch)
treec7e676c00296cd37ed77da28fa4b43d43e835887 /bfd/elf.c
parent96a86c01d119372f4af5aff2501d3104e6c1a8e3 (diff)
downloadgdb-242a115951fe55e62036bac555017eb817ca1aa6.zip
gdb-242a115951fe55e62036bac555017eb817ca1aa6.tar.gz
gdb-242a115951fe55e62036bac555017eb817ca1aa6.tar.bz2
PR24392, Clang warning Wtautological-constant-out-of-range-compare
PR 24392 * configure.ac: Invoke AC_CHECK_SIZEOF(int). * configure: Regenerate. * coffgen.c (coff_get_reloc_upper_bound): Replace gcc diagnostic workaround with SIZEOF_LONG vs. SIZEOF_INT check. * elf.c (_bfd_elf_get_reloc_upper_bound): Likewise. * elf64-sparc.c (elf64_sparc_get_reloc_upper_bound): Likewise. * mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 73fb869..13f96e8 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -8268,25 +8268,19 @@ _bfd_elf_get_dynamic_symtab_upper_bound (bfd *abfd)
return symtab_size;
}
-#if GCC_VERSION >= 4003
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wtype-limits"
-#endif
long
_bfd_elf_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED,
sec_ptr asect)
{
-
+#if SIZEOF_LONG == SIZEOF_INT
if (asect->reloc_count >= LONG_MAX / sizeof (arelent *))
{
bfd_set_error (bfd_error_file_too_big);
return -1;
}
+#endif
return (asect->reloc_count + 1) * sizeof (arelent *);
}
-#if GCC_VERSION >= 4003
-# pragma GCC diagnostic pop
-#endif
/* Canonicalize the relocs. */