Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
afb7a2d495
!45 [sync] PR-42: backport patches from upstream
From: @openeuler-sync-bot 
Reviewed-by: @shenyangyang01 
Signed-off-by: @shenyangyang01
2024-12-12 09:33:56 +00:00
hugel
db1bc02213 backport patches from upstream
(cherry picked from commit a4aa189fbc60a1db96d6466972b04f0b7e54a7e4)
2024-12-12 16:54:25 +08:00
openeuler-ci-bot
a68327ce24
!33 回合上游补丁修复可能的测试失败
From: @laokz 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-11-07 08:40:31 +00:00
laokz
99ecf4c529 backport upstream to avoid tests failure
readelf might produce some warning messages that don't matter for the
specific tests in debugedit.at. So ignore stderr output and just check
stdout output is as expected.

The issue reported by riscv64 building.
2024-11-06 11:09:30 +08:00
openeuler-ci-bot
f4efc11247
!29 [sync] PR-28: 修复loongarch64平台的patch在x86_64或其他平台编译出来的源码包中丢失的问题
From: @openeuler-sync-bot 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-06-07 07:14:15 +00:00
孤独的大河马在躺平
ee49fa9359 Fix lack of loongarch64 patch files in src.rpm package which is build from any platform.
Signed-off-by: 孤独的大河马在躺平 <shaojiansong@kylinos.cn>
(cherry picked from commit 4e87d80348cd4ac17a79b2da6d11ee811e85efcf)
2024-06-07 14:36:50 +08:00
openeuler-ci-bot
c110f5e42f
!20 add loongarch64 support for debugedit
From: @zhangwenlong01 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
2023-01-12 03:00:53 +00:00
Wenlong Zhang
feba2dcb5b add loongarch64 support for debugedit 2023-01-10 19:54:30 +08:00
openeuler-ci-bot
3a2d0f74c7
!16 Skip some unsupported tests for loongarch
From: @zhangwenlong01 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
2022-12-02 06:59:34 +00:00
Wenlong Zhang
4779671b2d Skip some unsupported tests for loongarch 2022-12-02 14:20:23 +08:00
6 changed files with 464 additions and 2 deletions

View File

@ -0,0 +1,29 @@
From 0862098a423f3324b5e8024f94e42ebcc1ec1697 Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Mon, 9 Jan 2023 18:40:28 +0800
Subject: [PATCH] add loongarch support for debugedit
---
tools/debugedit.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/debugedit.c b/tools/debugedit.c
index 668777a..911e84e 100644
--- a/tools/debugedit.c
+++ b/tools/debugedit.c
@@ -618,6 +618,12 @@ setup_relbuf (DSO *dso, debug_section *sec, int *reltype)
goto fail;
break;
#endif
+#if defined(EM_LOONGARCH)
+ case EM_LOONGARCH:
+ if (rtype != R_LARCH_32)
+ goto fail;
+ break;
+#endif
#if defined(EM_MCST_ELBRUS) && defined(R_E2K_32_ABS)
case EM_MCST_ELBRUS:
if (rtype != R_E2K_32_ABS)
--
2.33.0

View File

@ -0,0 +1,102 @@
From 971a74d79b48a19ff1446642f39b3c5a8a7db238 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Thu, 28 Nov 2024 17:58:54 +0100
Subject: [PATCH] find-debuginfo: Check files are writable before modifying
them
Since commit dfe1f7ff3 ("find-debuginfo.sh: Exit with real exit status
in parallel jobs") there is a check whether gdb-add-index worked
correctly and find-debuginfo would fail (even in parallel mode) if an
error occured.
This turned out to show that gdb-add-index needs write permission to
add the gdb index to the file. This is also the case for a couple of
other things, like running objcopy --merge-notes. debugedit and
add_minidebug already made sure it had write permission.
To make sure find-debuginfo doesn't (partially) fail extend the
writable check to include the gdb-add-index and objcopy --merge-notes
invocation.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
scripts/find-debuginfo.in | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in
index a360bf0..4e4ef5a 100755
--- a/scripts/find-debuginfo.in
+++ b/scripts/find-debuginfo.in
@@ -481,14 +481,29 @@ do_file()
$strict && return 2
fi
+ # debugedit makes sure to to get write permission to the file and
+ # restores original state after modifications. Other utilities
+ # might not.
+ f_writable="false"
+ if test -w "$f"; then f_writable="true"; fi
+
# Add .gdb_index if requested.
if $include_gdb_index; then
if type gdb-add-index >/dev/null 2>&1; then
+ if test "$f_writable" = "false"; then
+ chmod u+w "$f"
+ fi
gdb-add-index "$f" || {
status=$?
echo >&2 "*** ERROR:: GDB exited with exit status $status during index generation"
+ if test "$f_writable" = "false"; then
+ chmod u-w "$f"
+ fi
return 2
}
+ if test "$f_writable" = "false"; then
+ chmod u-w "$f"
+ fi
else
echo >&2 "*** ERROR: GDB index requested, but no gdb-add-index installed"
return 2
@@ -497,7 +512,13 @@ do_file()
# Compress any annobin notes in the original binary.
# Ignore any errors, since older objcopy don't support --merge-notes.
+ if test "$f_writable" = "false"; then
+ chmod u+w "$f"
+ fi
objcopy --merge-notes "$f" 2>/dev/null || true
+ if test "$f_writable" = "false"; then
+ chmod u-w "$f"
+ fi
# A binary already copied into /usr/lib/debug doesn't get stripped,
# just has its file names collected and adjusted.
@@ -507,7 +528,7 @@ do_file()
esac
mkdir -p "${debugdn}"
- if test -w "$f"; then
+ if test "$f_writable" = "true"; then
strip_to_debug "${debugfn}" "$f"
else
chmod u+w "$f"
@@ -529,7 +550,15 @@ do_file()
application/x-executable*) skip_mini=false ;;
application/x-pie-executable*) skip_mini=false ;;
esac
- $skip_mini || add_minidebug "${debugfn}" "$f"
+ if test "$skip_mini" = "true"; then
+ if test "$f_writable" = "false"; then
+ chmod u+w "$f"
+ fi
+ add_minidebug "${debugfn}" "$f"
+ if test "$f_writable" = "false"; then
+ chmod u-w "$f"
+ fi
+ fi
fi
echo "./${f#$RPM_BUILD_ROOT}" >> "$ELFBINSFILE"
--
2.33.0

View File

@ -0,0 +1,36 @@
From 41fc1335b8b364c95a8ee2ed2956bbdfe7957853 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Wed, 14 Jun 2023 16:56:38 +0200
Subject: [PATCH] find-debuginfo: remove duplicate filenames when creating
debugsources.list
We remove duplicate filenames when we _process_ debugsources.list.
However, this means that momentarily we may have a very large
(in the range of *giga*bytes) debugsources.list.
This is unnecessary, we can also remove dups when we *create* it.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
scripts/find-debuginfo.in | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in
index 7dec3c3..e7ac095 100755
--- a/scripts/find-debuginfo.in
+++ b/scripts/find-debuginfo.in
@@ -575,7 +575,10 @@ else
exit 1
fi
done
- cat "$temp"/debugsources.* >"$SOURCEFILE"
+ # List of sources may have lots of duplicates. A kernel build was seen
+ # with this list reaching 448 megabytes in size. "sort" helps to not have
+ # _two_ sets of 448 megabytes of temp files here.
+ LC_ALL=C sort -z -u "$temp"/debugsources.* >"$SOURCEFILE"
cat "$temp"/elfbins.* >"$ELFBINSFILE"
fi
--
2.33.0

View File

@ -0,0 +1,107 @@
From dfe1f7ff30f4e0be538835fca1e6348723ea7aa7 Mon Sep 17 00:00:00 2001
From: Keith Seitz <keiths@redhat.com>
Date: Fri, 16 Aug 2024 11:54:20 -0700
Subject: [PATCH] find-debuginfo.sh: Exit with real exit status in parallel
jobs
Currently, when the script is executed in parallel (-jN), the
resulting exit status will always be 0.
The script execs an appropriate number of clones of itself, calling
run_job to run the actual workload. This then calls do_file(), saving
the exit status into "res.$jobid".
In do_file(), though, if an error occurs, exit is called. This causes
the entire exec'd shell to exit with status 0 (since there are almost
always echo calls as the last executed statement). The real exit
status is therefor never written to the "res.$jobid" files by run_job().
The simple solution is to use 'return' instead of 'exit'. A number
of minor adjustments are also made to propagate this properly so that
it is reported as the correct exit status.
While at it, I've incorporated a patch for find-debuginfo/30505.
Using this patch and another patch to the RPM package (submitted as
github issue #3215), failures of gdb-add-index.sh will now properly fail
the build instead of being swallowed. It should be much easier for
developers to figure out why their builds have failed should gdb crash.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30505
Signed-off-by: Keith Seitz <keiths@redhat.com>
---
scripts/find-debuginfo.in | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in
index ae0818f..5998b9d 100755
--- a/scripts/find-debuginfo.in
+++ b/scripts/find-debuginfo.in
@@ -477,16 +477,20 @@ do_file()
-l "$SOURCEFILE" "$f") || exit
if [ -z "$id" ]; then
echo >&2 "*** ${strict_error}: No build ID note found in $f"
- $strict && exit 2
+ $strict && return 2
fi
# Add .gdb_index if requested.
if $include_gdb_index; then
if type gdb-add-index >/dev/null 2>&1; then
- gdb-add-index "$f"
+ gdb-add-index "$f" || {
+ status=$?
+ echo >&2 "*** ERROR:: GDB exited with exit status $status during index generation"
+ return 2
+ }
else
echo >&2 "*** ERROR: GDB index requested, but no gdb-add-index installed"
- exit 2
+ return 2
fi
fi
@@ -547,6 +551,7 @@ run_job()
{
local jobid=$1 filenum
local SOURCEFILE=$temp/debugsources.$jobid ELFBINSFILE=$temp/elfbins.$jobid
+ local res=0
>"$SOURCEFILE"
>"$ELFBINSFILE"
@@ -558,8 +563,12 @@ run_job()
break
fi
do_file $(sed -n "$(( 0x$filenum )) p" "$temp/primary")
+ res=$?
+ if [ $res != 0 ]; then
+ break
+ fi
done
- echo 0 >"$temp/res.$jobid"
+ echo $res >"$temp/res.$jobid"
}
n_files=$(wc -l <"$temp/primary")
@@ -570,6 +579,10 @@ fi
if [ $n_jobs -le 1 ]; then
while read nlinks inum f; do
do_file "$nlinks" "$inum" "$f"
+ res=$?
+ if [ "$res" != "0" ]; then
+ exit $res
+ fi
done <"$temp/primary"
else
for ((i = 1; i <= n_files; i++)); do
@@ -587,7 +600,7 @@ else
test -f "$f" || continue
res=$(< "$f")
if [ "$res" != "0" ]; then
- exit 1
+ exit $res
fi
done
# List of sources may have lots of duplicates. A kernel build was seen
--
2.33.0

View File

@ -0,0 +1,158 @@
From 785f451a1b05f89c3b24eb5550f35488b80152b7 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Wed, 6 Nov 2024 00:28:40 +0100
Subject: [PATCH] tests: Ignore stderr output of readelf in debugedit.at
readelf might produce some warning messages that don't matter for the
specific tests in debugedit.at. So ignore stderr output and just check
stdout output is as expected.
https://sourceware.org/bugzilla/show_bug.cgi?id=31653
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
tests/debugedit.at | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/tests/debugedit.at b/tests/debugedit.at
index 1c59e86..fa38416 100644
--- a/tests/debugedit.at
+++ b/tests/debugedit.at
@@ -308,7 +308,7 @@ AT_CHECK([[
readelf --debug-dump=info foo.o subdir_bar/bar.o baz.o \
| grep -E 'DW_AT_(name|comp_dir)' \
| rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -331,7 +331,7 @@ AT_CHECK([[
readelf --debug-dump=info ./foobarbaz.part.o \
| grep -E 'DW_AT_(name|comp_dir)' \
| rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -353,7 +353,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
AT_CHECK([[
readelf --debug-dump=info ./foobarbaz.exe | grep -E 'DW_AT_(name|comp_dir)' \
| rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -390,7 +390,7 @@ for i in ./foo.o ./subdir_bar/bar.o ./baz.o;do \
| sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \
| sort;
done
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -419,7 +419,7 @@ readelf --debug-dump=info ./foobarbaz.part.o \
| awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \
| sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \
| sort
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -448,7 +448,7 @@ readelf --debug-dump=info ./foobarbaz.exe \
| awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \
| sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \
| sort
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -477,7 +477,7 @@ AT_CHECK([[
readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \
| grep -A3 "The Directory Table" | grep "^ [123]" \
| grep /foo/ | cut -c5- | sort
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -504,7 +504,7 @@ AT_CHECK([[
readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \
| grep -A5 "The Directory Table" | grep "^ [0123]" \
| cut -f2- -d/ | grep ^foo/ | sort -u
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -526,7 +526,7 @@ AT_CHECK([[
readelf --debug-dump=line ./foobarbaz.part.o \
| grep -A3 "The Directory Table" | grep "^ [123]" \
| grep /foo/ | cut -c5- | sort
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -551,7 +551,7 @@ AT_CHECK([[
readelf --debug-dump=line ./foobarbaz.part.o \
| grep -A5 "The Directory Table" | grep "^ [0123]" \
| cut -f2- -d/ | grep ^foo/ | sort -u
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -573,7 +573,7 @@ AT_CHECK([[
readelf --debug-dump=line ./foobarbaz.exe \
| grep -A3 "The Directory Table" | grep "^ [123]" \
| grep /foo/ | cut -c5- | sort
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -598,7 +598,7 @@ AT_CHECK([[
readelf --debug-dump=line ./foobarbaz.exe \
| grep -A5 "The Directory Table" | grep "^ [0123]" \
| cut -f2- -d/ | grep ^foo/ | sort -u
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -623,7 +623,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
AT_CHECK([[
readelf --debug-dump=macro foo.o subdir_bar/bar.o baz.o \
| grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -646,7 +646,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
AT_CHECK([[
readelf --debug-dump=macro ./foobarbaz.part.o \
| grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
@@ -669,7 +669,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
AT_CHECK([[
readelf --debug-dump=macro ./foobarbaz.exe \
| grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
-]],[0],[expout])
+]],[0],[expout],[ignore])
AT_CLEANUP
--
2.39.5

View File

@ -1,6 +1,6 @@
Name: debugedit
Version: 5.0
Release: 4
Release: 9
Summary: Tools for debuginfo creation
License: GPL-2.0-or-later and LGPL-2.1-only and GPL-3.0-only
Group: Applications
@ -21,6 +21,11 @@ Patch0: tests-Handle-zero-directory-entry-in-.debug_line-DWA.patch
Patch1: find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch
Patch6000: backport-Fix-u-option.patch
Patch6001: backport-tests-Ignore-stderr-output-of-readelf-in-debugedit.a.patch
Patch6002: backport-find-debuginfo-remove-duplicate-filenames-when-creat.patch
Patch6003: backport-find-debuginfo.sh-Exit-with-real-exit-status-in-para.patch
Patch6004: backport-find-debuginfo-Check-files-are-writable-before-modif.patch
Patch9000: add-loongarch-support-for-debugedit.patch
%description
Debugedit provides programs and scripts for creating debuginfo and
@ -28,7 +33,17 @@ source file distributions, collect build-ids and rewrite source
paths in DWARF data for debugging, tracing and profiling.
%prep
%autosetup -p1
%setup -q
%patch0 -p1
%patch1 -p1
%patch6000 -p1
%patch6001 -p1
%patch6002 -p1
%patch6003 -p1
%patch6004 -p1
%ifarch loongarch64
%patch9000 -p1
%endif
%build
autoreconf -f -v -i
@ -64,6 +79,21 @@ make check %{?_smp_mflags}
%{_rpmconfigdir}/debugedit
%changelog
* Thu Dec 12 2024 hugel <gengqihu2@h-partners.com> - 5.0-9
- backport patches from upstream
* Wed Nov 6 2024 laokz <zhangkai@iscas.ac.cn> - 5.0-8
- backport upstream patch to avoid tests failure
* Tue May 28 2024 shaojiansong <shaojiansong@kylinos.cn> - 5.0-7
- Fix lack of loongarch64 patch files in src.rpm package which is build from any platform.
* Fri Jan 6 2023 Wenlong Zhang<zhangwenlong@loongson.cn> - 5.0-6
- add loongarch64 support for debugedit
* Mon Nov 14 2022 Wenlong Zhang <zhangwenlong@loongson.cn> - 5.0-5
- Skip some unsupported tests for loongarch
* Tue Nov 08 2022 renhongxun <renhongxun@h-partners.com> 5.0-4
- make it successfully to find debugedit when running /usr/lib/rpm/find-debuginfo.sh