Skip to content

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

Description

@fHachenberg

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.

Activity

  1. fHachenberg commented on May 2, 2018

    @fHachenberg
    Author

    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
    
  2. ampresent commented on Nov 1, 2020

    @ampresent

    hi, have you solved it? many thanks.

  3. taptipalit commented on Mar 26, 2021

    @taptipalit

    Any luck with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions