From 7ca2b6fd79eed981e6d13e11e09436717f9dd385 Mon Sep 17 00:00:00 2001 From: zhanghaibo Date: Wed, 1 Mar 2023 15:24:07 +0800 Subject: [PATCH] fix review issue Signed-off-by: zhanghaibo --- BUILD.gn | 28 ---------- README.OpenSource | 13 ++++- README_OpenHarmony.md | 125 ++++++++++++++++++++++++++++++++++++++++++ bundle.json | 4 +- 4 files changed, 138 insertions(+), 32 deletions(-) create mode 100644 README_OpenHarmony.md diff --git a/BUILD.gn b/BUILD.gn index 801cdde1..8f3532e2 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -41,20 +41,6 @@ ohos_static_library("libelf_static") { part_name = "elfutils" } -ohos_shared_library("libelf") { - deps = [ ":libelf_static" ] - subsystem_name = "thirdparty" - part_name = "elfutils" - if (is_ohos) { - output_extension = "so" - } - install_images = [ - "system", - "updater", - ] - license_file = "COPYING-LGPLV3" -} - # Build libdw ohos_static_library("libdw_static") { configs = [ ":elfutils_defaults" ] @@ -84,17 +70,3 @@ ohos_static_library("libdw_static") { subsystem_name = "thirdparty" part_name = "elfutils" } - -ohos_shared_library("libdw") { - deps = [ ":libdw_static" ] - subsystem_name = "thirdparty" - part_name = "elfutils" - if (is_ohos) { - output_extension = "so" - } - install_images = [ - "system", - "updater", - ] - license_file = "COPYING-LGPLV3" -} diff --git a/README.OpenSource b/README.OpenSource index b70c5c73..63848c67 100644 --- a/README.OpenSource +++ b/README.OpenSource @@ -1,9 +1,18 @@ [ { "Name": "elfutils", - "License": "LGPL V3.0", + "License": "LGPL V2.1", + "License File": "", + "Version Number": "0.185", + "Owner": "zhanghaibo0@huawei.com", + "Upstream URL": "https://sourceware.org/elfutils/", + "Description": "A collection of tools and libraries for reading, creating and modifying ELF binaries, finding and processing DWARF debug data, symbols, thread status, and stack trace of processes and core files on GNU/Linux." + }, + { + "Name": "elfutils", + "License": "LGPL V3 or GPL V2", "License File": "COPYING-LGPLV3", - "Version Number": "v0.185", + "Version Number": "0.185", "Owner": "zhanghaibo0@huawei.com", "Upstream URL": "https://sourceware.org/elfutils/", "Description": "A collection of tools and libraries for reading, creating and modifying ELF binaries, finding and processing DWARF debug data, symbols, thread status, and stack trace of processes and core files on GNU/Linux." diff --git a/README_OpenHarmony.md b/README_OpenHarmony.md new file mode 100644 index 00000000..ebd724d9 --- /dev/null +++ b/README_OpenHarmony.md @@ -0,0 +1,125 @@ +# elfutils + +仓库包含第三方开源软件elfutils,elfutils是一个用于读取、创建和修改ELF二进制文件,查找和处理GNU/Linux上进程和核心文件的DWARF调试数据、符号、线程状态和堆栈跟踪的工具和库的集合。libabigail软件依赖了elfutils。 + +## 目录结构 + +``` +backends/ 不同平台的后端实现 +doc/ 文档 +lib/ 公共库源码 +libasm/ asm相关库源码 +libcpu/ cpu相关库源码 +libdw/ dw相关库源码 +libdwelf/ dwelf相关库源码 +libdwfl/ dwfl相关库源码 +libebl/ ebl相关库源码 +libelf/ elf相关库源码 +src/ 源文件 +tests/ 测试目录 +COPYING 证书文件 +COPYING-GPLV2 证书文件 +COPYING-LGPLV3 证书文件 +README README说明 +``` + +## OpenHarmony如何使用elfutils + +OpenHarmony上elfutils是用作libabigail的依赖软件,libabigail在生成ABI特征文件的时候,需要通过elfutils读取二进制库内的DWARF调试数据。 + +## OpenHarmony如何集成elfutils + +libabigail的编译依赖了elfutils,elfutils被集成到libabigail工具中。 + +### 1.elfutils的编译 + +elfutils的编译入口在其根目录下的BUILD.gn中。简单示意如下: + +```makefile +# Build libelf +ohos_static_library("libelf_static") { + configs = [ ":elfutils_defaults" ] + + sources = sources_libelf + include_dirs = [ + "//third_party/elfutils", + "//third_party/elfutils/lib", + "//third_party/elfutils/libelf", + ] + deps = [ "//third_party/zlib:libz" ] + + subsystem_name = "thirdparty" + part_name = "elfutils" +} + +# Build libdw +ohos_static_library("libdw_static") { + configs = [ ":elfutils_defaults" ] + + sources = sources_backends + sources += sources_libcpu + sources += sources_libdw + sources += sources_libdwelf + sources += sources_libdwfl + sources += sources_libebl + + include_dirs = [ + "//third_party/elfutils", + "//third_party/elfutils/lib", + "//third_party/elfutils/libasm", + "//third_party/elfutils/libelf", + "//third_party/elfutils/libcpu", + "//third_party/elfutils/libdw", + "//third_party/elfutils/libdwelf", + "//third_party/elfutils/libdwfl", + "//third_party/elfutils/libebl", + ] + deps = [ ":libelf_static" ] + + subsystem_name = "thirdparty" + part_name = "elfutils" +} + +``` + +### 2.使用elfutils + +libabigail的编译依赖了elfutils。简单示意如下: + +```makefile +ohos_static_library("libabigail_static") { + configs = [ "//third_party/libabigail:libabigail_defaults" ] + + sources = [ + ...... + ] + + include_dirs = [ + ...... + ] + + external_deps = [ + "//third_party/elfutils:libdw_static", + ] + + subsystem_name = "thirdparty" + part_name = "libabigail" +} +``` +## elfutils相关内容 + +[elfutils官网](https://sourceware.org/elfutils/) + +## License + +- `LGPL V3.0` + + +- `GPL V2.0` + + +- `GPL V3.0` + +## 风险提示 + +**‍elfutils是LGPL和GPL许可证的三方开源软件,请谨慎使用,使用时须履行相应的开源义务。** diff --git a/bundle.json b/bundle.json index 8bb766dc..c2c79547 100644 --- a/bundle.json +++ b/bundle.json @@ -2,14 +2,14 @@ "name": "@ohos/elfutils", "description": "elfutils is a collection of utilities and libraries to read, create and modify ELF binary files, find and handle DWARF debug data, symbols, thread state and stacktraces for processes and core files on GNU/Linux.", "version": "0.185", - "license": "GPL", + "license": "LGPL V2.1,LGPL V3 or GPL v2", "publishAs": "code-segment", "segment": { "destPath": "third_party/elfutils" }, "dirs": {}, "scripts": {}, - "licensePath": "COPYING", + "licensePath": "COPYING-LGPLV3", "readmePath": { "en": "README" }, -- Gitee