PATCH: Add "label::"

H. J. Lu hjl@lucon.org
Thu May 1 15:33:00 GMT 2003


Intel ia64 assembler uses "label::" to indicate a global symbol. It
is same as

	.globl label
label:

This patch implements it for ia64. I can make it generic if it is
desired.


H.J.
-------------- next part --------------
2003-04-28  H.J. Lu <hjl@gnu.org>

	* config/tc-ia64.c (ia64_check_label): New.
	* config/tc-ia64.h (tc_check_label): New.

	* read.c (read_a_source_file): Call tc_check_label after
	creating a user-defined label if defined.

--- gas/config/tc-ia64.c.colon	2003-04-28 13:48:54.000000000 -0700
+++ gas/config/tc-ia64.c	2003-04-28 15:58:20.000000000 -0700
@@ -10659,3 +10659,14 @@ ia64_handle_align (fragp)
   memcpy (p, (target_big_endian ? be_nop : le_nop), 16);
   fragp->fr_var = 16;
 }
+
+/* Check if a label should be made global.  */
+void
+ia64_check_label (symbolS *label)
+{
+  if (*input_line_pointer == ':')
+    {
+      S_SET_EXTERNAL (label);
+      input_line_pointer++;
+    }
+}
--- gas/config/tc-ia64.h.colon	2003-04-28 13:48:54.000000000 -0700
+++ gas/config/tc-ia64.h	2003-04-28 15:54:36.000000000 -0700
@@ -90,6 +90,7 @@ extern void ia64_md_do_align PARAMS ((in
 extern void ia64_handle_align PARAMS ((fragS *f));
 extern void ia64_after_parse_args PARAMS ((void));
 extern void ia64_dwarf2_emit_offset PARAMS ((symbolS *, unsigned int));
+extern void ia64_check_label PARAMS ((symbolS *));
 
 #define md_end()       			ia64_end_of_source ()
 #define md_start_line_hook()		ia64_start_line ()
@@ -122,6 +123,7 @@ extern void ia64_dwarf2_emit_offset PARA
 #define md_elf_section_type(str,len)	ia64_elf_section_type (str, len)
 #define md_after_parse_args()		ia64_after_parse_args ()
 #define TC_DWARF2_EMIT_OFFSET		ia64_dwarf2_emit_offset
+#define tc_check_label(l)		ia64_check_label (l)
 
 #define MAX_MEM_FOR_RS_ALIGN_CODE  (15 + 16)
 
--- gas/read.c.colon	2003-03-13 15:56:40.000000000 -0800
+++ gas/read.c	2003-04-28 15:56:44.000000000 -0700
@@ -710,6 +710,9 @@ read_a_source_file (name)
 		  line_label = colon (s);	/* User-defined label.  */
 		  /* Put ':' back for error messages' sake.  */
 		  *input_line_pointer++ = ':';
+#ifdef tc_check_label
+		  tc_check_label (line_label);
+#endif
 		  /* Input_line_pointer->after ':'.  */
 		  SKIP_WHITESPACE ();
 		}
-------------- next part --------------
2003-04-29  H.J. Lu <hjl@gnu.org>

	* gas/ia64/ia64.exp: Add "global".

	* gas/ia64/global.d: New file.
	* gas/ia64/global.s: Likewise.

--- gas/testsuite/gas/ia64/global.d.colon	2003-04-29 11:34:19.000000000 -0700
+++ gas/testsuite/gas/ia64/global.d	2003-04-29 11:32:05.000000000 -0700
@@ -0,0 +1,10 @@
+#readelf: --sym
+#name: ia64 global label
+
+Symbol table '.symtab' contains 5 entries:
+   Num:    Value          Size Type    Bind   Vis      Ndx Name
+     0: 0+0     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 0+0     0 SECTION LOCAL  DEFAULT    1 
+     2: 0+0     0 SECTION LOCAL  DEFAULT    2 
+     3: 0+0     0 SECTION LOCAL  DEFAULT    3 
+     4: 0+0     0 NOTYPE  GLOBAL DEFAULT    2 foo
--- gas/testsuite/gas/ia64/global.s.colon	2003-04-29 11:34:22.000000000 -0700
+++ gas/testsuite/gas/ia64/global.s	2003-04-29 11:13:52.000000000 -0700
@@ -0,0 +1,3 @@
+	.data
+foo::
+	data1 0
--- gas/testsuite/gas/ia64/ia64.exp.colon	2003-04-29 09:19:12.000000000 -0700
+++ gas/testsuite/gas/ia64/ia64.exp	2003-04-29 11:26:50.000000000 -0700
@@ -44,4 +44,5 @@ if [istarget "ia64-*"] then {
 
     run_dump_test "unwind"
     run_dump_test "secname"
+    run_dump_test "global"
 }


More information about the Binutils mailing list