Skip to content

how to enable --instrument bolt runtime library bolt_rt_instr.a in x86_64 when compiling llvm-bolt in x86 #156319

@zhouyu0502

Description

@zhouyu0502

My goal is to use llvm-bolt --instrument a binary executable(from arm64)on an x86_64 server
I ran into this issue. Here are the steps I took:
我的目的是为arm64 架构的设备执行 二进制文件的 插装,遇到了这个问题,以下是我的操作步骤

  1. 在x86_64的服务器上编译好的 llvm_bolt 和 arm64架构上的可执行文件binfromarm64
  2. 在服务器上执行./llvm-bolt binfromarm64 -instrument -o binfromarm64_instr
    BOLT-INFO: shared object or position-independent executable detected
    BOLT-INFO: Target architecture: aarch64
    BOLT-INFO: BOLT version: 6abb626
    BOLT-INFO: first alloc address is 0x0
    BOLT-INFO: creating new program header table at address 0x200000, offset 0x200000
    BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
    BOLT-INFO: enabling relocation mode
    BOLT-INFO: forcing -jump-tables=move for instrumentation
    BOLT-INFO: number of removed linker-inserted veneers: 0
    BOLT-INFO: 0 out of 12 functions in the binary (0.0%) have non-empty execution profile
    BOLT-INSTRUMENTER: Number of indirect call site descriptors: 0
    BOLT-INSTRUMENTER: Number of indirect call target descriptors: 9
    BOLT-INSTRUMENTER: Number of function descriptors: 9
    BOLT-INSTRUMENTER: Number of branch counters: 9
    BOLT-INSTRUMENTER: Number of ST leaf node counters: 17
    BOLT-INSTRUMENTER: Number of direct call counters: 0
    BOLT-INSTRUMENTER: Total number of counters: 26
    BOLT-INSTRUMENTER: Total size of counters: 208 bytes (static alloc memory)
    BOLT-INSTRUMENTER: Total size of string table emitted: 237 bytes in file
    BOLT-INSTRUMENTER: Total size of descriptors: 2056 bytes in file
    BOLT-INSTRUMENTER: Profile will be saved to file /tmp/prof.fdata
    BOLT-INFO: Starting stub-insertion pass
    BOLT-INFO: Inserted 0 stubs in the hot area and 0 stubs in the cold area. Shared 0 times, iterated 1 times.
    BOLT-INFO: padding code to 0x600000 to accommodate hot text
    BOLT-ERROR: linking object with arch x86_64 into context with arch aarch64
    错误的原因是编出来的libbolt_rt_instr.a 是x86_64架构的,请问我该如何在x86服务器上编出支持的arm64架构的libbolt_rt_instr.a?我试过交叉编译,但是生成的插装后的可执行文件无法执行。
    The error is caused by the fact that the built libbolt_rt_instr.a is for the x86_64 architecture. How can I produce an libbolt_rt_instr.a that supports the arm64 architecture on an x86 server? I tried cross-compiling, but the resulting instrumented executable cannot run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BOLTquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions