OSDN Git Service

* config/i386/cygming.h (READONLY_DATA_SECTION_ASM_OP): Define.
authordannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Oct 2003 09:36:34 +0000 (09:36 +0000)
committerdannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Oct 2003 09:36:34 +0000 (09:36 +0000)
(switch_to_section): Handle in_readonly_data.
* config/i386/winnt.c (i386_pe_asm_named_section): Handle
readonly data.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72189 138bc75d-0d04-0410-961f-82ee72b054a4

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

index f8e3e05..b6836c2 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 d0e019e..dfdb499 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 666b9bd..c1c5495 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);