aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@apple.com>2005-12-05 21:38:27 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2005-12-05 21:38:27 +0000
commit0f9bc2d6bfeb5c89d6f22fa8a1feb5b6e8a2a928 (patch)
treec23f5fc2f2d9999227274d364e8bff40524b5323
parenta9b0b82578a7f552e3530e690a147303a592a34e (diff)
downloadgcc-0f9bc2d6bfeb5c89d6f22fa8a1feb5b6e8a2a928.zip
gcc-0f9bc2d6bfeb5c89d6f22fa8a1feb5b6e8a2a928.tar.gz
gcc-0f9bc2d6bfeb5c89d6f22fa8a1feb5b6e8a2a928.tar.bz2
Index: gcc/ChangeLog
2005-12-05 Geoffrey Keating <geoffk@apple.com> * config/darwin.c (machopic_select_section): It's not defined as weak if it's only marked as weak_import. Index: gcc/testsuite/ChangeLog 2005-12-05 Geoffrey Keating <geoffk@apple.com> * gcc.dg/darwin-weakimport-3.c: New. From-SVN: r108076
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/config/darwin.c5
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/gcc.dg/darwin-weakimport-3.c10
4 files changed, 29 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 29a37f4..253b37e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,18 @@
2005-12-05 Geoffrey Keating <geoffk@apple.com>
+ * config/arm/arm.c (arm_cxx_determine_class_data_visibility): Preserve
+ previous behaviour.
+ * config/darwin.h (TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Define to
+ hook_bool_void_false.
+ (TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY): Define.
+ * config/darwin.c (darwin_cxx_determine_class_data_visibility): New.
+
+ * config/darwin.c (machopic_select_section): It's not defined
+ as weak if it's only marked as weak_import.
+
+ * config/darwin-protos.h (darwin_cxx_determine_class_data_visibility):
+ Prototype.
+
* varasm.c (default_binds_local_p_1): Weakrefs don't bind locally.
A hidden weak object does bind locally. Strong linkonce data
counts like any other strong symbol for binding.
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 49c4114..54edae4 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1027,7 +1027,10 @@ machopic_select_section (tree exp, int reloc,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
void (*base_function)(void);
- bool weak_p = DECL_P (exp) && DECL_WEAK (exp);
+ bool weak_p = (DECL_P (exp) && DECL_WEAK (exp)
+ && (lookup_attribute ("weak", DECL_ATTRIBUTES (exp))
+ || ! lookup_attribute ("weak_import",
+ DECL_ATTRIBUTES (exp))));
static void (* const base_funs[][2])(void) = {
{ text_section, text_coal_section },
{ unlikely_text_section, text_unlikely_coal_section },
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1fbd36c..490996b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2005-12-05 Geoffrey Keating <geoffk@apple.com>
+ * gcc.dg/darwin-weakimport-3.c: New.
+
* g++.old-deja/g++.abi/vtable2.C: Make weakrefs static.
* gcc.dg/attr-weakref-1.c: Modify to not try to test public weakrefs,
and to work on Darwin.
diff --git a/gcc/testsuite/gcc.dg/darwin-weakimport-3.c b/gcc/testsuite/gcc.dg/darwin-weakimport-3.c
new file mode 100644
index 0000000..de6458c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/darwin-weakimport-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-require-weak "" } */
+
+/* { dg-final { scan-assembler-not "coalesced" } } */
+
+extern void foo(void) __attribute__((weak_import));
+
+void foo(void)
+{
+}