This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hello,

assign_symbol contained special logic specifically for COFF which
would make a symbol specified in a set directive local by default.
Special casing this behavior for COFF doesn't seem warranted and makes
it so that non-external alias names _never_ show up in the symbol
table.

The patch bellow changes assign_symbol so that it behaves just like
ELF in this respect.

Thanks,
David Majnemer


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))
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]