diff options
| author | austern <austern@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-10 23:07:09 +0000 |
|---|---|---|
| committer | austern <austern@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-10 23:07:09 +0000 |
| commit | 2c5b6111f39e67a317d3767cc06651bbd0bba45b (patch) | |
| tree | fa8c5589023376eb75a70c99f8eb770481c2c97d /gcc | |
| parent | 90483006aa904ba60a0e156f3f03ac466c9e79f3 (diff) | |
| download | ppe42-gcc-2c5b6111f39e67a317d3767cc06651bbd0bba45b.tar.gz ppe42-gcc-2c5b6111f39e67a317d3767cc06651bbd0bba45b.zip | |
* config/darwin-protos.h (darwin_assemble_visibility): Declare.
* config/darwin.c (darwin_assemble_visibility): Define. Warn for
anything other than VISIBILITY_DEFAULT and VISIBILITY_HIDDEN.
* config/darwin.h (TARGET_ASM_ASSEMBLE_VISIBILITY): Use
darwin_assemble_visibility instead of default.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73430 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/ChangeLog | 8 | ||||
| -rw-r--r-- | gcc/config/darwin-protos.h | 1 | ||||
| -rw-r--r-- | gcc/config/darwin.c | 24 | ||||
| -rw-r--r-- | gcc/config/darwin.h | 7 |
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 268e61f826d..d9e2c0ae951 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2003-11-10 Matt Austern <austern@apple.com> + + * config/darwin-protos.h (darwin_assemble_visibility): Declare. + * config/darwin.c (darwin_assemble_visibility): Define. Warn for + anything other than VISIBILITY_DEFAULT and VISIBILITY_HIDDEN. + * config/darwin.h (TARGET_ASM_ASSEMBLE_VISIBILITY): Use + darwin_assemble_visibility instead of default. + 2003-11-10 Waldek Hebisch <hebisch@math.uni.wroc.pl> PR target/12865 diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index 69b0b6fcb3e..41bad646ce1 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -118,5 +118,6 @@ extern void machopic_output_stub (FILE *, const char *, const char *); extern void darwin_exception_section (void); extern void darwin_eh_frame_section (void); extern void darwin_globalize_label (FILE *, const char *); +extern void darwin_assemble_visibility (tree, int); extern void darwin_asm_output_dwarf_delta (FILE *, int, const char *, const char *); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index dcb42d5199a..47ca65d541c 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. */ #include "ggc.h" #include "langhooks.h" #include "tm_p.h" +#include "errors.h" static int machopic_data_defined_p (const char *); static void update_non_lazy_ptrs (const char *); @@ -1324,6 +1325,29 @@ darwin_globalize_label (FILE *stream, const char *name) default_globalize_label (stream, name); } +/* Emit an assembler directive to set visibility for a symbol. The + only supported visibilities are VISIBILITY_DEFAULT and + VISIBILITY_HIDDEN; the latter corresponds to Darwin's "private + extern". There is no MACH-O equivalent of ELF's + VISIBILITY_INTERNAL or VISIBILITY_PROTECTED. */ + +void +darwin_assemble_visibility (tree decl, int vis) +{ + if (vis == VISIBILITY_DEFAULT) + ; + else if (vis == VISIBILITY_HIDDEN) + { + fputs ("\t.private_extern ", asm_out_file); + assemble_name (asm_out_file, + (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)))); + fputs ("\n", asm_out_file); + } + else + warning ("internal and protected visibility attributes not supported" + "in this configuration; ignored"); +} + /* Output a difference of two labels that will be an assembly time constant if the two labels are local. (.long lab1-lab2 will be very different if lab1 is at the boundary between two sections; it diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index ae5201a5eb1..0099ff23881 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -708,6 +708,13 @@ objc_section_init (void) \ #define GLOBAL_ASM_OP ".globl " #define TARGET_ASM_GLOBALIZE_LABEL darwin_globalize_label +/* Emit an assembler directive to set visibility for a symbol. Used + to support visibility attribute and Darwin's private extern + feature. */ +#undef TARGET_ASM_ASSEMBLE_VISIBILITY +#define TARGET_ASM_ASSEMBLE_VISIBILITY darwin_assemble_visibility + + #undef ASM_GENERATE_INTERNAL_LABEL #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM)) |

