Bug 13365 - "Fold" functions that only jump to some other one
Summary: "Fold" functions that only jump to some other one
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.24
: P2 enhancement
Target Milestone: ---
Assignee: Ian Lance Taylor
Depends on:
Reported: 2011-10-31 13:44 UTC by Mike Hommey
Modified: 2011-12-19 23:30 UTC (History)
1 user (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Mike Hommey 2011-10-31 13:44:54 UTC
There can be plenty of reasons some code may end up looking like:
   jmp bar

In such cases, it would be interesting for the linker to just declare foo as an alias of bar.
Comment 1 Ian Lance Taylor 2011-12-19 23:30:39 UTC
Of course one can only do this if there are no comparisons of function pointers.  And that means that it can only be done if the symbols are not visible outside the executable/shared library, or if linking statically.

It requires analyzing the section contents at each eligible symbol, which is a relatively slow operation.

Do you have any statistics suggesting that it will be worth it?  I.e., how many such functions are there in a typical executable?