DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Bruce Richardson <bruce.richardson@intel.com>,
	David Marchand <david.marchand@redhat.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH 1/3] buildtools: ignore exports for MSVC
Date: Tue, 12 Mar 2024 00:51:46 -0700	[thread overview]
Message-ID: <1710229908-31704-2-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1710229908-31704-1-git-send-email-roretzla@linux.microsoft.com>

Update map_to_def to allow exports to be ignored only when building with
MSVC. Some data variables need to be exported within code (not via .def)
file depending on their type so allow them to be ignored in the .map
file.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 buildtools/map_to_win.py | 13 +++++++++----
 lib/meson.build          |  4 ++--
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/buildtools/map_to_win.py b/buildtools/map_to_win.py
index aa1752c..2d547f8 100644
--- a/buildtools/map_to_win.py
+++ b/buildtools/map_to_win.py
@@ -4,9 +4,11 @@
 
 import sys
 
+def is_function_line(ln, cc):
+    if not ln.startswith('\t') or ":" in ln or ";" not in ln:
+        return False
 
-def is_function_line(ln):
-    return ln.startswith('\t') and ln.endswith(';\n') and ":" not in ln and "# WINDOWS_NO_EXPORT" not in ln
+    return not (cc == 'msvc' and "# MSVC_NO_EXPORT" in ln or "# WINDOWS_NO_EXPORT" in ln)
 
 # MinGW keeps the original .map file but replaces per_lcore* to __emutls_v.per_lcore*
 def create_mingw_map_file(input_map, output_map):
@@ -27,9 +29,12 @@ def main(args):
 # This works taking indented lines only which end with a ";" and which don't
 # have a colon in them, i.e. the lines defining functions only.
     else:
+        cc = 'notmsvc'
+        if len(args) == 4:
+            cc = args[3]
         with open(args[1]) as f_in:
-            functions = [ln[:-2] + '\n' for ln in sorted(f_in.readlines())
-                         if is_function_line(ln)]
+            functions = [ln.split(';', 1)[0] + '\n' for ln in sorted(f_in.readlines())
+                          if is_function_line(ln, cc)]
             functions = ["EXPORTS\n"] + functions
 
     with open(args[2], 'w') as f_out:
diff --git a/lib/meson.build b/lib/meson.build
index 179a272..f8836a4 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -262,7 +262,7 @@ foreach l:libraries
 
     if is_ms_linker
         def_file = custom_target(libname + '_def',
-                command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+                command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@', cc.get_id()],
                 input: version_map,
                 output: '@0@_exports.def'.format(libname))
         lk_deps += [def_file]
@@ -281,7 +281,7 @@ foreach l:libraries
     else
         if is_windows
             mingw_map = custom_target(libname + '_mingw',
-                    command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+                    command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@', cc.get_id()],
                     input: version_map,
                     output: '@0@_mingw.map'.format(libname))
             lk_deps += [mingw_map]
-- 
1.8.3.1


  reply	other threads:[~2024-03-12  7:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  7:51 [PATCH 0/3] RFC fix import/export MSVC data variables Tyler Retzlaff
2024-03-12  7:51 ` Tyler Retzlaff [this message]
2024-03-12  7:51 ` [PATCH 2/3] eal: import and export data variables for MSVC Tyler Retzlaff
2024-03-12  7:51 ` [PATCH 3/3] ethdev: " Tyler Retzlaff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1710229908-31704-2-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).