Backports for Kirkstone
cover Backports for Kirkstone
We recently started building with Poky Kirkstone (quite a leap from our ancient and venerable branch of Sumo) which includes a newer set of tools in the toolchain:
binutils 2.30 -> 2.38
gcc 7.3.3 -> 11.2.0
glibc 2.27 -> 2.35
This uncovered some issues while cross-compiling on the 4.x kernels. The following patches help in building the 4.19 branch again.
These backports are already applied all the way down to 5.4.
Arnaldo Carvalho de Melo (2):
perf bench: Share some global variables to fix build with gcc 10 perf tests bp_account: Make global variable static
Ben Hutchings (1):
libtraceevent: Fix build with binutils 2.35
tools/lib/traceevent/Makefile | 2 +- tools/perf/bench/bench.h | 4 ++++ tools/perf/bench/futex-hash.c | 12 ++++++------ tools/perf/bench/futex-lock-pi.c | 11 +++++------ tools/perf/tests/bp_account.c | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/3 libtraceevent: Fix build with binutils 2.35
From: Ben Hutchings <[email protected]>
[ Upstream commit 39efdd94e314336f4acbac4c07e0f37bdc3bef71 ]
In binutils 2.35, 'nm -D' changed to show symbol versions along with symbol names, with the usual @@ separator. When generating libtraceevent-dynamic-list we need just the names, so strip off the version suffix if present.
--- tools/lib/traceevent/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/traceevent/Makefile +1 -1
@@ -263,7 +263,7 @@ define do_generate_dynamic_list_file xargs echo "U w W" | tr 'w ' 'W\n' | sort -u | xargs echo`;\ if [ "$$symbol_type" = "U W" ];then \ (echo '{'; \ - $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\ + $(NM) -u -D $1 | awk 'NF>1 {sub("@.*", "", $$2); print "\t"$$2";"}' | sort -u;\ echo '};'; \ ) > $2; \ else \
Signature · 1 line
2.32.0
PATCH 2/3 perf bench: Share some global variables to fix build with gcc 10
In reply to Daniel DíazFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit e4d9b04b973b2dbce7b42af95ea70d07da1c936d ]
Noticed with gcc 10 (fedora rawhide) that those variables were not being declared as static, so end up with:
ld: /tmp/build/perf/bench/epoll-wait.o:/git/perf/tools/perf/bench/epoll-wait.c:93: multiple definition of `end'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
ld: /tmp/build/perf/bench/epoll-wait.o:/git/perf/tools/perf/bench/epoll-wait.c:93: multiple definition of `start'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
ld: /tmp/build/perf/bench/epoll-wait.o:/git/perf/tools/perf/bench/epoll-wait.c:93: multiple definition of `runtime'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
ld: /tmp/build/perf/bench/epoll-ctl.o:/git/perf/tools/perf/bench/epoll-ctl.c:38: multiple definition of `end'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
ld: /tmp/build/perf/bench/epoll-ctl.o:/git/perf/tools/perf/bench/epoll-ctl.c:38: multiple definition of `start'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here
ld: /tmp/build/perf/bench/epoll-ctl.o:/git/perf/tools/perf/bench/epoll-ctl.c:38: multiple definition of `runtime'; /tmp/build/perf/bench/futex-hash.o:/git/perf/tools/perf/bench/futex-hash.c:40: first defined here make[4]: *** [/git/perf/tools/build/Makefile.build:145: /tmp/build/perf/bench/perf-in.o] Error 1
Prefix those with bench__ and add them to bench/bench.h, so that we can share those on the tools needing to access those variables from signal handlers.
--- tools/perf/bench/bench.h | 4 ++++ tools/perf/bench/futex-hash.c | 12 ++++++------ tools/perf/bench/futex-lock-pi.c | 11 +++++------ 3 files changed, 15 insertions(+), 12 deletions(-)
tools/perf/bench/bench.h +4 -0
@@ -2,6 +2,10 @@#ifndef BENCH_H #define BENCH_H +#include <sys/time.h> + +extern struct timeval bench__start, bench__end, bench__runtime; +/* * The madvise transparent hugepage constants were added in glibc * 2.13. For compatibility with older versions of glibc, define these
tools/perf/bench/futex-hash.c +6 -6
@@ -35,7 +35,7 @@ static unsigned int nfutexes = 1024;static bool fshared = false, done = false, silent = false;static int futex_flag =0 ; -struct timeval start, end, runtime; +struct timeval bench__start, bench__end, bench__runtime;static pthread_mutex_t thread_lock;static unsigned int threads_starting;static struct stats throughput_stats;
@@ -101,8 +101,8 @@ static void toggle_done(int sig __maybe_unused, {/* inform all threads that we're done for the day */ done = true; -gettimeofday (&end,NULL ); -timersub (&end, &start, &runtime); +gettimeofday (&bench__end,NULL ); +timersub (&bench__end, &bench__start, &bench__runtime); }static void print_summary (void )
@@ -112,7 +112,7 @@ static void print_summary(void)printf ("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n" , !silent ?"\n" :"" , avg,rel_stddev_stats (stddev, avg), - (int ) runtime.tv_sec); + (int )bench__runtime.tv_sec); }int bench_futex_hash (int argc,const char **argv)
@@ -159,7 +159,7 @@ int bench_futex_hash(int argc, const char **argv) threads_starting = nthreads;pthread_attr_init (&thread_attr); -gettimeofday (&start,NULL ); +gettimeofday (&bench__start,NULL );for (i =0 ; i < nthreads; i++) { worker[i].tid = i; worker[i].futex =calloc (nfutexes,sizeof (*worker[i].futex));
@@ -202,7 +202,7 @@ int bench_futex_hash(int argc, const char **argv)pthread_mutex_destroy (&thread_lock);for (i =0 ; i < nthreads; i++) { -unsigned long t = worker[i].ops/runtime.tv_sec; +unsigned long t = worker[i].ops / bench__runtime.tv_sec;update_stats (&throughput_stats, t);if (!silent) {if (nfutexes ==1 )
tools/perf/bench/futex-lock-pi.c +5 -6
@@ -35,7 +35,6 @@ static bool silent = false, multi = false;static bool done = false, fshared = false;static unsigned int nthreads =0 ;static int futex_flag =0 ; -struct timeval start, end, runtime;static pthread_mutex_t thread_lock;static unsigned int threads_starting;static struct stats throughput_stats;
@@ -62,7 +61,7 @@ static void print_summary(void)printf ("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n" , !silent ?"\n" :"" , avg,rel_stddev_stats (stddev, avg), - (int ) runtime.tv_sec); + (int )bench__runtime.tv_sec); } static void toggle_done(int sig __maybe_unused,
@@ -71,8 +70,8 @@ static void toggle_done(int sig __maybe_unused, {/* inform all threads that we're done for the day */ done = true; -gettimeofday (&end,NULL ); -timersub (&end, &start, &runtime); +gettimeofday (&bench__end,NULL ); +timersub (&bench__end, &bench__start, &bench__runtime); }static void *workerfn (void *arg)
@@ -183,7 +182,7 @@ int bench_futex_lock_pi(int argc, const char **argv) threads_starting = nthreads;pthread_attr_init (&thread_attr); -gettimeofday (&start,NULL ); +gettimeofday (&bench__start,NULL );create_threads (worker, thread_attr, cpu);pthread_attr_destroy (&thread_attr);
@@ -209,7 +208,7 @@ int bench_futex_lock_pi(int argc, const char **argv)pthread_mutex_destroy (&thread_lock);for (i =0 ; i < nthreads; i++) { -unsigned long t = worker[i].ops/runtime.tv_sec; +unsigned long t = worker[i].ops / bench__runtime.tv_sec;update_stats (&throughput_stats, t);if (!silent)
Signature · 1 line
2.32.0
PATCH 3/3 perf tests bp_account: Make global variable static
In reply to Daniel DíazFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit cff20b3151ccab690715cb6cf0f5da5cccb32adf ]
To fix the build with newer gccs, that without this patch exit with:
LD /tmp/build/perf/tests/perf-in.o
ld: /tmp/build/perf/tests/bp_account.o:/git/perf/tools/perf/tests/bp_account.c:22: multiple definition of `the_var'; /tmp/build/perf/tests/bp_signal.o:/git/perf/tools/perf/tests/bp_signal.c:38: first defined here make[4]: *** [/git/perf/tools/build/Makefile.build:145: /tmp/build/perf/tests/perf-in.o] Error 1
First noticed in fedora:rawhide/32 with:
[perfbuilder@a5ff49d6e6e4 ~]$ gcc --version gcc (GCC) 10.0.1 20200216 (Red Hat 10.0.1-0.8)
--- tools/perf/tests/bp_account.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/bp_account.c +1 -1
@@ -22,7 +22,7 @@#include "perf.h" #include "cloexec.h" -volatile long the_var; +static volatile long the_var; static noinline int test_function(void) {
Signature · 1 line
2.32.0
Greg KH
maintainerQuoted 21 lines · Daniel Díaz
We recently started building with Poky Kirkstone (quite a leap from our ancient and venerable branch of Sumo) which includes a newer set of tools in the toolchain:
binutils 2.30 -> 2.38
gcc 7.3.3 -> 11.2.0
glibc 2.27 -> 2.35This uncovered some issues while cross-compiling on the 4.x kernels. The following patches help in building the 4.19 branch again.
These backports are already applied all the way down to 5.4.
Arnaldo Carvalho de Melo (2):
perf bench: Share some global variables to fix build with gcc 10 perf testsbp_account: Make global variable staticBen Hutchings (1):
libtraceevent: Fix build with binutils 2.35
Quoted 10 lines
tools/lib/traceevent/Makefile | 2 +- tools/perf/bench/bench.h | 4 ++++ tools/perf/bench/futex-hash.c | 12 ++++++------ tools/perf/bench/futex-lock-pi.c | 11 +++++------ tools/perf/tests/bp_account.c | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-)Signature · 1 line
2.32.0
All now queued up, thanks.
greg k-h