[dpdk-dev,v2] mk: pass EXTRA_CFLAGS to AUTO_CPUFLAGS to enable local modifications

Message ID 56654454.3040508@redhat.com (mailing list archive)
State RFC, archived
Headers

Commit Message

Panu Matilainen Dec. 7, 2015, 8:33 a.m. UTC
  On 12/04/2015 08:53 PM, Thomas Monjalon wrote:
>>>> 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.
>>>>
>>>> Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
>>
>> Acked-by: Olivier Matz <olivier.matz@6wind.com>
>
> 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



I can send an official patch if this seems acceptable.

	- Panu -
  

Comments

Simon Kagstrom Dec. 7, 2015, 11:47 a.m. UTC | #1
On 2015-12-07 09:33, Panu Matilainen wrote:
> On 12/04/2015 08:53 PM, Thomas Monjalon wrote:
>>>>> 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
> 
> diff --git a/mk/rte.cpuflags.mk b/mk/rte.cpuflags.mk
> index c6bb8de..28f203b 100644
> --- a/mk/rte.cpuflags.mk
> +++ b/mk/rte.cpuflags.mk
> @@ -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
  
Thomas Monjalon Dec. 7, 2015, 11:47 a.m. UTC | #2
2015-12-07 10:33, Panu Matilainen:
> On 12/04/2015 08:53 PM, Thomas Monjalon wrote:
> >>>> 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.
> >>>>
> >>>> Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
> >>
> >> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> >
> > 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
> 
> diff --git a/mk/rte.cpuflags.mk b/mk/rte.cpuflags.mk
> index c6bb8de..28f203b 100644
> --- a/mk/rte.cpuflags.mk
> +++ b/mk/rte.cpuflags.mk
> @@ -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.

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

Patch

diff --git a/mk/rte.cpuflags.mk b/mk/rte.cpuflags.mk
index c6bb8de..28f203b 100644
--- a/mk/rte.cpuflags.mk
+++ b/mk/rte.cpuflags.mk
@@ -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