mirror of git://gcc.gnu.org/git/gcc.git
cgraphunit.c (process_function_and_variable_attributes): Mark dllexport-ed function/variables as needed.
2010-11-25 Kai Tietz <kai.tietz@onevision.com> * 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 <kai.tietz@onevision.com> * gcc.dg/dll-8.c: New. From-SVN: r167144
This commit is contained in:
parent
c8230704c4
commit
9d602c5900
|
|
@ -1,3 +1,10 @@
|
||||||
|
2010-11-25 Kai Tietz <kai.tietz@onevision.com>
|
||||||
|
|
||||||
|
* 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 Alexander Monakov <amonakov@ispras.ru>
|
2010-11-25 Alexander Monakov <amonakov@ispras.ru>
|
||||||
|
|
||||||
PR rtl-optimization/46585
|
PR rtl-optimization/46585
|
||||||
|
|
|
||||||
|
|
@ -816,7 +816,14 @@ process_function_and_variable_attributes (struct cgraph_node *first,
|
||||||
tree decl = node->decl;
|
tree decl = node->decl;
|
||||||
if (DECL_PRESERVE_P (decl))
|
if (DECL_PRESERVE_P (decl))
|
||||||
cgraph_mark_needed_node (node);
|
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))
|
if (! TREE_PUBLIC (node->decl))
|
||||||
warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wattributes,
|
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)
|
if (vnode->finalized)
|
||||||
varpool_mark_needed_node (vnode);
|
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))
|
if (! TREE_PUBLIC (vnode->decl))
|
||||||
warning_at (DECL_SOURCE_LOCATION (vnode->decl), OPT_Wattributes,
|
warning_at (DECL_SOURCE_LOCATION (vnode->decl), OPT_Wattributes,
|
||||||
|
|
|
||||||
|
|
@ -662,7 +662,9 @@ cgraph_externally_visible_p (struct cgraph_node *node, bool whole_program, bool
|
||||||
return true;
|
return true;
|
||||||
if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (node->decl)))
|
if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (node->decl)))
|
||||||
return true;
|
return true;
|
||||||
|
if (TARGET_DLLIMPORT_DECL_ATTRIBUTES
|
||||||
|
&& lookup_attribute ("dllexport", DECL_ATTRIBUTES (node->decl)))
|
||||||
|
return true;
|
||||||
/* When doing LTO or whole program, we can bring COMDAT functoins static.
|
/* When doing LTO or whole program, we can bring COMDAT functoins static.
|
||||||
This improves code quality and we know we will duplicate them at most twice
|
This improves code quality and we know we will duplicate them at most twice
|
||||||
(in the case that we are not using plugin and link with object file
|
(in the case that we are not using plugin and link with object file
|
||||||
|
|
@ -724,6 +726,10 @@ varpool_externally_visible_p (struct varpool_node *vnode, bool aliased)
|
||||||
if (lookup_attribute ("externally_visible",
|
if (lookup_attribute ("externally_visible",
|
||||||
DECL_ATTRIBUTES (vnode->decl)))
|
DECL_ATTRIBUTES (vnode->decl)))
|
||||||
return true;
|
return true;
|
||||||
|
if (TARGET_DLLIMPORT_DECL_ATTRIBUTES
|
||||||
|
&& lookup_attribute ("dllexport",
|
||||||
|
DECL_ATTRIBUTES (vnode->decl)))
|
||||||
|
return true;
|
||||||
|
|
||||||
/* See if we have linker information about symbol not being used or
|
/* See if we have linker information about symbol not being used or
|
||||||
if we need to make guess based on the declaration.
|
if we need to make guess based on the declaration.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
2010-11-25 Kai Tietz <kai.tietz@onevision.com>
|
||||||
|
|
||||||
|
* gcc.dg/dll-8.c: New.
|
||||||
|
|
||||||
2010-11-25 Eric Botcazou <ebotcazou@adacore.com>
|
2010-11-25 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
* gnat.dg/loop_optimization7.adb: Remove dg-require-effective-target.
|
* gnat.dg/loop_optimization7.adb: Remove dg-require-effective-target.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
/* { dg-do compile { target i?86-pc-cygwin } } */
|
||||||
|
/* { dg-do compile { target i?86-*-mingw* x86_64-*-mingw*} } */
|
||||||
|
/* { dg-options "-O3 -fwhole-program" } */
|
||||||
|
/* { dg-final { scan-assembler "foo1" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "foo2" } } */
|
||||||
|
/* { dg-final { scan-assembler "doo1" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "doo2" } } */
|
||||||
|
|
||||||
|
__declspec(dllexport) int doo1 = 2;
|
||||||
|
int doo2 = 3;
|
||||||
|
__declspec(dllexport) int foo1 (void) { return 0; }
|
||||||
|
int foo2 (void) { return 1; }
|
||||||
|
int main() { return 0; }
|
||||||
|
|
||||||
Loading…
Reference in New Issue