x86-win32 "shared" attribute
Mumit Khan
khan@xraylith.wisc.EDU
Fri Aug 6 23:54:00 GMT 1999
The following patch introduces a new attribute for x86-win32, "shared",
that allows a section/segment to be shareable among all running copies
of the executable.
For example, the declaration:
int __attribute__((section("my_shared_data"),shared) foo = 0;
will put foo in a named section called "my_shared_data" and make it
shareable among all running copies of the executable.
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.
Index: gcc/config/i386/winnt.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/gcc-2.95/gcc/config/i386/winnt.c,v
retrieving revision 1.3
diff -u -3 -p -r1.3 winnt.c
--- gcc/config/i386/winnt.c 1999/06/21 04:40:30 1.3
+++ gcc/config/i386/winnt.c 1999/08/07 04:04:31
@@ -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);
Index: gcc/config/i386/cygwin.h
===================================================================
RCS file: /homes/khan/src/CVSROOT/gcc-2.95/gcc/config/i386/cygwin.h,v
retrieving revision 1.3
diff -u -3 -p -r1.3 cygwin.h
--- gcc/config/i386/cygwin.h 1999/07/04 18:23:41 1.3
+++ gcc/config/i386/cygwin.h 1999/08/07 04:03: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) \
{ \
Regards,
Mumit
More information about the Gcc-patches
mailing list