This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] read.c: Don't special case the set directive for COFF
- From: David Majnemer <david dot majnemer at gmail dot com>
- To: David Majnemer <david dot majnemer at gmail dot com>, binutils at sourceware dot org
- Date: Thu, 3 Jul 2014 23:51:36 -0700
- Subject: Re: [PATCH] read.c: Don't special case the set directive for COFF
- Authentication-results: sourceware.org; auth=none
- References: <CAL7bZ_eQO1D5Rp+7FgLUhm6og6=6pm9JzQtfxExsJM3LnckD7w at mail dot gmail dot com> <20140704044858 dot GQ4471 at bubble dot grove dot modra dot org>
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