!91 etmem: add debug info for etmem

From: @twicy 
Reviewed-by: @liubo254 
Signed-off-by: @liubo254
This commit is contained in:
openeuler-ci-bot 2024-04-08 07:06:02 +00:00 committed by Gitee
commit 0ce12d6162
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 69 additions and 5 deletions

View File

@ -0,0 +1,59 @@
From ae1a854beda0b9318e080acff64de3375eff75d3 Mon Sep 17 00:00:00 2001
From: Liu Chao <liuchao173@huawei.com>
Date: Tue, 2 Apr 2024 16:01:50 +0800
Subject: [PATCH] etmem: construct etmem debug info package
Currently, there is no debug info package for etmem, and this
can be a problem when trying to analyze a coredump
Signed-off-by: tangyuchen <tangyuchen5@huawei.com>
---
etmem/CMakeLists.txt | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/etmem/CMakeLists.txt b/etmem/CMakeLists.txt
index 0b38f07..6018ce0 100644
--- a/etmem/CMakeLists.txt
+++ b/etmem/CMakeLists.txt
@@ -83,9 +83,11 @@ target_compile_options(etmemd PRIVATE -fsigned-char -fno-omit-frame-pointer -Wal
if(CONFIG_DEBUG STREQUAL "y")
target_compile_options(etmemd PRIVATE -g)
+else()
+ target_link_options(etmemd PRIVATE -s)
endif()
-set_target_properties(etmemd PROPERTIES LINK_FLAGS "-s -fPIE -pie -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines")
+target_link_options(etmemd PRIVATE -fPIE -pie -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines)
target_link_libraries(etmemd PRIVATE pthread dl rt boundscheck numa ${GLIB2_LIBRARIES})
if( ${ARCHITECTURE} STREQUAL "aarch64" )
@@ -102,9 +104,11 @@ target_compile_options(etmem PRIVATE -fsigned-char -fno-omit-frame-pointer -Wall
if(CONFIG_DEBUG STREQUAL "y")
target_compile_options(etmem PRIVATE -g)
+else()
+ target_link_options(etmem PRIVATE -s)
endif()
-set_target_properties(etmem PROPERTIES LINK_FLAGS "-s -fPIE -pie -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines")
+target_link_options(etmem PRIVATE -fPIE -pie -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines)
target_link_libraries(etmem PRIVATE pthread dl rt boundscheck)
if( ${ARCHITECTURE} STREQUAL "aarch64" )
@@ -122,9 +126,11 @@ target_compile_options(etmemd_scan PRIVATE -fsigned-char -fno-omit-frame-pointer
if(CONFIG_DEBUG STREQUAL "y")
target_compile_options(etmemd_scan PRIVATE -g)
+else()
+ target_link_options(etmemd_scan PRIVATE -s)
endif()
-set_target_properties(etmemd_scan PROPERTIES LINK_FLAGS "-s -fPIE -pie -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -Wl,--version-script=${ETMEMD_SRC_DIR}/etmemd_scan.version")
+target_link_options(etmemd_scan PRIVATE -fPIE -pie -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -Wl,--version-script=${ETMEMD_SRC_DIR}/etmemd_scan.version)
target_link_libraries(etmemd_scan PRIVATE pthread dl rt boundscheck numa ${GLIB2_LIBRARIES})
if( ${ARCHITECTURE} STREQUAL "aarch64" )
--
2.33.0

View File

@ -1,9 +1,7 @@
%global debug_package %{nil}
Name: etmem
Version: 1.0
Release: 15
Summary: etmem
Release: 16
Summary: etmem
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/etmem
Source0: https://gitee.com/openeuler/etmem/repository/archive/%{version}.tar.gz
@ -97,6 +95,7 @@ Patch85: 0086-etmem-remove-unnecessary-log-code.patch
Patch86: 0087-etmem-fix-memory-leak-and-fd-leak.patch
Patch87: 0088-etmem-fix-multiple-etmemd-and-too-many-err-log-probl.patch
Patch88: 0089-etmem-fix-project-stop-cmd-timeout-problem.patch
Patch89: 0090-etmem-construct-etmem-debug-info-package.patch
#Dependency
BuildRequires: cmake gcc gcc-c++ glib2-devel
@ -114,7 +113,7 @@ etmem module
%build
mkdir -p build
cd build
cmake ..
cmake .. -DCONFIG_DEBUG=y
make
%install
@ -150,6 +149,12 @@ install -m 0644 userswap/include/uswap_api.h $RPM_BUILD_ROOT%{_includedir}
%postun -p /sbin/ldconfig
%changelog
* Wed Apr 3 2024 tangyuchen <tangyuchen5@huawei.com> 1.0-16
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:add debug info support for etmem
* Thu Aug 24 2023 volcanodragon <linfeilong@huawei.com> 1.0-15
- fix project stop cmd timeout problem