[GIMPLE] Can't retrieve function declaration with call (using ld.gold)

Mateusz Grabowski grabekm90@wp.pl
Fri Aug 26 08:03:00 GMT 2011


I'm reposting following thread, because I previously chose wrong mailing-list
(gcc-patches):

http://old.nabble.com/GIMPLE-and-intent-of-variables-to32275433.html
http://old.nabble.com/GIMPLE-and-intent-of-variables-to32275433.html 


At this moment I have many compilation units. In my case the main program is
written in Fortran and it calls functions in C - I'm sure that this works
correctly.

My plugin runs after cplxlower0 pass. I use following flags to compile and
link each Fortran and C files:

 -flto -O0 -flto-partition=none -fwhole-program -fuse-linker-plugin

I use them in order to see whole program as a single compilation unit.
Object files are also compileted with -flto flags.
ld.gold linker (from gcc binutils) links object files (.o) thanks to that my
main .cplxlower0 file contains all needed functions in GIMPLE. My plugin
comes to every function.

But my problem is that I can't get some function definition, when I'm
currently in the another one.

if(is_gimple_call(stmt)) {
    tree fndecl = gimple_call_fndecl(stmt);
    struct function *new_cfun = DECL_STRUCT_FUNCTION(fndecl);
    (...)
}

In this case new_cfun == NULL or equivalently gimple_has_body_p(fndecl) ==
NULL even if the function is in the same Fortran or C file.
-- 
View this message in context: http://old.nabble.com/-GIMPLE--Can%27t-retrieve-function-declaration-with-call-%28using-ld.gold%29-tp32339989p32339989.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list