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
This commit is contained in:
Geoffrey Keating 2005-12-05 21:38:27 +00:00 committed by Geoffrey Keating
parent a9b0b82578
commit 0f9bc2d6bf
4 changed files with 29 additions and 1 deletions

View File

@ -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.

View File

@ -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 },

View File

@ -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.

View File

@ -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)
{
}