From d057b9309aec3a5a53aaee1ac3451a8a5b71b4e8 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 14 May 2022 18:22:26 +0100 Subject: [PATCH] hping: fix build against gcc-10 (-fno-common) gcc-10 changed the default from -fcommon to fno-common: https://gcc.gnu.org/PR85678 As a result build fails as: ld: scan.o:/build/hping/hping2.h:360: multiple definition of `delaytable'; main.o:/build/hping/hping2.h:360: first defined here The change moves variable definitions to .c file. --- hping2.h | 2 +- main.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hping2.h b/hping2.h index 27cb0ff..60d4370 100644 --- a/hping2.h +++ b/hping2.h @@ -357,7 +357,7 @@ struct delaytable_element { int status; }; -volatile struct delaytable_element delaytable[TABLESIZE]; +extern volatile struct delaytable_element delaytable[TABLESIZE]; /* protos */ void nop(void); /* nop */ diff --git a/main.c b/main.c index 3aedd86..f7bace6 100644 --- a/main.c +++ b/main.c @@ -30,6 +30,8 @@ #include "hping2.h" +volatile struct delaytable_element delaytable[TABLESIZE]; + /* globals */ unsigned int tcp_th_flags = 0,