summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-14 10:06:06 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-14 10:06:06 +0000
commit87135be057ed5c7c2175845523efa0c4d564559b (patch)
tree57505e7ed2d5d0654b0aca22d1aaf499047fd4d1
parent750bd42051fc51e6002eb0584c74cba57ae3339f (diff)
downloadgcc-87135be057ed5c7c2175845523efa0c4d564559b.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29404 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/cygwin.h9
-rw-r--r--gcc/config/i386/winnt.c2
-rw-r--r--gcc/extend.texi26
4 files changed, 43 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9e0f1f7e3b7..6a6f65824e0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index a6e967f1525..023f4b0221b 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -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) \
{ \
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index bda9311a42a..2c2ce763359 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -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);
diff --git a/gcc/extend.texi b/gcc/extend.texi
index 5b5f3b116c6..4ec451d3373 100644
--- a/gcc/extend.texi
+++ b/gcc/extend.texi
@@ -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,