[4/8] x86: limit 32-bit @size overflow checks to 64-bit objects

Message ID c33dbdfd-886e-52ae-9705-8ed6ba446996@suse.com
State New
Headers show
Series
  • x86: assorted relocation handling related adjustments (part II)
Related show

Commit Message

Luis Machado via Binutils April 23, 2021, 8:36 a.m.
For 32-bit objects the behavior should not be dependent upon the build
being a BFD64 one.

gas/
2021-04-XX  Jan Beulich  <jbeulich@suse.com>

	* config/tc-i386.c (tc_gen_reloc): Limit BFD_RELOC_SIZE32
	overflow check to 64-bit objects.

Comments

Luis Machado via Binutils April 23, 2021, 1:18 p.m. | #1
On Fri, Apr 23, 2021 at 1:36 AM Jan Beulich <jbeulich@suse.com> wrote:
>

> For 32-bit objects the behavior should not be dependent upon the build

> being a BFD64 one.

>

> gas/

> 2021-04-XX  Jan Beulich  <jbeulich@suse.com>

>

>         * config/tc-i386.c (tc_gen_reloc): Limit BFD_RELOC_SIZE32

>         overflow check to 64-bit objects.

>

> --- a/gas/config/tc-i386.c

> +++ b/gas/config/tc-i386.c

> @@ -14240,6 +14240,7 @@ tc_gen_reloc (asection *section ATTRIBUT

>              the symbol plus addend.  */

>           valueT value = S_GET_SIZE (fixp->fx_addsy) + fixp->fx_offset;

>           if (fixp->fx_r_type == BFD_RELOC_SIZE32

> +             && object_64bit

>               && !fits_in_unsigned_long (value))

>             as_bad_where (fixp->fx_file, fixp->fx_line,

>                           _("symbol size computation overflow"));

>


OK.

Thanks.

-- 
H.J.

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -14240,6 +14240,7 @@  tc_gen_reloc (asection *section ATTRIBUT
 	     the symbol plus addend.  */
 	  valueT value = S_GET_SIZE (fixp->fx_addsy) + fixp->fx_offset;
 	  if (fixp->fx_r_type == BFD_RELOC_SIZE32
+	      && object_64bit
 	      && !fits_in_unsigned_long (value))
 	    as_bad_where (fixp->fx_file, fixp->fx_line,
 			  _("symbol size computation overflow"));