Skip to content

[RISCV][Instrumentation] Instrumentation for mysql failed #145548

Open
@Xiangtingwei

Description

@Xiangtingwei

here is my gcc version:

debian@laptop-yjn:~/work-bolt/cross-tool/riscv-gcc/bin$ ./riscv64-unknown-linux-gnu-gcc --version
riscv64-unknown-linux-gnu-gcc (g1b306039ac) 15.1.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and the log:

sipeed@revyos-lpi4a:~/work_bolt/cross-mysql/install/bin$ llvm-bolt -riscv-uleb128-reloc=false --conservative-instrumentation --instrument --instrumentation-file=mysqld.fdata_github -o mysqld.instr_github mysqld
BOLT-INFO: Target architecture: riscv64
BOLT-INFO: BOLT version: 9d491bc
BOLT-INFO: first alloc address is 0x10000
BOLT-INFO: creating new program header table at address 0x4000000, offset 0x3ff0000
BOLT-INFO: enabling relocation mode
BOLT-INFO: forcing -jump-tables=move for instrumentation
BOLT-WARNING: Failed to analyze 4 relocations
BOLT-INFO: 0 out of 60782 functions in the binary (0.0%) have non-empty execution profile
BOLT-INSTRUMENTER: Number of indirect call site descriptors: 93961
BOLT-INSTRUMENTER: Number of indirect call target descriptors: 58419
BOLT-INSTRUMENTER: Number of function descriptors: 58419
BOLT-INSTRUMENTER: Number of branch counters: 1983743
BOLT-INSTRUMENTER: Number of ST leaf node counters: 0
BOLT-INSTRUMENTER: Number of direct call counters: 0
BOLT-INSTRUMENTER: Total number of counters: 1983743
BOLT-INSTRUMENTER: Total size of counters: 15869944 bytes (static alloc memory)
BOLT-INSTRUMENTER: Total size of string table emitted: 6238083 bytes in file
BOLT-INSTRUMENTER: Total size of descriptors: 59100604 bytes in file
BOLT-INSTRUMENTER: Profile will be saved to file mysqld.fdata_github
BOLT-INFO: padding code to 0xb800000 to accommodate hot text
BOLT-INFO: output linked against instrumentation runtime library, lib entry point is 0xd08c42e
BOLT-INFO: clear procedure is 0xd08b4f2
BOLT-INFO: patched build-id (flipped last bit)
BOLT-INFO: setting _end to 0xd17b704
BOLT-INFO: setting _end to 0xd17b704
BOLT-INFO: setting __bolt_runtime_start to 0xd08c42e
BOLT-INFO: setting __bolt_runtime_fini to 0xd08c4fc
BOLT-INFO: setting __hot_start to 0x4200000
BOLT-INFO: setting __hot_end to 0xb55811c

sipeed@revyos-lpi4a: ~/work_bolt/cross-mysql/install/bin$ ./mysqld --version
/home/sipeed/work_bolt/cross-mysql/install/bin/mysqld Ver 8.0.33 for Linux on riscv64 (Source distribution)
sipeed@revyos-lpi4a: ~ /work_bolt/cross-mysql/install/bin$ ./mysqld.instr_github --version
Segmentation fault

and the gdb log

(gdb) r
Starting program: /home/sipeed/work_bolt/cross-mysql/install/bin/mysqld.instr_github --version
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/riscv64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000003ff7fe6e32 in __GI___tls_get_addr (ti=0x1b8) at ./elf/dl-tls.c:1030
warning: 1030 ./elf/dl-tls.c: No such file or directory
(gdb) x/10i 0x0000003ff7fe6e20
0x3ff7fe6e20 <__GI___tls_get_addr+2>: sd zero,440(sp)
0x3ff7fe6e22 <__GI___tls_get_addr+4>: auipc a4,0x18
0x3ff7fe6e26 <__GI___tls_get_addr+8>: addi a4,a4,590
0x3ff7fe6e2a <__GI___tls_get_addr+12>: ld a5,0(a4)
0x3ff7fe6e2c <__GI___tls_get_addr+14>: ld a3,0(a1)
0x3ff7fe6e2e <__GI___tls_get_addr+16>: bne a3,a5,0x3ff7fe6e50 <__GI___tls_get_addr+50>
=> 0x3ff7fe6e32 <__GI___tls_get_addr+20>: ld a5,0(a0)
0x3ff7fe6e34 <__GI___tls_get_addr+22>: slli a5,a5,0x4
0x3ff7fe6e36 <__GI___tls_get_addr+24>: add a5,a5,a1
0x3ff7fe6e38 <__GI___tls_get_addr+26>: ld a3,0(a5)
(gdb) info register a0
a0 0x1b8 440

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions