Closed
[Requirement|需求建议]: atrace提供打桩so #960
GuoWenboAdd on  Sep 10Closed at  Sep 20
GuoWenboCollaborators
Sep 10 Create

Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.

Backgroud(背景信息)

在某些芯片形态,不需要trace的功能,但由于上下游依赖,需要提供一个桩so,确保接口调用能正常返回;
本issue只负责跟踪runtime仓提供桩so的编译功能
至于对应芯片形态下,使用桩so打包的功能需要在工程仓完成,由其他issue跟踪

Origin(信息来源)

小型化芯片

Benefit / Necessity (价值/作用)

Design(设计方案)

参考awatchdog_stub_share的实现,编译一个libascend_trace.so的同名桩so,编译产物放到stub目录下;

likedislike
GGuoWenboCollaborators
Sep 10 Added label: requirement
GGuoWenboCollaborators
Sep 10 Modify description of issue
GGuoWenboCollaborators
Sep 10 Assign GuoWenbo as responsible person
GuoWenboCollaborators
Sep 11 Comments:

补充工程仓打包实现细节:
build/release/config/module/ascend/NPURuntime.xml 为打包配置文件
libascend_trace.so需要排除ascend5162a形态打包,即
<file value="libascend_trace.so" pkg_feature="filter_ascend5162a"/>
stub/libascend_trace.so仅在ascend5162a形态打包,即
<file value="stub/libascend_trace.so" pkg_feature="ascend5162a"/>

likedislike
GGuoWenboCollaborators
Sep 11 Associated pull request
GuoWenboCollaborators
Sep 16 Comments:

测试例执行出错

[root@localhost interface_test_bin]# bash run_test.sh /home/g30038620/tmp/libascend_trace.so
[INFO] 桩 so: /home/g30038620/tmp/libascend_trace.so
[INFO] 已链接 /home/g30038620/tmp/libascend_trace.so -> /mnt/workspace/runtime_issue_960_20260910211704/build/src/dfx/trace/atrace/utrace/stub/libascend_trace.so
run_test.sh: line 38: ./atrace_stub_utest: Permission denied
[root@localhost interface_test_bin]# chmod +x *
[root@localhost interface_test_bin]# bash run_test.sh /home/g30038620/tmp/libascend_trace.so
[INFO] 桩 so: /home/g30038620/tmp/libascend_trace.so
./atrace_stub_utest: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by ./atrace_stub_utest)
./atrace_stub_utest: /usr/lib64/libc.so.6: version `GLIBC_2.38' not found (required by /home/g30038620/tmp/interface_test_bin/lib/libgtest.so.1.14.0)
./atrace_stub_utest: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /home/g30038620/tmp/interface_test_bin/lib/libgtest.so.1.14.0)
likedislike
GuoWenboCollaborators
Sep 17 Comments:

测试例执行的32位环境信息
/asic_test/g30038620/interface_test_bin # ash
/asic_test/g30038620/interface_test_bin # uname -a
Linux (none) 5.10.0-xilinx #1 SMP PREEMPT Fri Sep 11 17:22:24 CST 2026 armv7l GNU/Linux
/asic_test/g30038620/interface_test_bin # cat /etc/
audio/ hi_version passwd samba/ sshd_config
chip_version inittab ppp/ sec/ turbo.cfg
cpurate iproute2/ profile shadow udhcpd.conf
ethertypes ksmbd/ rc.d/ ssh/ xl2tpd/
/asic_test/g30038620/interface_test_bin # cat /etc/os-release
cat: can't open '/etc/os-release': No such file or directory
/asic_test/g30038620/interface_test_bin # ls -l /bin/sh
lrwxrwxrwx 1 root 0 7 Sep 11 2026 /bin/sh -> busybox
/asic_test/g30038620/interface_test_bin # ls -l /bin/busybox
-rwsr-xr-x 1 root 0 1928008 Sep 11 2026 /bin/busybox
/asic_test/g30038620/interface_test_bin # which gcc cc
/asic_test/g30038620/interface_test_bin # getconf GUN_LIBC_VERSION 2>/dev/null |
| ls /lib/ld-*
/lib/ld-musl-arm.so.1

likedislike
GuoWenboCollaborators
Sep 17 Comments:

最终工程仓适配与预期有所差异,ascend5162a和filter_ascend5162a的定义是反直觉的
工程仓打包最终实现:
build/release/config/module/ascend/NPURuntime.xml 为打包配置文件
libascend_trace.so需要排除ascend5162a形态打包,即

stub/libascend_trace.so仅在ascend5162a形态打包,即

likedislike
GGuoWenboCollaborators
Sep 20 changed custom state from 进行中 to 已解决
GGuoWenboCollaborators
Sep 20 Close issue
CANN-robotCANN-robotCollaborators
Sep 21 Added label: resolved