PATCH: Accept 'o' and "unwind" in section directive

H. J. Lu hjl@lucon.org
Wed Apr 23 19:17:00 GMT 2003


Intel ia64 assembler uses

	section .IA_64.unwind, "ao", "unwind"

where 'o' is for SHF_LINK_ORDER and "unwind" for SHT_IA_64_UNWIND. This
patch makes gas to take them. I could add a generic flag for
SHF_LINK_ORDER. But I am not sure which one to use. Readelf displays
a 'L' for SHF_LINK_ORDER. 'l' seems more logical. But 'o' is used on
ia64. I guess 'l' may be ok. I can send in a patch if it is desired.


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

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

	* config/obj-elf.c (obj_elf_parse_section_letters): Make it a
	fatal error for unknown section attribute.

	* config/tc-alpha.c (alpha_elf_section_letter): Return -1 for
	unknown section attribute.
	* config/tc-ia64.c (ia64_elf_section_letter): Likewise.
	* config/tc-ppc.c (ppc_section_letter): Likewise.

	* config/tc-ia64.c (ia64_elf_section_letter): Ignore 'o'.
	(ia64_elf_section_type): Accept "unwind".

gas/testsuite/

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

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

	* gas/ia64/unwind.s: New. Test the new section attribute 'o'
	and the new section type "unwind".
	* gas/ia64/unwind.d: Likewise.

--- gas/config/obj-elf.c.intel	2003-02-27 11:27:09.000000000 -0800
+++ gas/config/obj-elf.c	2003-03-12 11:03:10.000000000 -0800
@@ -845,10 +845,7 @@ obj_elf_parse_section_letters (str, len)
 	      attr |= md_attr;
 	    else
 #endif
-	      {
-		as_warn ("%s", bad_msg);
-		attr = -1;
-	      }
+	      as_fatal ("%s", bad_msg);
 	  }
 	  break;
 	}
--- gas/config/tc-alpha.c.intel	2003-01-23 09:20:43.000000000 -0800
+++ gas/config/tc-alpha.c	2003-03-12 11:05:55.000000000 -0800
@@ -5637,7 +5637,7 @@ alpha_elf_section_letter (letter, ptr_ms
     return SHF_ALPHA_GPREL;
 
   *ptr_msg = _("Bad .section directive: want a,s,w,x,M,S,G,T in string");
-  return 0;
+  return -1;
 }
 
 /* Map SHF_ALPHA_GPREL to SEC_SMALL_DATA.  */
--- gas/config/tc-ia64.c.intel	2003-03-12 09:26:23.000000000 -0800
+++ gas/config/tc-ia64.c	2003-03-12 11:03:04.000000000 -0800
@@ -959,9 +959,13 @@ ia64_elf_section_letter (letter, ptr_msg
 {
   if (letter == 's')
     return SHF_IA_64_SHORT;
+  /* We ignore 'o', which is accepted by Intel assembler to indicate
+     SHF_LINK_ORDER. But I am not sure if it does anything useful.  */
+  else if (letter == 'o')
+    return 0;
 
   *ptr_msg = _("Bad .section directive: want a,s,w,x,M,S,G,T in string");
-  return 0;
+  return -1;
 }
 
 /* Map SHF_IA_64_SHORT to SEC_SMALL_DATA.  */
@@ -995,6 +999,9 @@ ia64_elf_section_type (str, len)
   if (STREQ (ELF_STRING_ia64_unwind_once))
     return SHT_IA_64_UNWIND;
 
+  if (STREQ ("unwind"))
+    return SHT_IA_64_UNWIND;
+
   if (STREQ ("init_array"))
     return SHT_INIT_ARRAY;
 
--- gas/config/tc-ppc.c.intel	2003-02-27 11:27:09.000000000 -0800
+++ gas/config/tc-ppc.c	2003-03-12 11:05:47.000000000 -0800
@@ -2746,7 +2746,7 @@ ppc_section_letter (letter, ptr_msg)
     return SHF_EXCLUDE;
 
   *ptr_msg = _("Bad .section directive: want a,e,w,x,M,S,G,T in string");
-  return 0;
+  return -1;
 }
 
 int
--- gas/testsuite/gas/ia64/ia64.exp.unwind	2003-04-08 10:00:09.000000000 -0700
+++ gas/testsuite/gas/ia64/ia64.exp	2003-04-23 11:53:39.000000000 -0700
@@ -41,4 +41,6 @@ if [istarget "ia64-*"] then {
     run_dump_test "ltoff22x-1"
     
     run_dump_test "dependency-1"
+
+    run_dump_test "unwind"
 }
--- gas/testsuite/gas/ia64/unwind.d.unwind	2003-04-23 11:59:31.000000000 -0700
+++ gas/testsuite/gas/ia64/unwind.d	2003-04-23 11:58:37.000000000 -0700
@@ -0,0 +1,29 @@
+#readelf: -S
+
+There are 9 section headers, starting at offset 0xa0:
+
+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\] \.IA_64\.unwind_inf PROGBITS         0000000000000000  00000040
+       0000000000000008  0000000000000000   A       0     0     8
+  \[ 5\] \.IA_64\.unwind     IA_64_UNWIND     0000000000000000  00000048
+       0000000000000008  0000000000000000  AL       1     1     8
+  \[ 6\] \.shstrtab         STRTAB           0000000000000000  00000050
+       000000000000004d  0000000000000000           0     0     1
+  \[ 7\] \.symtab           SYMTAB           0000000000000000  000002e0
+       0000000000000090  0000000000000018           8     6     8
+  \[ 8\] \.strtab           STRTAB           0000000000000000  00000370
+       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/unwind.s.unwind	2003-04-23 11:59:27.000000000 -0700
+++ gas/testsuite/gas/ia64/unwind.s	2003-04-23 11:49:24.000000000 -0700
@@ -0,0 +1,4 @@
+	.section .IA_64.unwind_info, "a", "progbits"
+	data8 1234
+	.section .IA_64.unwind, "ao", "unwind"
+	data8 1234


More information about the Binutils mailing list