Skip to contentSkip to conversation

mk: pass EXTRA_CFLAGS to AUTO_CPUFLAGS to enable local modifications

PATCH Applied Simon Kagstrom 4 participants 7 messages Nov 24, 2015 – Dec 7, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mk: pass EXTRA_CFLAGS to AUTO_CPUFLAGS to enable local modifications

We have encountered a CPU where the AES-NI instruction set is disabled due to export restrictions. Since the build machine and target machine is different, using -native configs doesn't work, and on this CPU, the application refuses to run due to the AES CPU flags being amiss.

The patch passes EXTRA_CFLAGS to the figure-out-cpu-flags helper, which allows us to add -mno-aes to the compile flags and resolve this problem.

---
ChangeLog:

v2:
* Put EXTRA_CFLAGS after MACHINE_CFLAGS to enable overriding values

 mk/rte.cpuflags.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mk/rte.cpuflags.mk +1 -1
index bec7bdd..4b30c6b 100644
@@ -33,7 +33,7 @@
 # used to set the RTE_CPUFLAG_* environment variables giving details
 # of what instruction sets the target cpu supports.
 
-AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) -dM -E - < /dev/null)
+AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(EXTRA_CFLAGS) -dM -E - < /dev/null)
 
 # adding flags to CPUFLAGS
 
Signature · 1 line
1.9.1
#1 lore raw

Hi Olivier!

Does this commit look OK now with the changes you proposed?

Thanks,
// Simon

Quoted 33 lines · Simon Kagstrom

We have encountered a CPU where the AES-NI instruction set is disabled due to export restrictions. Since the build machine and target machine is different, using -native configs doesn't work, and on this CPU, the application refuses to run due to the AES CPU flags being amiss.

The patch passes EXTRA_CFLAGS to the figure-out-cpu-flags helper, which allows us to add -mno-aes to the compile flags and resolve this problem.

---
ChangeLog:

v2:
* Put EXTRA_CFLAGS after MACHINE_CFLAGS to enable overriding values

 mk/rte.cpuflags.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mk/rte.cpuflags.mk +1 -1
index bec7bdd..4b30c6b 100644
@@ -33,7 +33,7 @@
 # used to set the RTE_CPUFLAG_* environment variables giving details
 # of what instruction sets the target cpu supports.
 
-AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) -dM -E - < /dev/null)
+AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(EXTRA_CFLAGS) -dM -E - < /dev/null)
 
 # adding flags to CPUFLAGS
 
Acked-by
#2 lore raw

Hi Simon,

Quoted 35 lines · Simon Kågström

Hi Olivier!

Does this commit look OK now with the changes you proposed?

Thanks,
// Simon

Quoted 27 lines · Simon Kagstrom

We have encountered a CPU where the AES-NI instruction set is disabled due to export restrictions. Since the build machine and target machine is different, using -native configs doesn't work, and on this CPU, the application refuses to run due to the AES CPU flags being amiss.

The patch passes EXTRA_CFLAGS to the figure-out-cpu-flags helper, which allows us to add -mno-aes to the compile flags and resolve this problem.

---
ChangeLog:

v2:
* Put EXTRA_CFLAGS after MACHINE_CFLAGS to enable overriding values

 mk/rte.cpuflags.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mk/rte.cpuflags.mk +0 -0
index bec7bdd..4b30c6b 100644
@@ -33,7 +33,7 @@
 # used to set the RTE_CPUFLAG_* environment variables giving details
 # of what instruction sets the target cpu supports.
 
Quoted 6 lines

mk/rte.cpuflags.mk line 39

Quoted 6 lines
mk/rte.cpuflags.mk +1 -1
-AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) -dM -E - < /dev/null)
+AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(EXTRA_CFLAGS) -dM -E - < /dev/null)
 
 # adding flags to CPUFLAGS
 
#3 lore raw
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

We have encountered a CPU where the AES-NI instruction set is disabled due to export restrictions. Since the build machine and target machine is different, using -native configs doesn't work, and on this CPU, the application refuses to run due to the AES CPU flags being amiss.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

The patch passes EXTRA_CFLAGS to the figure-out-cpu-flags helper, which allows us to add -mno-aes to the compile flags and resolve this problem.

Applied, thanks

#4 lore raw
Quoted 9 lines · Thomas Monjalon
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

We have encountered a CPU where the AES-NI instruction set is disabled due to export restrictions. Since the build machine and target machine is different, using -native configs doesn't work, and on this CPU, the application refuses to run due to the AES CPU flags being amiss.

The patch passes EXTRA_CFLAGS to the figure-out-cpu-flags helper, which allows us to add -mno-aes to the compile flags and resolve this problem.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Applied, thanks

This causes some complications on Fedora/RHEL due to fairly complex interactions with -Werror, -Wall and -Wformat-security mixup between upstream- and distro default compiler flags.

More specifically, when EXTRA_CFLAGS contains warning flag manipulation this patch can cause mismatch between other options that are okay elsewhere in dpdk make. A simple fix is to pass WERROR_FLAGS to AUTO_CPUFLAGS too to counter this, ie

mk/rte.cpuflags.mk +1 -1
index c6bb8de..28f203b 100644
@@ -33,7 +33,7 @@
 # used to set the RTE_CPUFLAG_* environment variables giving details
 # of what instruction sets the target cpu supports.
 
-AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(EXTRA_CFLAGS) -dM -E - < /dev/null)
+AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(WERROR_FLAGS) $(EXTRA_CFLAGS) -dM -E - < /dev/null)
 
 # adding flags to CPUFLAGS
 

I can send an official patch if this seems acceptable.

- Panu -

#5 lore raw
Quoted 20 lines · Panu Matilainen
Quoted 8 lines · Thomas Monjalon
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

We have encountered a CPU where the AES-NI instruction set is disabled due to export restrictions. Since the build machine and target machine is different, using -native configs doesn't work, and on this CPU, the application refuses to run due to the AES CPU flags being amiss.

The patch passes EXTRA_CFLAGS to the figure-out-cpu-flags helper, which allows us to add -mno-aes to the compile flags and resolve this problem.

More specifically, when EXTRA_CFLAGS contains warning flag manipulation this patch can cause mismatch between other options that are okay elsewhere in dpdk make. A simple fix is to pass WERROR_FLAGS to AUTO_CPUFLAGS too to counter this, ie

mk/rte.cpuflags.mk +0 -0
index c6bb8de..28f203b 100644

mk/rte.cpuflags.mk line 37

Quoted 7 lines
mk/rte.cpuflags.mk +1 -2
@@ -33,7 +33,7 @@
 # used to set the RTE_CPUFLAG_* environment variables giving details
 # of what instruction sets the target cpu supports.
 
-AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(EXTRA_CFLAGS) -dM -E
- < /dev/null)
+AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(WERROR_FLAGS)
 $(EXTRA_CFLAGS) -dM -E - < /dev/null)

Looks fine to me at least.

// Simon

#6 lore raw
In reply to Panu Matilainen

2015-12-07 10:33, Panu Matilainen:

Quoted 42 lines · Thomas Monjalon
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

We have encountered a CPU where the AES-NI instruction set is disabled due to export restrictions. Since the build machine and target machine is different, using -native configs doesn't work, and on this CPU, the application refuses to run due to the AES CPU flags being amiss.

The patch passes EXTRA_CFLAGS to the figure-out-cpu-flags helper, which allows us to add -mno-aes to the compile flags and resolve this problem.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Applied, thanks

This causes some complications on Fedora/RHEL due to fairly complex interactions with -Werror, -Wall and -Wformat-security mixup between upstream- and distro default compiler flags.

More specifically, when EXTRA_CFLAGS contains warning flag manipulation this patch can cause mismatch between other options that are okay elsewhere in dpdk make. A simple fix is to pass WERROR_FLAGS to AUTO_CPUFLAGS too to counter this, ie

mk/rte.cpuflags.mk +1 -2
index c6bb8de..28f203b 100644
@@ -33,7 +33,7 @@
  # used to set the RTE_CPUFLAG_* environment variables giving details
  # of what instruction sets the target cpu supports.
 
-AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(EXTRA_CFLAGS) -dM -E 
- < /dev/null)
+AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(WERROR_FLAGS) 
 $(EXTRA_CFLAGS) -dM -E - < /dev/null)
 
  # adding flags to CPUFLAGS
Quoted 1 line

I can send an official patch if this seems acceptable.

Yes this is acceptable.
Please explain the error you see in the commit message.