PATCH: Strip # in section name

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


On ia64, # is used to terminate a symbol, including the section name.
Here is a patch.


H.J.
-------------- next part --------------
gas/

2003-04-23  H.J. Lu <hjl@gnu.org>

	* config/tc-ia64.h (tc_canonicalize_section_name): New.

	* config/obj-elf.c (obj_elf_section_name): Call
	tc_canonicalize_section_name if it is defined.

gas/testsuite/

2003-04-23  H.J. Lu <hjl@gnu.org>

	* gas/ia64/ia64.exp: Add secname.

	* gas/ia64/secname.s: New. Test the trailing '#' in section
	name.
	* gas/ia64/secname.d: Likewise.

--- gas/config/obj-elf.c.secname	2003-04-23 11:02:11.000000000 -0700
+++ gas/config/obj-elf.c	2003-04-23 11:34:19.000000000 -0700
@@ -937,6 +937,9 @@ obj_elf_section_name ()
       name = xmalloc (end - input_line_pointer + 1);
       memcpy (name, input_line_pointer, end - input_line_pointer);
       name[end - input_line_pointer] = '\0';
+#ifdef tc_canonicalize_section_name
+      name = tc_canonicalize_section_name (name);
+#endif
       input_line_pointer = end;
     }
   SKIP_WHITESPACE ();
--- gas/config/tc-ia64.h.secname	2003-03-12 09:26:23.000000000 -0800
+++ gas/config/tc-ia64.h	2003-04-23 11:32:32.000000000 -0700
@@ -98,6 +98,7 @@ extern void ia64_dwarf2_emit_offset PARA
 #define md_flush_pending_output()	ia64_flush_pending_output ()
 #define md_parse_name(s,e,c)		ia64_parse_name (s, e)
 #define tc_canonicalize_symbol_name(s)	ia64_canonicalize_symbol_name (s)
+#define tc_canonicalize_section_name(s)	ia64_canonicalize_symbol_name (s)
 #define md_optimize_expr(l,o,r)		ia64_optimize_expr (l, o, r)
 #define md_cons_align(n)		ia64_cons_align (n)
 #define TC_FORCE_RELOCATION(f)		ia64_force_relocation (f)
--- gas/testsuite/gas/ia64/ia64.exp.secname	2003-04-23 11:53:39.000000000 -0700
+++ gas/testsuite/gas/ia64/ia64.exp	2003-04-23 12:18:53.000000000 -0700
@@ -43,4 +43,5 @@ if [istarget "ia64-*"] then {
     run_dump_test "dependency-1"
 
     run_dump_test "unwind"
+    run_dump_test "secname"
 }
--- gas/testsuite/gas/ia64/secname.d.secname	2003-04-23 12:20:03.000000000 -0700
+++ gas/testsuite/gas/ia64/secname.d	2003-04-23 12:21:30.000000000 -0700
@@ -0,0 +1,28 @@
+#readelf: -S
+#name: ia64 section name
+
+There are 8 section headers, starting at offset 0x80:
+
+Section Headers:
+  \[Nr\] Name              Type             Address           Offset
+       Size              EntSize          Flags  Link  Info  Align
+  \[ 0\]                   NULL             0000000000000000  00000000
+       0000000000000000  0000000000000000           0     0     0
+  \[ 1\] \.text             PROGBITS         0000000000000000  00000040
+       0000000000000000  0000000000000000  AX       0     0     16
+  \[ 2\] \.data             PROGBITS         0000000000000000  00000040
+       0000000000000000  0000000000000000  WA       0     0     1
+  \[ 3\] \.bss              NOBITS           0000000000000000  00000040
+       0000000000000000  0000000000000000  WA       0     0     1
+  \[ 4\] \.foo              PROGBITS         0000000000000000  00000040
+       0000000000000008  0000000000000000  WA       0     0     8
+  \[ 5\] \.shstrtab         STRTAB           0000000000000000  00000048
+       0000000000000031  0000000000000000           0     0     1
+  \[ 6\] \.symtab           SYMTAB           0000000000000000  00000280
+       0000000000000078  0000000000000018           7     5     8
+  \[ 7\] \.strtab           STRTAB           0000000000000000  000002f8
+       0000000000000001  0000000000000000           0     0     1
+Key to Flags:
+  W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+  I \(info\), L \(link order\), G \(group\), x \(unknown\)
+  O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
--- gas/testsuite/gas/ia64/secname.s.secname	2003-04-23 12:18:30.000000000 -0700
+++ gas/testsuite/gas/ia64/secname.s	2003-04-23 12:18:21.000000000 -0700
@@ -0,0 +1,2 @@
+	.section .foo#,"aw","progbits"
+	data8 1234


More information about the Binutils mailing list