summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-01 17:18:02 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-01 17:18:02 +0000
commit8d8061599caf3caefb6dfbfb2f96ca91dcf10f54 (patch)
tree9e41ebffeb3e69e887e931f907b91cf65b019361
parentfed47ac351552060672c552da670533940235d5f (diff)
downloadppe42-gcc-8d8061599caf3caefb6dfbfb2f96ca91dcf10f54.tar.gz
ppe42-gcc-8d8061599caf3caefb6dfbfb2f96ca91dcf10f54.zip
* config/darwin.c (machopic_symbol_defined_p): In addition to
being SYMBOL_REF_LOCAL_P, a symbol must also be ! SYMBOL_REF_EXTERNAL_P, as only those are _always_ locally defined in this output file, or translation unit in the case of IMA not being used. (machopic_output_indirection): SYMBOL_REF_LOCAL_P symbols never need .indirect_symbol when indirecting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86915 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/darwin.c8
-rw-r--r--gcc/testsuite/gcc.dg/visibility-b.c13
3 files changed, 27 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8494de51547..658bfe4575f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2004-09-01 Mike Stump <mrs@apple.com>
+
+ * config/darwin.c (machopic_symbol_defined_p): In addition to
+ being SYMBOL_REF_LOCAL_P, a symbol must also be
+ ! SYMBOL_REF_EXTERNAL_P, as only those are _always_ locally
+ defined in this output file, or translation unit in the case
+ of IMA not being used.
+ (machopic_output_indirection): SYMBOL_REF_LOCAL_P symbols
+ never need .indirect_symbol when indirecting.
+
2004-09-01 Jakub Jelinek <jakub@redhat.com>
* Makefile.in (bb-reorder.o): Add several dependencies.
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index e9e509cece4..c2353e30912 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -97,9 +97,8 @@ name_needs_quotes (const char *name)
static int
machopic_symbol_defined_p (rtx sym_ref)
{
- return ((SYMBOL_REF_FLAGS (sym_ref) & MACHO_SYMBOL_FLAG_DEFINED)
- /* Local symbols must always be defined. */
- || SYMBOL_REF_LOCAL_P (sym_ref));
+ return (SYMBOL_REF_FLAGS (sym_ref) & MACHO_SYMBOL_FLAG_DEFINED)
+ || (SYMBOL_REF_LOCAL_P (sym_ref) && ! SYMBOL_REF_EXTERNAL_P (sym_ref));
}
/* This module assumes that (const (symbol_ref "foo")) is a legal pic
@@ -874,7 +873,8 @@ machopic_output_indirection (void **slot, void *data)
machopic_output_stub (asm_out_file, sym, stub);
}
else if (! indirect_data (symbol)
- && machopic_symbol_defined_p (symbol))
+ && (machopic_symbol_defined_p (symbol)
+ || SYMBOL_REF_LOCAL_P (symbol)))
{
data_section ();
assemble_align (GET_MODE_ALIGNMENT (Pmode));
diff --git a/gcc/testsuite/gcc.dg/visibility-b.c b/gcc/testsuite/gcc.dg/visibility-b.c
new file mode 100644
index 00000000000..b1f15758aa2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/visibility-b.c
@@ -0,0 +1,13 @@
+/* { dg-do assemble { target *-*-darwin* } } */
+
+#define __private_extern__ extern __attribute__((visibility ("hidden")))
+
+__private_extern__ int n;
+
+int
+mach_error_type(int sub)
+{
+ if (sub >= n)
+ return 1;
+ return 0;
+}
OpenPOWER on IntegriCloud