cygming.h (READONLY_DATA_SECTION_ASM_OP): Define.
authorDanny Smith <dannysmith@users.sourceforge.net>
Tue, 7 Oct 2003 09:36:34 +0000 (09:36 +0000)
committerDanny Smith <dannysmith@gcc.gnu.org>
Tue, 7 Oct 2003 09:36:34 +0000 (09:36 +0000)
* config/i386/cygming.h (READONLY_DATA_SECTION_ASM_OP): Define.
(switch_to_section): Handle in_readonly_data.
* config/i386/winnt.c (i386_pe_asm_named_section): Handle
readonly data.

From-SVN: r72189

gcc/ChangeLog
gcc/config/i386/cygming.h
gcc/config/i386/winnt.c

index f8e3e054510fd310f4c271eeeecf2cec06348ac0..b6836c2e8c823b48c652a4d288567618feb9561d 100644 (file)
@@ -1,3 +1,10 @@
+2003-10-07  Danny Smith  <dannysmith@users.sourceforge.net>
+
+       * config/i386/cygming.h (READONLY_DATA_SECTION_ASM_OP): Define.
+       (switch_to_section): Handle in_readonly_data.
+       * config/i386/winnt.c (i386_pe_asm_named_section): Handle
+       readonly data.
+
 2003-10-07  Richard Earnshaw  <rearnsha@arm.com>
 
        * arm.md (cmpsi2_addneg): New ARM pattern. Add peephole2 to generate
index d0e019e5805390776575c9dc01b8de8e56c7d2f8..dfdb499492798d7606da629bec565e3768485f09 100644 (file)
@@ -132,6 +132,10 @@ drectve_section (void)                                                     \
 }
 void drectve_section (void);
 
+/* Older versions of gas don't handle 'r' as data.
+   Explicitly set data flag with 'd'.  */  
+#define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata,\"dr\""
+
 /* Switch to SECTION (an `enum in_section').
 
    ??? This facility should be provided by GCC proper.
@@ -147,6 +151,7 @@ switch_to_section (enum in_section section, tree decl)              \
     {                                                          \
       case in_text: text_section (); break;                    \
       case in_data: data_section (); break;                    \
+      case in_readonly_data: readonly_data_section (); break;  \
       case in_named: named_section (decl, NULL, 0); break;     \
       case in_drectve: drectve_section (); break;              \
       default: abort (); break;                                \
index 666b9bd35b08cd8098f2868401123181e25220aa..c1c54956fdc755ec942d47ef1a0416cd152e2f80 100644 (file)
@@ -710,12 +710,22 @@ i386_pe_asm_named_section (const char *name, unsigned int flags)
 {
   char flagchars[8], *f = flagchars;
 
-  if (flags & SECTION_CODE)
-    *f++ = 'x';
-  if (flags & SECTION_WRITE)
-    *f++ = 'w';
-  if (flags & SECTION_PE_SHARED)
-    *f++ = 's';
+  if ((flags & (SECTION_CODE | SECTION_WRITE)) == 0)
+    /* readonly data */
+    {
+      *f++ ='d';  /* This is necessary for older versions of gas.  */
+      *f++ ='r';
+    }
+  else 
+  {
+    if (flags & SECTION_CODE)
+      *f++ = 'x';
+    if (flags & SECTION_WRITE)
+      *f++ = 'w';
+    if (flags & SECTION_PE_SHARED)
+      *f++ = 's';
+  }
+
   *f = '\0';
 
   fprintf (asm_out_file, "\t.section\t%s,\"%s\"\n", name, flagchars);