From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E96A343C8E; Tue, 12 Mar 2024 08:52:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9DC940ED8; Tue, 12 Mar 2024 08:51:55 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EF4CD406FF for ; Tue, 12 Mar 2024 08:51:50 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id F119A20B74C2; Tue, 12 Mar 2024 00:51:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F119A20B74C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1710229909; bh=EEz+7CSOd3HphtmXyVgSHTpLhFaYtj6hShIpekQ4s+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ToRBtGHt3IvNspFGNnL0A71eOj57srw4gutsbQEn1lU2gtNJDY3XvKZ7ML6CKDRZF beBbdvFFN8+jzwVMgF9uneo1DMc3GNva2FnojLrGkvoq9J+FWNKkQfXTiYK4KvSZeZ pABxGPPImtU1Vfss+Jg2z6sjL/GtddPDdRBFDOLw= From: Tyler Retzlaff To: dev@dpdk.org Cc: Dmitry Kozlyuk , Thomas Monjalon , Bruce Richardson , David Marchand , Tyler Retzlaff Subject: [PATCH 1/3] buildtools: ignore exports for MSVC Date: Tue, 12 Mar 2024 00:51:46 -0700 Message-Id: <1710229908-31704-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1710229908-31704-1-git-send-email-roretzla@linux.microsoft.com> References: <1710229908-31704-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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