[PATCH 6/6] bfd: strip symbols not representable in COFF/PE symbol table
Alan Modra
amodra@gmail.com
Thu Mar 4 06:15:33 GMT 2021
On Tue, Mar 02, 2021 at 10:50:59AM +0100, Jan Beulich via Binutils wrote:
> The offset-within-section field in the symbol table entry is only 32
> bits wide, so rather than emitting bogus entries omit them, and issue
> a diagnostic identifying the issue.
>
> This requires adjusting the PR/22267 test to no longer produce symbols
> with out of range values on 64-bit BFD. This also depends on
> adjustments to testsuite/ld-scripts/map-address.* made by an earlier
> patch. The purpose of the test can very well be achieved nevertheless.
>
> bfd/
> 2021-02-XX Jan Beulich <jbeulich@suse.com>
>
> * cofflink.c (_bfd_coff_write_global_sym): Range-check symbol
> offset.
>
> ld/
> 2021-02-XX Jan Beulich <jbeulich@suse.com>
>
> * testsuite/ld-scripts/pr22267.t: Avoid symbol value with more
> than 32 set bits.
> * testsuite/ld-scripts/pr22267.d: Adjust expectation and drop
> comment.
OK.
> --- a/bfd/cofflink.c
> +++ b/bfd/cofflink.c
> @@ -2602,6 +2602,16 @@ _bfd_coff_write_global_sym (struct bfd_h
> + h->root.u.def.section->output_offset);
> if (! obj_pe (flaginfo->output_bfd))
> isym.n_value += sec->vma;
> +#ifdef BFD64
> + if (isym.n_value > (bfd_vma)0xffffffff)
space here after cast.
> + {
> + if (! h->root.linker_def)
> + _bfd_error_handler
> + (_("%pB: stripping non-representable symbol '%s' (value %"BFD_VMA_FMT"x)"),
overlong line.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list