diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2019-04-11 06:44:53 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2019-04-11 06:45:05 -0700 |
commit | a0ea3a14dc6a6062c0c1f2bfbb7ad0373ec20843 (patch) | |
tree | 973f90b3615d7ba892c8d6e7e02e614c362c7cf1 /bfd | |
parent | 9bff840e8cc560f5096a43609ed3e0d980733fd9 (diff) | |
download | gdb-a0ea3a14dc6a6062c0c1f2bfbb7ad0373ec20843.zip gdb-a0ea3a14dc6a6062c0c1f2bfbb7ad0373ec20843.tar.gz gdb-a0ea3a14dc6a6062c0c1f2bfbb7ad0373ec20843.tar.bz2 |
Check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry
Instead of BFD_ASSERT (h != NULL) with
ld: BFD ... assertion fail .../bfd/elf64-x86-64.c:2562
ld: bad.o: invalid string offset 50331648 >= 371 for section `nterp'
check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry with
ld: bad.o: section 'g': corrupt VTENTRY entry
* elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of
"h != NULL". Don't check "h != NULL" before calling.
bfd_elf_gc_record_vtentry.
* elf32-arm.c (elf32_arm_check_relocs): Likewise.
* elf32-bfin.c (bfin_check_relocs): Likewise.
* elf32-cris.c (cris_elf_check_relocs): Likewise.
* elf32-csky.c (csky_elf_check_relocs): Likewise.
* elf32-d10v.c (elf32_d10v_check_relocs): Likewise.
* elf32-dlx.c (elf32_dlx_check_relocs): Likewise.
* elf32-fr30.c (fr30_elf_check_relocs): Likewise.
* elf32-frv.c (elf32_frv_check_relocs): Likewise.
* elf32-hppa.c (elf32_hppa_check_relocs): Likewise.
* elf32-i386.c (elf_i386_check_relocs): Likewise.
* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
* elf32-m68k.c (elf_m68k_check_relocs): Likewise.
* elf32-mcore.c (mcore_elf_check_relocs): Likewise.
* elf32-metag.c (elf_metag_check_relocs): Likewise.
* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
* elf32-s390.c (elf_s390_check_relocs): Likewise.
* elf32-sh.c (sh_elf_check_relocs): Likewise.
* elf32-v850.c (v850_elf_check_relocs): Likewise.
* elf32-vax.c (elf_vax_check_relocs): Likewise.
* elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise.
* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
* elf64-mmix.c (mmix_elf_check_relocs): Likewise.
* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
* elf64-s390.c (elf_s390_check_relocs): Likewise.
* elf64-x86-64.c (elf_s390_check_relocs): Likewise.
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
* elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt
VTENTRY entry.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 38 | ||||
-rw-r--r-- | bfd/elf-m10300.c | 4 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 4 | ||||
-rw-r--r-- | bfd/elf32-bfin.c | 4 | ||||
-rw-r--r-- | bfd/elf32-cris.c | 4 | ||||
-rw-r--r-- | bfd/elf32-csky.c | 4 | ||||
-rw-r--r-- | bfd/elf32-d10v.c | 4 | ||||
-rw-r--r-- | bfd/elf32-dlx.c | 4 | ||||
-rw-r--r-- | bfd/elf32-fr30.c | 4 | ||||
-rw-r--r-- | bfd/elf32-frv.c | 4 | ||||
-rw-r--r-- | bfd/elf32-hppa.c | 4 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 4 | ||||
-rw-r--r-- | bfd/elf32-iq2000.c | 4 | ||||
-rw-r--r-- | bfd/elf32-m32r.c | 8 | ||||
-rw-r--r-- | bfd/elf32-m68hc1x.c | 4 | ||||
-rw-r--r-- | bfd/elf32-m68k.c | 4 | ||||
-rw-r--r-- | bfd/elf32-mcore.c | 4 | ||||
-rw-r--r-- | bfd/elf32-metag.c | 4 | ||||
-rw-r--r-- | bfd/elf32-or1k.c | 4 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 4 | ||||
-rw-r--r-- | bfd/elf32-s390.c | 4 | ||||
-rw-r--r-- | bfd/elf32-sh.c | 4 | ||||
-rw-r--r-- | bfd/elf32-v850.c | 4 | ||||
-rw-r--r-- | bfd/elf32-vax.c | 4 | ||||
-rw-r--r-- | bfd/elf32-xstormy16.c | 4 | ||||
-rw-r--r-- | bfd/elf32-xtensa.c | 4 | ||||
-rw-r--r-- | bfd/elf64-mmix.c | 4 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 4 | ||||
-rw-r--r-- | bfd/elf64-s390.c | 4 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 4 | ||||
-rw-r--r-- | bfd/elflink.c | 12 | ||||
-rw-r--r-- | bfd/elfxx-mips.c | 4 | ||||
-rw-r--r-- | bfd/elfxx-sparc.c | 4 |
33 files changed, 80 insertions, 98 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a3cdfc6..4c42905 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,41 @@ +2019-04-11 H.J. Lu <hongjiu.lu@intel.com> + + * elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of + "h != NULL". Don't check "h != NULL" before calling. + bfd_elf_gc_record_vtentry. + * elf32-arm.c (elf32_arm_check_relocs): Likewise. + * elf32-bfin.c (bfin_check_relocs): Likewise. + * elf32-cris.c (cris_elf_check_relocs): Likewise. + * elf32-csky.c (csky_elf_check_relocs): Likewise. + * elf32-d10v.c (elf32_d10v_check_relocs): Likewise. + * elf32-dlx.c (elf32_dlx_check_relocs): Likewise. + * elf32-fr30.c (fr30_elf_check_relocs): Likewise. + * elf32-frv.c (elf32_frv_check_relocs): Likewise. + * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. + * elf32-i386.c (elf_i386_check_relocs): Likewise. + * elf32-iq2000.c (iq2000_elf_check_relocs): Likewise. + * elf32-m32r.c (m32r_elf_check_relocs): Likewise. + * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. + * elf32-m68k.c (elf_m68k_check_relocs): Likewise. + * elf32-mcore.c (mcore_elf_check_relocs): Likewise. + * elf32-metag.c (elf_metag_check_relocs): Likewise. + * elf32-or1k.c (or1k_elf_check_relocs): Likewise. + * elf32-ppc.c (ppc_elf_check_relocs): Likewise. + * elf32-s390.c (elf_s390_check_relocs): Likewise. + * elf32-sh.c (sh_elf_check_relocs): Likewise. + * elf32-v850.c (v850_elf_check_relocs): Likewise. + * elf32-vax.c (elf_vax_check_relocs): Likewise. + * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. + * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise. + * elf64-mmix.c (mmix_elf_check_relocs): Likewise. + * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. + * elf64-s390.c (elf_s390_check_relocs): Likewise. + * elf64-x86-64.c (elf_s390_check_relocs): Likewise. + * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. + * elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt + VTENTRY entry. + 2019-04-11 Alan Modra <amodra@gmail.com> PR 24435 diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 398636a..f0ef8eb 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -1136,9 +1136,7 @@ mn10300_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_MN10300_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) goto fail; break; diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index b5b2dab..03f3a59 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -15380,9 +15380,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_ARM_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) return FALSE; break; } diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 2e4751f..db052a1 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1210,9 +1210,7 @@ bfin_check_relocs (bfd * abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_BFIN_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 520b61a..595c36b 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -3485,9 +3485,7 @@ cris_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_CRIS_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index fb380b1..b3451b6 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -2873,9 +2873,7 @@ csky_elf_check_relocs (bfd * abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_CKCORE_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; } diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index 0c05106..4cd0aec 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -308,9 +308,7 @@ elf32_d10v_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_D10V_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) return FALSE; break; } diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c index f66e944..edddcb1 100644 --- a/bfd/elf32-dlx.c +++ b/bfd/elf32-dlx.c @@ -465,9 +465,7 @@ elf32_dlx_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_DLX_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; } diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index 3a0c3ae..6a13767 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -687,9 +687,7 @@ fr30_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_FR30_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; } diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index ebc101e..8c6a97d 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -6237,9 +6237,7 @@ elf32_frv_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_FRV_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 95b729a..a61adbc 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1273,9 +1273,7 @@ elf32_hppa_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_PARISC_GNU_VTENTRY: - BFD_ASSERT (hh != NULL); - if (hh != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, &hh->eh, rela->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, &hh->eh, rela->r_addend)) return FALSE; continue; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 5d3f2eb..d2ea5a7 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1908,9 +1908,7 @@ do_size: /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_386_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) goto error_return; break; diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index 0961226..6e47027 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -501,9 +501,7 @@ iq2000_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_IQ2000_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 92ed2d1..8f05a5e 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -3807,15 +3807,11 @@ m32r_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_M32R_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) return FALSE; break; case R_M32R_RELA_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; } diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 7a01749..6a99678 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -890,9 +890,7 @@ elf32_m68hc11_check_relocs (bfd *abfd, struct bfd_link_info *info, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_M68HC11_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; } diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 8d0eab0..0fe5466 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -2801,9 +2801,7 @@ elf_m68k_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_68K_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 764623c..7bca458 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -628,9 +628,7 @@ mcore_elf_check_relocs (bfd * abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_MCORE_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; } diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index 6d48c8c..f68f9dc 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -2374,9 +2374,7 @@ elf_metag_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_METAG_GNU_VTENTRY: - BFD_ASSERT (hh != NULL); - if (hh != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, &hh->eh, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, &hh->eh, rel->r_addend)) return FALSE; break; } diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index 2f200b1..c1bbac9 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -1927,9 +1927,7 @@ or1k_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_OR1K_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 6991e8d..e73539a 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -3316,9 +3316,7 @@ ppc_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_PPC_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 49a301f..7bdccdb 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1366,9 +1366,7 @@ elf_s390_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_390_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index d66ac12..91900b8 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -5570,9 +5570,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_SH_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 0de095d..90a18d3 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -101,9 +101,7 @@ v850_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_V850_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 10c01a9..2af7050 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -783,9 +783,7 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_VAX_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index a64513d..05a9326 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -513,9 +513,7 @@ xstormy16_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_XSTORMY16_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; } diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 37ea200..09625e6 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -1102,9 +1102,7 @@ elf_xtensa_check_relocs (bfd *abfd, case R_XTENSA_GNU_VTENTRY: /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; continue; diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index d332151..839bd45 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -2004,9 +2004,7 @@ mmix_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_MMIX_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; } diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 5be3fe0..a795ad1 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -4555,9 +4555,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_PPC64_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 3879676..6bc6dfd 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1301,9 +1301,7 @@ elf_s390_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_390_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 6790228..27e23a0 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2373,9 +2373,7 @@ do_size: /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_X86_64_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) goto error_return; break; diff --git a/bfd/elflink.c b/bfd/elflink.c index 8aae980..81e667d 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -13727,14 +13727,22 @@ bfd_elf_gc_record_vtinherit (bfd *abfd, /* Called from check_relocs to record the existence of a VTENTRY reloc. */ bfd_boolean -bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED, - asection *sec ATTRIBUTE_UNUSED, +bfd_elf_gc_record_vtentry (bfd *abfd, asection *sec, struct elf_link_hash_entry *h, bfd_vma addend) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); unsigned int log_file_align = bed->s->log_file_align; + if (!h) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: section '%pA': corrupt VTENTRY entry"), + abfd, sec); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + if (!h->u2.vtable) { h->u2.vtable = ((struct elf_link_virtual_table_entry *) diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 5998bc4..74dadf4 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -8992,9 +8992,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_MIPS_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) return FALSE; break; diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index f09dcbd..e479884 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -1837,9 +1837,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, break; case R_SPARC_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; |