home *** CD-ROM | disk | FTP | other *** search
- Sat Aug 7 00:38:21 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.
-
- Index: gcc-2.95.2/gcc/extend.texi
- ===================================================================
- RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/extend.texi,v
- retrieving revision 1.1.1.1
- diff -u -3 -p -r1.1.1.1 extend.texi
- --- gcc-2.95.2/gcc/extend.texi 1999/11/05 01:09:42 1.1.1.1
- +++ gcc-2.95.2/gcc/extend.texi 1999/11/05 08:11:35
- @@ -1998,6 +1998,32 @@ attribute is not available on all platfo
- 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,
- Index: gcc-2.95.2/gcc/config/i386/cygwin.h
- ===================================================================
- RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/config/i386/cygwin.h,v
- retrieving revision 1.3
- diff -u -3 -p -r1.3 cygwin.h
- --- gcc-2.95.2/gcc/config/i386/cygwin.h 1999/11/05 08:11:20 1.3
- +++ gcc-2.95.2/gcc/config/i386/cygwin.h 1999/11/05 08:11:35
- @@ -404,7 +404,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: gcc-2.95.2/gcc/config/i386/winnt.c
- ===================================================================
- RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/config/i386/winnt.c,v
- retrieving revision 1.2
- diff -u -3 -p -r1.2 winnt.c
- --- gcc-2.95.2/gcc/config/i386/winnt.c 1999/11/05 05:42:40 1.2
- +++ gcc-2.95.2/gcc/config/i386/winnt.c 1999/11/05 08:11:35
- @@ -56,6 +56,8 @@ i386_pe_valid_decl_attribute_p (decl, at
- return 1;
- if (is_attribute_p ("dllimport", attr))
- return 1;
- + if (is_attribute_p ("shared", attr))
- + return TREE_CODE (decl) == VAR_DECL;
- }
-
- return i386_valid_decl_attribute_p (decl, attributes, attr, args);
-