From 9d602c5900c50a7cda00695c00e1945badc184cf Mon Sep 17 00:00:00 2001 From: Kai Tietz Date: Thu, 25 Nov 2010 12:30:07 +0000 Subject: cgraphunit.c (process_function_and_variable_attributes): Mark dllexport-ed function/variables as needed. 2010-11-25 Kai Tietz * cgraphunit.c (process_function_and_variable_attributes): Mark dllexport-ed function/variables as needed. * ipa.c (cgraph_externally_visible_p): Make dllexport-ed as externally visible. 2010-11-25 Kai Tietz * gcc.dg/dll-8.c: New. From-SVN: r167144 --- gcc/cgraphunit.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'gcc/cgraphunit.c') diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index dd7c0fb..c7c5665 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -816,7 +816,14 @@ process_function_and_variable_attributes (struct cgraph_node *first, tree decl = node->decl; if (DECL_PRESERVE_P (decl)) cgraph_mark_needed_node (node); - if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl))) + if (TARGET_DLLIMPORT_DECL_ATTRIBUTES + && lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)) + && TREE_PUBLIC (node->decl)) + { + if (node->local.finalized) + cgraph_mark_needed_node (node); + } + else if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl))) { if (! TREE_PUBLIC (node->decl)) warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wattributes, @@ -835,7 +842,14 @@ process_function_and_variable_attributes (struct cgraph_node *first, if (vnode->finalized) varpool_mark_needed_node (vnode); } - if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl))) + if (TARGET_DLLIMPORT_DECL_ATTRIBUTES + && lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)) + && TREE_PUBLIC (node->decl)) + { + if (vnode->finalized) + varpool_mark_needed_node (vnode); + } + else if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl))) { if (! TREE_PUBLIC (vnode->decl)) warning_at (DECL_SOURCE_LOCATION (vnode->decl), OPT_Wattributes, -- cgit v1.1