[PATCH] read.c: Don't special case the set directive for COFF

David Majnemer david.majnemer@gmail.com
Thu Jul 10 15:50:00 GMT 2014


On Thu, Jul 3, 2014 at 11:51 PM, David Majnemer
<david.majnemer@gmail.com> wrote:
>
> On Thu, Jul 3, 2014 at 9:48 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Thu, Jul 03, 2014 at 10:08:03PM -0400, David Majnemer wrote:
> >> diff --git a/gas/read.c b/gas/read.c
> >> index 8e1b06e..1e148d8 100644
> >> --- a/gas/read.c
> >> +++ b/gas/read.c
> >> @@ -3187,10 +3187,6 @@ assign_symbol (char *name, int mode)
> >>           symbol_set_frag (symbolP, dummy_frag);
> >>         }
> >>  #endif
> >> -#ifdef OBJ_COFF
> >> -      /* "set" symbols are local unless otherwise specified.  */
> >> -      SF_SET_LOCAL (symbolP);
> >> -#endif
> >>      }
> >>
> >>    if (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
> >
> > The above code can be traced right back to git revision fecd2382,
> > 1991-04-04.  Instead of deleting it, you probably should be disabling
> > it for PE.
>
>
> I looked at that revision but couldn't find any justification as to
> why the code was there in the first place.
> Regardless, your suggestion sounds fine to me.  Patch updated.
>
>
> diff --git a/gas/read.c b/gas/read.c
> index 8e1b06e..183ef2c 100644
> --- a/gas/read.c
> +++ b/gas/read.c
> @@ -3187,7 +3187,7 @@ assign_symbol (char *name, int mode)
>           symbol_set_frag (symbolP, dummy_frag);
>         }
>  #endif
> -#ifdef OBJ_COFF
> +#if defined (OBJ_COFF) && !defined (TE_PE)
>        /* "set" symbols are local unless otherwise specified.  */
>        SF_SET_LOCAL (symbolP);
>  #endif
> diff --git a/gas/testsuite/gas/pe/pe.exp b/gas/testsuite/gas/pe/pe.exp
> index c1c5f49..0fab53d 100644
> --- a/gas/testsuite/gas/pe/pe.exp
> +++ b/gas/testsuite/gas/pe/pe.exp
> @@ -36,6 +36,8 @@ run_dump_test "section-align-1"
>  run_dump_test "section-align-3"
>  run_dump_test "section-exclude"
>
> +run_dump_test "set"
> +
>  # SEH related tests
>
>  # These tests are only for x86_64 targets
> diff --git a/gas/testsuite/gas/pe/set.d b/gas/testsuite/gas/pe/set.d
> new file mode 100644
> index 0000000..99f2d5a
> --- /dev/null
> +++ b/gas/testsuite/gas/pe/set.d
> @@ -0,0 +1,11 @@
> +#nm: --defined-only
> +#name: set directive in COFF
> +#
> +# Ensure that we stick an entry for the left hand side of a set directive
> +# depending on the name of the left hand side.
> +
> +#...
> +.* t _b
> +#...
> +.* T _d
> +#...
> diff --git a/gas/testsuite/gas/pe/set.s b/gas/testsuite/gas/pe/set.s
> new file mode 100644
> index 0000000..a19e797
> --- /dev/null
> +++ b/gas/testsuite/gas/pe/set.s
> @@ -0,0 +1,9 @@
> +L_a:
> +.long   0
> +
> +_b = L_a
> +
> +L_c = L_a
> +
> +.globl _d
> +_d = L_a


Ping.



More information about the Binutils mailing list