buildtools: remove invalid option for Microsoft linker

Message ID 1741744388-2290-1-git-send-email-andremue@linux.microsoft.com (mailing list archive)
State Superseded
Delegated to: David Marchand
Headers
Series buildtools: remove invalid option for Microsoft linker |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing fail Unit Testing FAIL
ci/Intel-compilation success Compilation OK
ci/iol-marvell-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Andre Muezerie March 12, 2025, 1:53 a.m. UTC
When compiling "drivers" directory with MSVC the errors below popped up:

drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
    missing ')' before '('
drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')'
drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')'
drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
    missing ')' before 'const'
drivers/rte_mempool_stack.pmd.c(1): error C2091: function returns function

The fix is to use common macros compatible with MSVC.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 buildtools/pmdinfogen.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Bruce Richardson March 12, 2025, 10:29 a.m. UTC | #1
On Tue, Mar 11, 2025 at 06:53:08PM -0700, Andre Muezerie wrote:
> When compiling "drivers" directory with MSVC the errors below popped up:
> 
> drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
>     missing ')' before '('
> drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')'
> drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')'
> drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
>     missing ')' before 'const'
> drivers/rte_mempool_stack.pmd.c(1): error C2091: function returns function
> 
> The fix is to use common macros compatible with MSVC.
> 
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
David Marchand March 12, 2025, 11:53 a.m. UTC | #2
On Wed, Mar 12, 2025 at 2:53 AM Andre Muezerie
<andremue@linux.microsoft.com> wrote:
>
> When compiling "drivers" directory with MSVC the errors below popped up:
>
> drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
>     missing ')' before '('
> drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')'
> drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')'
> drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
>     missing ')' before 'const'
> drivers/rte_mempool_stack.pmd.c(1): error C2091: function returns function
>
> The fix is to use common macros compatible with MSVC.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>

Out of curiosity, did you try dpdk-pmdinfo.py on generated binaries?
  
Andre Muezerie March 12, 2025, 7:38 p.m. UTC | #3
On Wed, Mar 12, 2025 at 12:53:55PM +0100, David Marchand wrote:
> On Wed, Mar 12, 2025 at 2:53 AM Andre Muezerie
> <andremue@linux.microsoft.com> wrote:
> >
> > When compiling "drivers" directory with MSVC the errors below popped up:
> >
> > drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
> >     missing ')' before '('
> > drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')'
> > drivers/rte_mempool_stack.pmd.c(1): error C2059: syntax error: ')'
> > drivers/rte_mempool_stack.pmd.c(1): error C2143: syntax error:
> >     missing ')' before 'const'
> > drivers/rte_mempool_stack.pmd.c(1): error C2091: function returns function
> >
> > The fix is to use common macros compatible with MSVC.
> >
> > Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> 
> Out of curiosity, did you try dpdk-pmdinfo.py on generated binaries?

That script does not work on Windows. It depends on ldd and ELF binary
format to extract info from the binary. I'll see what can be done there.

> 
> 
> -- 
> David Marchand
  

Patch

diff --git a/buildtools/pmdinfogen.py b/buildtools/pmdinfogen.py
index dfb89500c0..116f05e7a8 100755
--- a/buildtools/pmdinfogen.py
+++ b/buildtools/pmdinfogen.py
@@ -192,7 +192,7 @@  def dump(self, file):
         dumped = json.dumps(self.__dict__)
         escaped = dumped.replace('"', '\\"')
         print(
-            'const char %s_pmd_info[] __attribute__((used)) = "PMD_INFO_STRING= %s";'
+            'const char %s_pmd_info[] __rte_used = "PMD_INFO_STRING= %s";'
             % (self.name, escaped),
             file=file,
         )
@@ -252,7 +252,8 @@  def open_output(path):
 
 def write_header(output):
     output.write(
-        "static __attribute__((unused)) const char *generator = \"%s\";\n" % sys.argv[0]
+        "#include <rte_common.h>\n"
+        "static __rte_unused const char *generator = \"%s\";\n" % sys.argv[0]
     )