Bug 13364 - ICF may not be as thorough as one would expect
Summary: ICF may not be as thorough as one would expect
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-31 08:52 UTC by Mike Hommey
Modified: 2011-10-31 18:23 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Hommey 2011-10-31 08:52:26 UTC
When linking Mozilla's libxul.so with GNU gold (GNU Binutils 2.22.51.20111010) 1.11 on ARM, with code built as Thumb-2, with either --icf=safe or --icf=all, a lot of functions one would expect to be folded aren't.

I figured this when looking what 2 bytes long functions content could be, and it turns out a lot (if not all) are just doing "bx lr", the ARM/Thumb equivalent to "ret". But not all the functions doing so are folded:

$ objdump -t libxul.so | awk '$3=="F" && $5=="00000002" {print $1}'| sort | uniq -c | sort -n
      1 00390fc5
      1 008545e9
      1 0085463d
      1 00854655
      1 0085467d
      1 0085c109
      1 0093948d
      1 00939cd1
      1 0093be95
      1 009498e9
      1 0095ca4d
      1 0095d79d
      1 0095d7dd
      1 00969ed9
      1 0096dffd
      1 00992691
      1 009b90c9
      1 009b90cd
      1 009e6781
      1 009e9ced
      1 009f8649
      1 00a18535
      1 00a40001
      1 00a5e30d
      1 00a60f79
      1 00a60f7d
      1 00a66f35
      1 00a680cd
      1 00ab97f5
      1 00ac57b1
      1 00ac57b5
      1 00aed3dd
      1 00aed3e1
      1 00afd821
      1 00afd825
      1 00b03575
      1 00b03579
      1 00b0357d
      1 00b03581
      1 00b089ad
      1 00b089b1
      2 003102d5
      2 00854545
      2 00854611
      2 0085b105
      2 0096bed9
      2 009d9129
      2 00a05855
      2 00afd81d
      3 003a6b77
      3 00832181
      3 00854505
      4 00296963
     41 00892571
    721 001e98a5
(this list is with --icf=all, the --icf=safe list is longer)

Corresponding disassembly:
00390fc4 <_ZN14nsMenuBarFrame19LockMenuUntilClosedEb>:
  390fc4:       4770            bx      lr
008545e8 <_ZN7mozilla6layers29BasicShadowableContainerLayer7AsLayerEv>:
  8545e8:       4770            bx      lr
0085463c <_ZN7mozilla6layers25BasicShadowableImageLayer7AsLayerEv>:
  85463c:       4770            bx      lr
00854654 <_ZN7mozilla6layers25BasicShadowableColorLayer7AsLayerEv>:
  854654:       4770            bx      lr
0085467c <_ZN7mozilla6layers26BasicShadowableCanvasLayer7AsLayerEv>:
  85467c:       4770            bx      lr
0085c108 <_ZN7mozilla6layers17ContainerLayerOGL8GetLayerEv>:
  85c108:       4770            bx      lr
00296962 <_ZN13nsGridLayout216CastToGridLayoutEv>:
  296962:       4770            bx      lr
001e98a4 <JSD_JSContextInUse>:
  1e98a4:       4770            bx      lr
etc.

A few disassemble to something like:
0093948c <JS_AnchorPtr>:
  93948c:       4770            bx      lr
  93948e:       bf00            nop

but still have a size of 2 in the symbols table.
Comment 1 Sriraman Tallam 2011-10-31 17:50:37 UTC
Hi Mike,

   Can you give me instructions to build this or better, a reduced test case, for me to debug.

Thanks,
-Sri.
Comment 2 Mike Hommey 2011-10-31 18:23:26 UTC
I'll try to see if I can reduce the testcase.