systemtap: fix systemtap-native build error on Fedora 40

Backport of couple patches from upstream.

(From OE-Core rev: bca8aa07ce0cea82f6f17381efaeba897edab265)

Signed-off-by: Victor Kamensky <victor.kamensky7@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit cc486f26db46c562e35f770c16edf3f4035e536e)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Victor Kamensky 2024-06-09 20:34:03 -07:00 committed by Steve Sakoman
parent 2b073f0eaa
commit e7e5720dd4
3 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,32 @@
From 91caf37e4dfe862f9b68447b1597c0d0f31523c3 Mon Sep 17 00:00:00 2001
From: "Frank Ch. Eigler" <fche@redhat.com>
Date: Tue, 7 May 2024 15:04:04 -0400
Subject: [PATCH] elaborate.cxx: gcc version compatibility hack redux
Note __GNUC__ >= 14 for this diagnostic.
Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=91caf37e4dfe862f9b68447b1597c0d0f31523c3]
Signed-off-by: Victor Kamensky <victor.kamensky7@gmail.com>
---
elaborate.cxx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/elaborate.cxx b/elaborate.cxx
index 88505559b..c08023f1d 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -2656,9 +2656,11 @@ symresolution_info::symresolution_info (systemtap_session& s, bool omniscient_un
session (s), unmangled_p(omniscient_unmangled), current_function (0), current_probe (0)
{
#pragma GCC diagnostic push
+ #if __GNUC__ >= 14
// c10s early snapshot GCC complains about this construct, which is
// made safe via our dtor usage
#pragma GCC diagnostic ignored "-Wdangling-pointer"
+ #endif
saved_session_symbol_resolver = s.symbol_resolver;
s.symbol_resolver = this; // save resolver for early PR25841 function resolution
#pragma GCC diagnostic pop
--
2.45.2

View File

@ -0,0 +1,52 @@
From d11241bdd05bc4c745c8aef53a2725331e1a93b4 Mon Sep 17 00:00:00 2001
From: "Frank Ch. Eigler" <fche@redhat.com>
Date: Tue, 7 May 2024 14:25:12 -0400
Subject: [PATCH] elaborate.cxx: gcc version compatibility hack
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Suppress -Wdangling-pointer for a construct that appears valid, but
one particular GCC snapshot version complains about.
In constructor symresolution_info::symresolution_info(systemtap_session&, bool),
inlined from int semantic_pass_symbols(systemtap_session&) at ../systemtap/elaborate.cxx:1872:28:
../systemtap/elaborate.cxx:2659:21: error: storing the address of local variable sym in *s.systemtap_session::symbol_resolver [-Werror=dangling-pointer=]
2659 | s.symbol_resolver = this; // save resolver for early PR25841 function resolution
| ~~~~~~~~~~~~~~~~~~^~~~~~
../systemtap/elaborate.cxx: In function int semantic_pass_symbols(systemtap_session&):
../systemtap/elaborate.cxx:1872:22: note: sym declared here
1872 | symresolution_info sym (s);
| ^~~
../systemtap/elaborate.cxx:1870:43: note: s declared here
1870 | semantic_pass_symbols (systemtap_session& s)
| ~~~~~~~~~~~~~~~~~~~^
cc1plus: all warnings being treated as errors
Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=d11241bdd05bc4c745c8aef53a2725331e1a93b4]
Signed-off-by: Victor Kamensky <victor.kamensky7@gmail.com>
---
elaborate.cxx | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/elaborate.cxx b/elaborate.cxx
index 8bf9e6c06..88505559b 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -2655,8 +2655,13 @@ semantic_pass (systemtap_session& s)
symresolution_info::symresolution_info (systemtap_session& s, bool omniscient_unmangled):
session (s), unmangled_p(omniscient_unmangled), current_function (0), current_probe (0)
{
+ #pragma GCC diagnostic push
+ // c10s early snapshot GCC complains about this construct, which is
+ // made safe via our dtor usage
+ #pragma GCC diagnostic ignored "-Wdangling-pointer"
saved_session_symbol_resolver = s.symbol_resolver;
s.symbol_resolver = this; // save resolver for early PR25841 function resolution
+ #pragma GCC diagnostic pop
}
--
2.45.2

View File

@ -12,6 +12,8 @@ SRC_URI = "git://sourceware.org/git/systemtap.git;branch=master;protocol=https \
file://0001-configure.ac-fix-broken-libdebuginfod-library-auto-d.patch \
file://0001-bpf-translate.cxx-fix-build-against-upcoming-gcc-14-.patch \
file://0001-staprun-fix-build-against-upcoming-gcc-14-Werror-cal.patch \
file://0001-elaborate.cxx-gcc-version-compatibility-hack.patch \
file://0001-elaborate.cxx-gcc-version-compatibility-hack-redux.patch \
"
COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips|riscv64).*-linux'