Skip to contentSkip to conversation

fix building with GCC 10

PATCH Superseded Timothy Redaelli 4 participants 8 messages Feb 5, 2020 – Mar 4, 2020 Crypto API

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover fix building with GCC 10

GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.

See https://gcc.gnu.org/gcc-10/porting_to.html for more informations.

I didn't put -fcommon to CFLAGS since:
Compiling with -fno-common is useful on targets for which it provides better performance, or if you wish to verify that the program will work on other systems that always treat uninitialized variable definitions this way.
from gcc man page

Timothy Redaelli (3):
crypto/octeontx2: fix building with GCC 10
app/test: fix building with GCC 10
app/test-pipeline: fix building with GCC 10

 app/test-pipeline/config.c                    | 2 +-
 app/test/test_fib_perf.c                      | 2 +-
 app/test/test_lpm_perf.c                      | 2 +-
 drivers/crypto/octeontx2/otx2_cryptodev.c     | 2 ++
 drivers/crypto/octeontx2/otx2_cryptodev.h     | 2 +-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h | 2 +-
 6 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.24.1
#1 lore raw

PATCH 1/3 crypto/octeontx2: fix building with GCC 10

GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.

Fixes 2f8a1b963eb7 ("crypto/octeontx2: add PMD skeleton")
---
 drivers/crypto/octeontx2/otx2_cryptodev.c     | 2 ++
 drivers/crypto/octeontx2/otx2_cryptodev.h     | 2 +-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev.c +2 -0
index 7fd216bb3..957bcd720 100644
@@ -24,6 +24,8 @@
 
 int otx2_cpt_logtype;
 
+uint8_t otx2_cryptodev_driver_id;
+
 static struct rte_pci_id pci_id_cpt_table[] = {
 	{
 		RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
drivers/crypto/octeontx2/otx2_cryptodev.h +1 -1
index 8e0ebc292..c0aa661b3 100644
@@ -38,6 +38,6 @@ extern int otx2_cpt_logtype;
 /*
  * Crypto device driver ID
  */
-uint8_t otx2_cryptodev_driver_id;
+extern uint8_t otx2_cryptodev_driver_id;
 
 #endif /* _OTX2_CRYPTODEV_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.h +1 -1
index a2724f722..f83e36b48 100644
@@ -16,6 +16,6 @@ enum otx2_cpt_egrp {
 	OTX2_CPT_EGRP_AE = 2
 };
 
-struct rte_cryptodev_ops otx2_cpt_ops;
+extern struct rte_cryptodev_ops otx2_cpt_ops;
 
 #endif /* _OTX2_CRYPTODEV_OPS_H_ */
Signature · 1 line
2.24.1
Acked-by on v1 1/3
#2 lore raw

Re: [dpdk-dev] [EXT] [PATCH 1/3] crypto/octeontx2: fix building with GCC 10

Quoted 56 lines

----------------------------------------------------------------------
GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.

Fixes 2f8a1b963eb7 ("crypto/octeontx2: add PMD skeleton")
---
 drivers/crypto/octeontx2/otx2_cryptodev.c     | 2 ++
 drivers/crypto/octeontx2/otx2_cryptodev.h     | 2 +-
 drivers/crypto/octeontx2/otx2_cryptodev_ops.h | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev.c +2 -0
index 7fd216bb3..957bcd720 100644
@@ -24,6 +24,8 @@
 
 int otx2_cpt_logtype;
 
+uint8_t otx2_cryptodev_driver_id;
+
 static struct rte_pci_id pci_id_cpt_table[] = {
 	{
 		RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
drivers/crypto/octeontx2/otx2_cryptodev.h +1 -1
index 8e0ebc292..c0aa661b3 100644
@@ -38,6 +38,6 @@ extern int otx2_cpt_logtype;
 /*
  * Crypto device driver ID
  */
-uint8_t otx2_cryptodev_driver_id;
+extern uint8_t otx2_cryptodev_driver_id;
 
 #endif /* _OTX2_CRYPTODEV_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.h +1 -2
index a2724f722..f83e36b48 100644
@@ -16,6 +16,6 @@ enum otx2_cpt_egrp {
 	OTX2_CPT_EGRP_AE = 2
 };
 
-struct rte_cryptodev_ops otx2_cpt_ops;
+extern struct rte_cryptodev_ops otx2_cpt_ops;
 
 #endif /* _OTX2_CRYPTODEV_OPS_H_ */
--
Quoted 1 line

2.24.1

#3 lore raw

PATCH 2/3 app/test: fix building with GCC 10

In reply to Timothy Redaelli

GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.

Fixes 08e0c7581468 ("test/fib: add performance autotests")
---
 app/test/test_fib_perf.c | 2 +-
 app/test/test_lpm_perf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
app/test/test_fib_perf.c +1 -1
index 573087c3c..dd2e54db8 100644
@@ -35,7 +35,7 @@ struct route_rule {
 	uint8_t depth;
 };
 
-struct route_rule large_route_table[MAX_RULE_NUM];
+static struct route_rule large_route_table[MAX_RULE_NUM];
 
 static uint32_t num_route_entries;
 #define NUM_ROUTE_ENTRIES num_route_entries
app/test/test_lpm_perf.c +1 -1
index a2578fe90..489719c40 100644
@@ -34,7 +34,7 @@ struct route_rule {
 	uint8_t depth;
 };
 
-struct route_rule large_route_table[MAX_RULE_NUM];
+static struct route_rule large_route_table[MAX_RULE_NUM];
 
 static uint32_t num_route_entries;
 #define NUM_ROUTE_ENTRIES num_route_entries
Signature · 1 line
2.24.1
Acked-by on v1 2/3
#4 lore raw

Re: [dpdk-dev] [PATCH 2/3] app/test: fix building with GCC 10

Quoted 31 lines · Timothy Redaelli

GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.

Fixes 08e0c7581468 ("test/fib: add performance autotests")
---
  app/test/test_fib_perf.c | 2 +-
  app/test/test_lpm_perf.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
app/test/test_fib_perf.c +1 -1
index 573087c3c..dd2e54db8 100644
@@ -35,7 +35,7 @@ struct route_rule {
  	uint8_t depth;
  };
 
-struct route_rule large_route_table[MAX_RULE_NUM];
+static struct route_rule large_route_table[MAX_RULE_NUM];
 
  static uint32_t num_route_entries;
  #define NUM_ROUTE_ENTRIES num_route_entries
app/test/test_lpm_perf.c +0 -0
index a2578fe90..489719c40 100644

app/test/test_lpm_perf.c struct route_rule { · line 40

Quoted 8 lines
app/test/test_lpm_perf.c +1 -1
@@ -34,7 +34,7 @@ struct route_rule {
  	uint8_t depth;
  };
 
-struct route_rule large_route_table[MAX_RULE_NUM];
+static struct route_rule large_route_table[MAX_RULE_NUM];
 
  static uint32_t num_route_entries;
  #define NUM_ROUTE_ENTRIES num_route_entries
Signature · 2 lines
Regards,
Vladimir
#5 lore raw

PATCH 3/3 app/test-pipeline: fix building with GCC 10

In reply to Timothy Redaelli

GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.

Fixes 48f31ca50cc4 ("app/pipeline: packet framework benchmark")
---
 app/test-pipeline/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pipeline/config.c +1 -1
index 28ac9fcc0..42c6ed9b2 100644
@@ -42,7 +42,7 @@
 
 #include "main.h"
 
-struct app_params app;
+extern struct app_params app;
 
 static const char usage[] = "\n";
 
Signature · 1 line
2.24.1
#6 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH 3/3] app/test-pipeline: fix building with GCC 10

Quoted 18 lines · Timothy Redaelli

GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.

Fixes 48f31ca50cc4 ("app/pipeline: packet framework benchmark")
---
 app/test-pipeline/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pipeline/config.c +0 -0
index 28ac9fcc0..42c6ed9b2 100644

app/test-pipeline/config.c line 45

Quoted 5 lines
app/test-pipeline/config.c +1 -1
@@ -42,7 +42,7 @@
 
 #include "main.h"
 
-struct app_params app;
+extern struct app_params app;

app is already declared as extern in main.h.

--
David Marchand

#7 lore raw
In reply to Timothy Redaelli
Quoted 4 lines · Timothy Redaelli

GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.

Quoted 8 lines

See https://gcc.gnu.org/gcc-10/porting_to.html for more informations.

I didn't put -fcommon to CFLAGS since:
Compiling with -fno-common is useful on targets for which it provides better performance, or if you wish to verify that the program will work on other systems that always treat uninitialized variable definitions this way.
from gcc man page

Series applied, thanks.

Signature · 1 line
David Marchand