!10 backport patches from upstream git repository
From: @hexiaole1994 Reviewed-by: @caodongxia Signed-off-by: @caodongxia
This commit is contained in:
commit
10d88cde16
61
0003-abg-ir-add-missing-else.patch
Normal file
61
0003-abg-ir-add-missing-else.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
From 1ed036e2573e1fc9a1a0aed720eee20a921a38ed Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiaole He <hexiaole@kylinos.cn>
|
||||||
|
Date: Sun, 16 Oct 2022 04:26:42 +0000
|
||||||
|
Subject: [PATCH 1/3] abg-ir: add missing else
|
||||||
|
|
||||||
|
In 'bind_function_type_life_time' function of 'src/abg-ir.cc', the code
|
||||||
|
obtains the member 'const environment*' of 'class function_type', that
|
||||||
|
is, the 'e' variable in below code. And assure the obtained
|
||||||
|
'environment*' is same as the 'const environment*' of the
|
||||||
|
'class translation_unit', that is, the'env' variable in below code:
|
||||||
|
|
||||||
|
/* src/abg-ir.cc begin */
|
||||||
|
1 void
|
||||||
|
2 translation_unit::bind_function_type_life_time(function_type_sptr ftype)
|
||||||
|
3 {
|
||||||
|
4 ...
|
||||||
|
5 const environment* env = get_environment();
|
||||||
|
6 ...
|
||||||
|
7 if (const environment* e = ftype->get_environment())
|
||||||
|
8 ABG_ASSERT(env == e);
|
||||||
|
9 ftype->set_environment(const_cast<environment*>(env));
|
||||||
|
10
|
||||||
|
11 if (const translation_unit* existing_tu = ftype->get_translation_unit())
|
||||||
|
12 ABG_ASSERT(existing_tu == this);
|
||||||
|
13 else
|
||||||
|
14 ftype->set_translation_unit(const_cast<translation_unit*>(this));
|
||||||
|
15 ...
|
||||||
|
/* src/abg-ir.cc end */
|
||||||
|
|
||||||
|
There was a missing 'else' between the 'line 8' and line 9', as the
|
||||||
|
explicit 'else' at the 'line 13'. Without the 'else' between the
|
||||||
|
'line 8' and line 9', there will be a redundant assignment at 'line 9'
|
||||||
|
under the condition when the 'env' is equal to 'e'.
|
||||||
|
This patch add the missing 'else' between the 'line 8' and 'line 9'.
|
||||||
|
|
||||||
|
* src/abg-ir.cc (bind_function_type_life_time): add missing
|
||||||
|
else
|
||||||
|
|
||||||
|
Signed-off-by: Xiaole He <hexiaole@kylinos.cn>
|
||||||
|
Tested-by: Xiaole He <hexiaole@kylinos.cn>
|
||||||
|
---
|
||||||
|
src/abg-ir.cc | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
|
||||||
|
index 4f19e07..a93c494 100644
|
||||||
|
--- a/src/abg-ir.cc
|
||||||
|
+++ b/src/abg-ir.cc
|
||||||
|
@@ -1394,7 +1394,8 @@ translation_unit::bind_function_type_life_time(function_type_sptr ftype) const
|
||||||
|
// translation unit.
|
||||||
|
if (const environment* e = ftype->get_environment())
|
||||||
|
ABG_ASSERT(env == e);
|
||||||
|
- ftype->set_environment(const_cast<environment*>(env));
|
||||||
|
+ else
|
||||||
|
+ ftype->set_environment(const_cast<environment*>(env));
|
||||||
|
|
||||||
|
if (const translation_unit* existing_tu = ftype->get_translation_unit())
|
||||||
|
ABG_ASSERT(existing_tu == this);
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
96
0004-abg-reader-optimize-if-construction.patch
Normal file
96
0004-abg-reader-optimize-if-construction.patch
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
From ead3e6317af191324d9044400152e9c881fc3126 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiaole He <hexiaole@kylinos.cn>
|
||||||
|
Date: Sun, 16 Oct 2022 06:47:03 +0000
|
||||||
|
Subject: [PATCH 2/3] abg-reader: optimize if construction
|
||||||
|
|
||||||
|
In 'build_enum_type_decl' function of 'src/abg-reader.cc', the
|
||||||
|
'for loop' walk through all the child nodes of the '<enum-decl>' for
|
||||||
|
seeking '<underlying-type>' and '<enumerator>':
|
||||||
|
|
||||||
|
/* original src/abg-reader.cc begin */
|
||||||
|
static enum_type_decl_sptr
|
||||||
|
build_enum_type_decl(read_context& ctxt,
|
||||||
|
const xmlNodePtr node,
|
||||||
|
bool add_to_current_scope)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
for (xmlNodePtr n = xmlFirstElementChild(node);
|
||||||
|
n;
|
||||||
|
n = xmlNextElementSibling(n))
|
||||||
|
{
|
||||||
|
if (xmlStrEqual(n->name, BAD_CAST("underlying-type")))
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xmlStrEqual(n->name, BAD_CAST("enumerator")))
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
...
|
||||||
|
}
|
||||||
|
/* original src/abg-reader.cc end */
|
||||||
|
|
||||||
|
Here uses 2 separate 'if' statements for seeking, that is, for any
|
||||||
|
child node of the '<enum-decl>', there involves 2 'if' comparations.
|
||||||
|
Because the child node of the '<enum-decl>' is either
|
||||||
|
'<underlying-type>' or '<enumerator>', there would be a slight
|
||||||
|
optimization when use 'if-else if' construction instead, like below:
|
||||||
|
|
||||||
|
/* optimized src/abg-reader.cc begin */
|
||||||
|
for (xmlNodePtr n = xmlFirstElementChild(node);
|
||||||
|
n;
|
||||||
|
n = xmlNextElementSibling(n))
|
||||||
|
{
|
||||||
|
if (xmlStrEqual(n->name, BAD_CAST("underlying-type")))
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
else if (xmlStrEqual(n->name, BAD_CAST("enumerator")))
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* optimized src/abg-reader.cc end */
|
||||||
|
|
||||||
|
Supposing there has the test case:
|
||||||
|
|
||||||
|
/* test case begin */
|
||||||
|
<abi-instr version='1.0'>
|
||||||
|
<enum-decl name='E' filepath='../../abitests/test-enum0-v0.cc' line='1' column='6' id='type-id-2'>
|
||||||
|
<underlying-type type-id='type-id-1'/>
|
||||||
|
<enumerator name='e0' value='0'/>
|
||||||
|
<enumerator name='e2' value='1'/>
|
||||||
|
</enum-decl>
|
||||||
|
</abi-instr>
|
||||||
|
/* test case end */
|
||||||
|
|
||||||
|
When parsing the '<underlying-type>' xml tag, for the original
|
||||||
|
'src/abg-reader.cc', there involves 2 'if' comparations. But involves
|
||||||
|
only 1 'if' comparation for the optimized 'src/abg-reader.cc'.
|
||||||
|
|
||||||
|
Signed-off-by: Xiaole He <hexiaole@kylinos.cn>
|
||||||
|
Tested-by: Xiaole He <hexiaole@kylinos.cn>
|
||||||
|
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
|
||||||
|
---
|
||||||
|
src/abg-reader.cc | 3 +--
|
||||||
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/abg-reader.cc b/src/abg-reader.cc
|
||||||
|
index 1df3515..ebb55e9 100644
|
||||||
|
--- a/src/abg-reader.cc
|
||||||
|
+++ b/src/abg-reader.cc
|
||||||
|
@@ -4356,8 +4356,7 @@ build_enum_type_decl(read_context& ctxt,
|
||||||
|
base_type_id = CHAR_STR(a);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- if (xmlStrEqual(n->name, BAD_CAST("enumerator")))
|
||||||
|
+ else if (xmlStrEqual(n->name, BAD_CAST("enumerator")))
|
||||||
|
{
|
||||||
|
string name;
|
||||||
|
int64_t value = 0;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
112
0005-abg-diff-utils-fix-typo-in-comments.patch
Normal file
112
0005-abg-diff-utils-fix-typo-in-comments.patch
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
From 1058fa9cecaef8f39066a4d76b82c97f7f5b10ea Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiaole He <hexiaole@kylinos.cn>
|
||||||
|
Date: Sun, 16 Oct 2022 07:02:25 +0000
|
||||||
|
Subject: [PATCH 3/3] abg-diff-utils: fix typo in comments
|
||||||
|
|
||||||
|
Fix typo in comments, from 'pased' to 'passed'.
|
||||||
|
|
||||||
|
* src/abg-diff-utils.h: fix typo in comments
|
||||||
|
|
||||||
|
Signed-off-by: Xiaole He <hexiaole@kylinos.cn>
|
||||||
|
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
|
||||||
|
---
|
||||||
|
include/abg-diff-utils.h | 20 ++++++++++----------
|
||||||
|
1 file changed, 10 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/abg-diff-utils.h b/include/abg-diff-utils.h
|
||||||
|
index 0628950..0389d7c 100644
|
||||||
|
--- a/include/abg-diff-utils.h
|
||||||
|
+++ b/include/abg-diff-utils.h
|
||||||
|
@@ -803,7 +803,7 @@ struct deep_ptr_eq_functor
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param k the number of the diagonal on which we want to find the
|
||||||
|
@@ -942,7 +942,7 @@ end_of_fr_d_path_in_k(int k, int d,
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param k the number of the diagonal on which we want to find the
|
||||||
|
@@ -1116,7 +1116,7 @@ is_match_point(RandomAccessOutputIterator a_begin,
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param a_begin an iterator pointing to the begining of sequence A.
|
||||||
|
@@ -1308,7 +1308,7 @@ print_snake(RandomAccessOutputIterator a_begin,
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param a the first sequence we care about.
|
||||||
|
@@ -1444,7 +1444,7 @@ snake_end_points(const snake& s, point&, point&);
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param a_base the iterator to the base of the first sequence.
|
||||||
|
@@ -1653,7 +1653,7 @@ compute_diff(RandomAccessOutputIterator a_base,
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param a_start an iterator to the beginning of the first sequence
|
||||||
|
@@ -1719,7 +1719,7 @@ compute_diff(RandomAccessOutputIterator a_begin,
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param a_base the iterator to the base of the first sequence.
|
||||||
|
@@ -1779,7 +1779,7 @@ compute_diff(RandomAccessOutputIterator a_base,
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param a_start an iterator to the beginning of the first sequence
|
||||||
|
@@ -1879,7 +1879,7 @@ compute_diff(RandomAccessOutputIterator a_begin,
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param a_base the iterator to the base of the first sequence.
|
||||||
|
@@ -1935,7 +1935,7 @@ compute_diff(RandomAccessOutputIterator a_base,
|
||||||
|
/// call operator member returning a boolean and taking two arguments
|
||||||
|
/// that must be of the same type as the one pointed to by the @ref
|
||||||
|
/// RandomAccessOutputIterator template parameter. This functor is
|
||||||
|
-/// used to compare the elements referred to by the iterators pased in
|
||||||
|
+/// used to compare the elements referred to by the iterators passed in
|
||||||
|
/// argument to this function.
|
||||||
|
///
|
||||||
|
/// @param a_start an iterator to the beginning of the first sequence
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,12 +1,15 @@
|
|||||||
Name: libabigail
|
Name: libabigail
|
||||||
Version: 2.0
|
Version: 2.0
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: ABI generic analysis and instrumentation library
|
Summary: ABI generic analysis and instrumentation library
|
||||||
License: LGPLv3+
|
License: LGPLv3+
|
||||||
URL: https://sourceware.org/libabigail/
|
URL: https://sourceware.org/libabigail/
|
||||||
Source0: http://mirrors.kernel.org/sourceware/libabigail/libabigail-%{version}.tar.gz
|
Source0: http://mirrors.kernel.org/sourceware/libabigail/libabigail-%{version}.tar.gz
|
||||||
Patch0000: 0001-compiler-flags.patch
|
Patch0000: 0001-compiler-flags.patch
|
||||||
Patch0001: 0002-abg-reader-fix-comment-of-function.patch
|
Patch0001: 0002-abg-reader-fix-comment-of-function.patch
|
||||||
|
Patch0002: 0003-abg-ir-add-missing-else.patch
|
||||||
|
Patch0003: 0004-abg-reader-optimize-if-construction.patch
|
||||||
|
Patch0004: 0005-abg-diff-utils-fix-typo-in-comments.patch
|
||||||
BuildRequires: gcc-c++ libtool elfutils-devel libxml2-devel doxygen
|
BuildRequires: gcc-c++ libtool elfutils-devel libxml2-devel doxygen
|
||||||
BuildRequires: python3-sphinx texinfo dos2unix dpkg python3-devel python3-rpm
|
BuildRequires: python3-sphinx texinfo dos2unix dpkg python3-devel python3-rpm
|
||||||
BuildRequires: python3-mock python3-unittest2 python3-pyxdg wget mailcap
|
BuildRequires: python3-mock python3-unittest2 python3-pyxdg wget mailcap
|
||||||
@ -92,6 +95,11 @@ fi
|
|||||||
%doc doc/manuals/html/* README AUTHORS ChangeLog
|
%doc doc/manuals/html/* README AUTHORS ChangeLog
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Oct 18 2022 Xiaole He <hexiaole@kylinos.cn> - 2.0-3
|
||||||
|
- backport patch:0003 to add missing else
|
||||||
|
- backport patch:0004 to optimize if construction
|
||||||
|
- backport patch:0005 to fix typo
|
||||||
|
|
||||||
* Wed Sep 21 2022 Xiaole He <hexiaole@kylinos.cn> - 2.0-2
|
* Wed Sep 21 2022 Xiaole He <hexiaole@kylinos.cn> - 2.0-2
|
||||||
- backport patch:0002 to fix problematic comment
|
- backport patch:0002 to fix problematic comment
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user