[5/8] x86: add IS_ELF to check whether to resolve @size reloc

Message ID b74974a7-1aea-181c-b6bb-59aec32fe12b@suse.com
State New
Headers show
Series
  • x86: assorted relocation handling related adjustments (part II)
Related show

Commit Message

Claudiu Zissulescu via Binutils April 23, 2021, 8:36 a.m.
This may not be strictly needed, as BFD_RELOC_SIZE* shouldn't appear
from elsewhere for non-ELF, but let's be on the safe side.

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

	* config/tc-i386.c (tc_gen_reloc): Check IS_ELF for
	BFD_RELOC_SIZE*.

Comments

Claudiu Zissulescu 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:
>

> This may not be strictly needed, as BFD_RELOC_SIZE* shouldn't appear

> from elsewhere for non-ELF, but let's be on the safe side.

>

> gas/

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

>

>         * config/tc-i386.c (tc_gen_reloc): Check IS_ELF for

>         BFD_RELOC_SIZE*.

>

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

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

> @@ -14233,7 +14233,8 @@ tc_gen_reloc (asection *section ATTRIBUT

>  #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)

>      case BFD_RELOC_SIZE32:

>      case BFD_RELOC_SIZE64:

> -      if (S_IS_DEFINED (fixp->fx_addsy)

> +      if (IS_ELF

> +         && S_IS_DEFINED (fixp->fx_addsy)

>           && !S_IS_EXTERNAL (fixp->fx_addsy))

>         {

>           /* Resolve size relocation against local symbol to size of

>


OK.

Thanks.

-- 
H.J.

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -14233,7 +14233,8 @@  tc_gen_reloc (asection *section ATTRIBUT
 #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
     case BFD_RELOC_SIZE32:
     case BFD_RELOC_SIZE64:
-      if (S_IS_DEFINED (fixp->fx_addsy)
+      if (IS_ELF
+	  && S_IS_DEFINED (fixp->fx_addsy)
 	  && !S_IS_EXTERNAL (fixp->fx_addsy))
 	{
 	  /* Resolve size relocation against local symbol to size of