facebookarchive / BOLT

Binary Optimization and Layout Tool - A linux command-line utility used for optimizing performance of binaries
2.51k stars 177 forks source link

A dump about function cannot be properly disassembled when use -use-old-text #291

Closed CcWeapon closed 1 year ago

CcWeapon commented 2 years ago

When I tried to use bolt to optimize libart.so in AOSP, I used -use-old-text to reuse .text. A dump occurs.

You can notice that the previous method is art_quick_invoke_static_stub. In my other test that javaVm will restart fail after bolt libart.so , i find it will Exception when i call art_quick_invoke_static_stub to invoke a java func after bolt instrement. I think it is the point of this bug!

BOLT-INFO: pre-processing profile using branch profile reader
BOLT-INFO: potentially escaped address 0x1481dc in function art_quick_invoke_stub/1(*2)
BOLT-INFO: potentially escaped address 0x148224 in function art_quick_invoke_stub/1(*2)
BOLT-INFO: potentially escaped address 0x14826c in function art_quick_invoke_stub/1(*2)
BOLT-INFO: potentially escaped address 0x1482cc in function art_quick_invoke_stub/1(*2)
BOLT-INFO: potentially escaped address 0x148448 in function art_quick_invoke_static_stub/1(*2)
BOLT-INFO: potentially escaped address 0x14849c in function art_quick_invoke_static_stub/1(*2)
BOLT-INFO: potentially escaped address 0x1484f0 in function art_quick_invoke_static_stub/1(*2)
BOLT-INFO: potentially escaped address 0x148550 in function art_quick_invoke_static_stub/1(*2)
BOLT-WARNING: internal call detected at 0x14863c in function art_quick_osr_stub/1(*2). Skipping.
=======================================
BOLT is unable to proceed because it couldn't properly understand this function.
If you are running the most recent version of BOLT, you may want to report this and paste this dump.
Please check that there is no sensitive contents being shared in this dump.

Offending function: art_quick_osr_stub/1(*2)

Function contents (
  0000: E313B5A9 F35301A9 F55B02A9 F76303A9  |.....S...[...c..|
  0010: F96B04A9 FB7305A9 FD7B06A9 E827076D  |.k...s...{...'.m|
  0020: EA2F086D EC37096D EE3F0A6D F30305AA  |./.m.7.m.?.m....|
  0030: 743640B9 FF4300D1 FF0300F9 1A000094  |t6@..C..........|
  0040: FF430091 E827476D EA2F486D EC37496D  |.C...'Gm./Hm.7Im|
  0050: EE3F4A6D F35341A9 F55B42A9 F76343A9  |.?Jm.SA..[B..cC.|
  0060: F96B44A9 FB7345A9 FD7B46A9 E313CBA8  |.kD..sE..{F.....|
  0070: 8A004039 5F590171 C0000054 5F110171  |..@9_Y.q...T_..q|
  0080: A0000054 5F190171 A0000054 600000F9  |...T_..q...T`...|
  0090: C0035FD6 600000FD C0035FD6 600000BD  |.._.`....._.`...|
  00A0: C0035FD6 E9030091 FF6321CB 21200051  |.._......c!.! .Q|
  00B0: FE6B21F8 A1000034 21100051 0A6861B8  |.k!....4!..Q.ha.|
  00C0: EA6B21B8 FCFFFF17 40001FD6 1F2003D5  |.k!.....@.... ..|
)

Binary Function "art_quick_osr_stub/1(*2)"  {
  All names   : art_quick_osr_stub/1
                art_quick_osr_stub/crtbegin_so.c/1
  Number      : 21
  State       : empty
  Address     : 0x148600
  Size        : 0xcc
  MaxSize     : 0xd0
  Offset      : 0x148600
  Section     : .text
  Orc Section : .local.text.art_quick_osr_stub/1
  LSDA        : 0x0
  IsSimple    : 0
  IsMultiEntry: 0
  IsSplit     : 0
  BB Count    : 0
}
DWARF CFI Instructions:
    <empty>
End of Function "art_quick_osr_stub/1(*2)"

ERROR: function cannot be properly disassembled. Unable to continue in relocation mode.
=======================================

cc @rafaelauler @maksfb @aaupov thx~

maksfb commented 2 years ago

What is the architecture you are building for? Since the function is most likely written in asm, you can try -skip-funcs=art_quick_osr_stub.*.

CcWeapon commented 1 year ago

What is the architecture you are building for? Since the function is most likely written in asm, you can try -skip-funcs=art_quick_osr_stub.*.

thx