This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-profiling] fix some side corners of finalization machinery


> If I remove my checks for the flags and add your patch, I still cannot 
> compile the java library.    Here is the patch that will get you there.
> 
> just start clean and type make and let it go.  I will crash at the right 
> spot.

You run into somewhat sick (surprising?:) GCC extension here.  There is
function called "restore" that is static but it is not defined in the
file in a way GCC can parse.  Instead it's ASM name is set by hand and
the body is provided via toplevel ASM statement.

I would say that only sane way to deal with this function is to believe
that it is "external" even tought it is really defined locally.  I guess
we might simply make external to for IPA purposes to be !finalized - ie
if the body is not known, pretend that it is external even in such a
side corners where TREE_PUBLIC is not set.

Also note that you need to deal with third class of functions -
functions whose body is known but whose might be overwriten by linker.
This include all default visibility functions in PIC libraries.  C
frontend uses test:
  /* Don't auto-inline anything that might not be bound within
     this unit of translation.  */
  if (!DECL_DECLARED_INLINE_P (fn) && !targetm.binds_local_p (fn))

While C++ frontend uses:
  /* Don't auto-inline anything that might not be bound within
     this unit of translation.
     Exclude comdat functions from this rule.  While they can be bound
     to the other unit, they all must be the same.  This is especially
     important so templates can inline.  */
  if (!DECL_DECLARED_INLINE_P (fn) && !(*targetm.binds_local_p) (fn)
      && !DECL_COMDAT (fn))

While in pure/const function discovery there is more conservative
check to targetm.binds_local_p.  I guess we have obvious need for one
extra language hook (I wonder if in C++ the one-definition-rule don't
say that we might conclude that all the functions are known, Mark, any
comments?)

Changing the external flag definition itself won't make abort go away
but I guess couple of places in your ipa code will help...

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]