The Wayback Machine - http://web.archive.org/web/20201118183540/https://github.com/davidmalcolm/gcc-python-plugin/issues/118
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fHachenberg opened this issue May 2, 2018 · 2 comments

Comments

@fHachenberg
Copy link

@fHachenberg fHachenberg commented May 2, 2018

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
Copy link
Author

@fHachenberg fHachenberg commented May 2, 2018

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
@ampresent
Copy link

@ampresent ampresent commented Nov 1, 2020

hi, have you solved it? many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.