gcc-python-plugin icon indicating copy to clipboard operation
gcc-python-plugin copied to clipboard

no Function objects available in lto, show-lto-supergraph.py example doesn't work

Open fHachenberg opened this issue 7 years ago • 3 comments

At link time (and using the compiler flags described here http://gcc-python-plugin.readthedocs.io/en/latest/lto.html?highlight=supergraph) I always get None for the function object. The example script outputs an empty png.

for node in get_callgraph_nodes():
           fun = node.decl.function
           if fun:
               for edge in node.callees:
                   if edge.callee.decl.function:
                       ipcalls.add(edge.call_stmt)

I tested this using gcc-6 and gcc-7 and Python 2.7, Python 3.6 on a Ubuntu 17.10 workstation.

fHachenberg avatar May 02 '18 21:05 fHachenberg

For the case

./gcc-with-python \
  examples/show-lto-supergraph.py \
  -flto \
  -flto-partition=none \
    tests/examples/lto/input-* -c

I verified, that I end up with object files containing lto info (output of readelf):

readelf -a input-f.o | grep lto


[ 4] .gnu.lto_.inline. PROGBITS         0000000000000000  00000040
[ 5] .gnu.lto_f.f5283c PROGBITS         0000000000000000  00000064
[ 6] .gnu.lto_.symbol_ PROGBITS         0000000000000000  00000252
[ 7] .gnu.lto_.refs.f5 PROGBITS         0000000000000000  00000287
[ 8] .gnu.lto_.decls.f PROGBITS         0000000000000000  00000296
[ 9] .gnu.lto_.symtab. PROGBITS         0000000000000000  00000593
[10] .gnu.lto_.opts    PROGBITS         0000000000000000  000005a4
  14: 0000000000000001     1 OBJECT  GLOBAL DEFAULT  COM __gnu_lto_v1
  15: 0000000000000001     1 OBJECT  GLOBAL DEFAULT  COM __gnu_lto_slim

fHachenberg avatar May 02 '18 21:05 fHachenberg

hi, have you solved it? many thanks.

ampresent avatar Nov 01 '20 14:11 ampresent

Any luck with this?

taptipalit avatar Mar 26 '21 16:03 taptipalit