• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# elfutils
2
3仓库包含第三方开源软件elfutils,elfutils是一个用于读取、创建和修改ELF二进制文件,查找和处理GNU/Linux上进程和核心文件的DWARF调试数据、符号、线程状态和堆栈跟踪的工具和库的集合。libabigail软件依赖了elfutils。
4
5## 目录结构
6
7```
8backends/      不同平台的后端实现
9doc/           文档
10lib/           公共库源码
11libasm/        asm相关库源码
12libcpu/        cpu相关库源码
13libdw/         dw相关库源码
14libdwelf/      dwelf相关库源码
15libdwfl/       dwfl相关库源码
16libebl/        ebl相关库源码
17libelf/        elf相关库源码
18src/           源文件
19tests/         测试目录
20COPYING        证书文件
21COPYING-GPLV2  证书文件
22COPYING-LGPLV3 证书文件
23README         README说明
24```
25
26## OpenHarmony如何使用elfutils
27
28OpenHarmony上elfutils是用作libabigail的依赖软件,libabigail在生成ABI特征文件的时候,需要通过elfutils读取二进制库内的DWARF调试数据。
29
30## OpenHarmony如何集成elfutils
31
32libabigail的编译依赖了elfutils,elfutils被集成到libabigail工具中。
33
34### 1.elfutils的编译
35
36elfutils的编译入口在其根目录下的BUILD.gn中。简单示意如下:
37
38```makefile
39# Build libelf
40ohos_static_library("libelf_static") {
41  configs = [ ":elfutils_defaults" ]
42
43  sources = sources_libelf
44  include_dirs = [
45    "//third_party/elfutils",
46    "//third_party/elfutils/lib",
47    "//third_party/elfutils/libelf",
48  ]
49  deps = [ "//third_party/zlib:libz" ]
50
51  subsystem_name = "thirdparty"
52  part_name = "elfutils"
53}
54
55# Build libdw
56ohos_static_library("libdw_static") {
57  configs = [ ":elfutils_defaults" ]
58
59  sources = sources_backends
60  sources += sources_libcpu
61  sources += sources_libdw
62  sources += sources_libdwelf
63  sources += sources_libdwfl
64  sources += sources_libebl
65
66  include_dirs = [
67    "//third_party/elfutils",
68    "//third_party/elfutils/lib",
69    "//third_party/elfutils/libasm",
70    "//third_party/elfutils/libelf",
71    "//third_party/elfutils/libcpu",
72    "//third_party/elfutils/libdw",
73    "//third_party/elfutils/libdwelf",
74    "//third_party/elfutils/libdwfl",
75    "//third_party/elfutils/libebl",
76  ]
77  deps = [ ":libelf_static" ]
78
79  subsystem_name = "thirdparty"
80  part_name = "elfutils"
81}
82
83```
84
85### 2.使用elfutils
86
87libabigail的编译依赖了elfutils。简单示意如下:
88
89```makefile
90ohos_static_library("libabigail_static") {
91  configs = [ "//third_party/libabigail:libabigail_defaults" ]
92
93  sources = [
94    ......
95  ]
96
97  include_dirs = [
98    ......
99  ]
100
101  external_deps = [
102    "//third_party/elfutils:libdw_static",
103  ]
104
105  subsystem_name = "thirdparty"
106  part_name = "libabigail"
107}
108```
109## elfutils相关内容
110
111[elfutils官网](https://sourceware.org/elfutils/)
112
113## License
114
115- `LGPL V3.0`
116
117
118- `GPL V2.0`
119
120
121- `GPL V3.0`
122
123## 风险提示
124
125**<u>‍elfutils是LGPLV3和GPLV3协议类型的三方开源软件,请谨慎使用,使用时须履行相应的开源义务。</u>**
126