diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2003-10-07 09:36:34 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@gcc.gnu.org> | 2003-10-07 09:36:34 +0000 |
commit | 7f27395d16254459d87430cfc00a02e2b276c396 (patch) | |
tree | 7ff81f59d612249af80040a9a13753df03c49896 /gcc/config/i386 | |
parent | f9b9980e6d45565807cb14ef53ab5d02b4338643 (diff) | |
download | gcc-7f27395d16254459d87430cfc00a02e2b276c396.tar.gz |
cygming.h (READONLY_DATA_SECTION_ASM_OP): Define.
* 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.
From-SVN: r72189
Diffstat (limited to 'gcc/config/i386')
-rw-r--r-- | gcc/config/i386/cygming.h | 5 | ||||
-rw-r--r-- | gcc/config/i386/winnt.c | 22 |
2 files changed, 21 insertions, 6 deletions
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index d0e019e5805..dfdb4994927 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -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; \ diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 666b9bd35b0..c1c54956fdc 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -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); |