winnt.c (i386_pe_valid_decl_attribute_p): Recognize shared as a valid attribute.
authorMumit Khan <khan@xraylith.wisc.edu>
Tue, 14 Sep 1999 10:06:06 +0000 (10:06 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 14 Sep 1999 10:06:06 +0000 (04:06 -0600)
        * i386/winnt.c (i386_pe_valid_decl_attribute_p): Recognize
        shared as a valid attribute.
        * i386/cygwin.h (ASM_OUTPUT_SECTION): Handle shared attribute.
        * extend.texi: Document `shared' variable attribute.

From-SVN: r29404

gcc/ChangeLog
gcc/config/i386/cygwin.h
gcc/config/i386/winnt.c
gcc/extend.texi

index 9e0f1f7e3b7bb2a876b1cdf87cd7f4dd534b7185..6a6f65824e0f23f62d8a8c06d208beb311e7d142 100644 (file)
@@ -1,3 +1,10 @@
+Tue Sep 14 04:03:44 1999  Mumit Khan  <khan@xraylith.wisc.edu>
+
+       * i386/winnt.c (i386_pe_valid_decl_attribute_p): Recognize
+       shared as a valid attribute.
+       * i386/cygwin.h (ASM_OUTPUT_SECTION): Handle shared attribute.
+       * extend.texi: Document `shared' variable attribute.
+
 Tue Sep 14 04:01:46 1999  Loren Rittle  <ljrittle@acm.org>
 
        * configure.in: Handle --enable-threads on FreeBSD.
index a6e967f15257bf8c2203198c21f9c10e904cbb3e..023f4b0221bbcb3ac3099545957a5a9c547ab857 100644 (file)
@@ -405,7 +405,14 @@ do {                                                                       \
   else if (DECL && DECL_READONLY_SECTION (DECL, RELOC))                        \
     type = SECT_RO, mode = "";                                         \
   else                                                                 \
-    type = SECT_RW, mode = "w";                                                \
+    {                                                                  \
+      type = SECT_RW;                                                  \
+      if (TREE_CODE (DECL) == VAR_DECL                                 \
+          && lookup_attribute ("shared", DECL_MACHINE_ATTRIBUTES (DECL))) \
+        mode = "ws";                                                   \
+      else                                                             \
+        mode = "w";                                                    \
+    }                                                                  \
                                                                        \
   if (s == 0)                                                          \
     {                                                                  \
index bda9311a42aa503ba9bbede2861634f1651fd019..2c2ce763359cef410da22d57134f213d87a9b370 100644 (file)
@@ -56,6 +56,8 @@ i386_pe_valid_decl_attribute_p (decl, attributes, attr, args)
        return 1;
       if (is_attribute_p ("dllimport", attr))
        return 1;
+      if (is_attribute_p ("shared", attr))
+       return TREE_CODE (decl) == VAR_DECL;
     }
 
   return ix86_valid_decl_attribute_p (decl, attributes, attr, args);
index 5b5f3b116c6fd16c197865f902de3e218c60dd08..4ec451d3373218bb034cf1b94f3b8b04fad02fdb 100644 (file)
@@ -2015,6 +2015,32 @@ attribute is not available on all platforms.
 If you need to map the entire contents of a module to a particular
 section, consider using the facilities of the linker instead.
 
+@item shared
+@cindex @code{shared} variable attribute
+On Windows NT, in addition to nputting variable definitions in a named 
+section, the section can also be shared among all running copies of an 
+executable or DLL. For example, this small program defines shared data 
+by putting it in a named section "shared" and marking the section 
+shareable:
+
+@smallexample
+int foo __attribute__((section ("shared"), shared)) = 0;
+
+int
+main()
+@{
+  /* Read and write foo. All running copies see the same value. */
+  return 0;
+@}
+@end smallexample
+
+@noindent
+You may only use the @code{shared} attribute along with @code{section}
+attribute with a fully initialized global definition because of the way 
+linkers work.  See @code{section} attribute for more information.
+
+The @code{shared} attribute is only available on Windows NT.
+
 @item transparent_union
 This attribute, attached to a function parameter which is a union, means
 that the corresponding argument may have the type of any union member,