[Bug middle-end/20274] -fvisibility=hidden has no effect on calling undefined function

hjl at lucon dot org gcc-bugzilla@gcc.gnu.org
Wed Mar 2 17:20:00 GMT 2005


------- Additional Comments From hjl at lucon dot org  2005-03-02 17:19 -------
default_binds_local_p_1 has

  /* A variable is local if the user explicitly tells us so.  */
  else if (DECL_VISIBILITY_SPECIFIED (exp) && DECL_VISIBILITY (exp) !=
VISIBILITY_DEFAULT)
    local_p = true;
  /* Otherwise, variables defined outside this object may not be local.  */  
else if (DECL_EXTERNAL (exp))
    local_p = false;
  /* Linkonce and weak data are never local.  */
  else if (DECL_ONE_ONLY (exp) || DECL_WEAK (exp))
    local_p = false;
  /* If none of the above and visibility is not default, make local.  */
  else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
    local_p = true;

If a symbol is undefined and its visibility isn't specified by the user,
it won't be treated as local. So it is done on purpose. The document should
be updated to reflect this. It can say something like "-fvisibility has
no effect on undefined symbols."

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20274



More information about the Gcc-bugs mailing list