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

Support Linux kernel modules #280

Open DreamTeamWangbowen opened 2 years ago

DreamTeamWangbowen commented 2 years ago

[root@localhost home]# ./wbw/llvm-project-main/build/bin/llvm-bolt kvm-intel.ko -o kvm-intel.ko.bolt -data=perf.fdata -reorder-blocks=cache+ -reorder-functions=hfsort -split-functions=3 -split-all-cold -icf=1 -use-gnu-stack BOLT-INFO: shared object or position-independent executable detected BOLT-INFO: Target architecture: x86_64 BOLT-INFO: BOLT version: llvm-bolt: /home/wbw/llvm-project-main/bolt/lib/Rewrite/RewriteInstance.cpp:494: void llvm::bolt::RewriteInstance::discoverStorage(): Assertion `NextAvailableAddress && NextAvailableOffset && "no PT_LOAD pheader seen"' failed.

0 0x0000000000cdc87f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0

1 0x0000000000cda41e SignalHandler(int) Signals.cpp:0:0

2 0x00007f59ad9abce0 __restore_rt (/lib64/libpthread.so.0+0x12ce0)

3 0x00007f59ac6baa4f raise (/lib64/libc.so.6+0x4ea4f)

4 0x00007f59ac68ddb5 abort (/lib64/libc.so.6+0x21db5)

5 0x00007f59ac68dc89 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21c89)

6 0x00007f59ac6b33a6 (/lib64/libc.so.6+0x473a6)

7 0x0000000000ad9fa0 llvm::bolt::RewriteInstance::discoverStorage() (./wbw/llvm-project-main/build/bin/llvm-bolt+0xad9fa0)

8 0x0000000000b14535 llvm::bolt::RewriteInstance::run() (./wbw/llvm-project-main/build/bin/llvm-bolt+0xb14535)

9 0x000000000040c6b0 main (./wbw/llvm-project-main/build/bin/llvm-bolt+0x40c6b0)

10 0x00007f59ac6a6ca3 __libc_start_main (/lib64/libc.so.6+0x3aca3)

11 0x000000000046e8de _start (./wbw/llvm-project-main/build/bin/llvm-bolt+0x46e8de)

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump:

  1. Program arguments: ./wbw/llvm-project-main/build/bin/llvm-bolt kvm-intel.ko -o kvm-intel.ko.bolt -data=perf.fdata -reorder-blocks=cache+ -reorder-functions=hfsort -split-functions=3 -split-all-cold -icf=1 -use-gnu-stack Aborted (core dumped)
DreamTeamWangbowen commented 2 years ago

@nico @drodriguez @zpao @d0k hi guys,please help me.

ayermolo commented 2 years ago

Hello. Is this an ELF binary? Can you provide a repro?

DreamTeamWangbowen commented 2 years ago

This is linux kernel's module. And bolt support linux kernel module optimization?

aaupov commented 2 years ago

This is linux kernel's module. And bolt support linux kernel module optimization?

I guess you're the first to report trying to process a kernel module with BOLT :) No, we don't support it yet. BOLT expects a PT_LOAD program header as shown in the assertion that failed.

How large is kvm-intel.ko kernel module text section? Do you have a way to measure performance impact of optimizing the module?

DreamTeamWangbowen commented 2 years ago

This is linux kernel's module. And bolt support linux kernel module optimization?

I guess you're the first to report trying to process a kernel module with BOLT :) No, we don't support it yet. BOLT expects a PT_LOAD program header as shown in the assertion that failed.

How large is kvm-intel.ko kernel module text section? Do you have a way to measure performance impact of optimizing the module?

I see, thanks for your answer :)