From patchwork Tue Jan 12 00:36:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 86351 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0645CA04B5; Tue, 12 Jan 2021 01:36:18 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F7B3140D37; Tue, 12 Jan 2021 01:36:18 +0100 (CET) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by mails.dpdk.org (Postfix) with ESMTP id 9CB38140D1E; Tue, 12 Jan 2021 01:36:17 +0100 (CET) Received: by mail-lf1-f45.google.com with SMTP id o19so769074lfo.1; Mon, 11 Jan 2021 16:36:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KAGOl9+RiOUznohHEzrKe9qM1ePwspNS9D9sMjcuBfw=; b=bUOzAxuk47CuNKGw5qJTYtH6LvneEBqrUlF72uF4T2GCo5BcEauzKAFnCz/2Bs1PgY 3kHGjuHQf2jGlsbQtgxoN68ZZDZagmQN7mDo+UA1DCMIopQjDiFDLTTdJZ6joU/iAMDV jhUvJO3YOO0Ok9OKcvVIAqLy2VOoW4HiF3UsQ3EWUp4dmZoNevYnO8Qorc3Q30FGlXpX oVMb3O4zOBNcnmbu0ICqBn+TX6v8ZghIZ7svxEqW3B6U/OkvXawNDU0jRh+6q00Cm8KH FlXIH37srPYwwUm4bNGAtDgPNV24MSwPSM6c/jH0NAWtSndHmu0FRiG66LdX7OBjU7U4 lfKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KAGOl9+RiOUznohHEzrKe9qM1ePwspNS9D9sMjcuBfw=; b=lacTQc24TJlh1pCpWRrJopP+CEyncGezRjqFb7QdhDSlBbYxe1EPXyveGkrv8M2vlY nFkffTTzAiXdPQLV1g2ExrxuYQ+5xKbJ0VBIccb8D70SoWooW4EH6QqkzStOAF4b7cRh MDhRDEngyt2u8+50RJIdvC6gnC9e3EDObCPL/h+NUHlj4yFmKeBjC2tHvR5DE0IXH9xA Uz+zo9s1qVXxR7IdFT7KZeFyyXeX4EbdhRT9TJI1I7FCWgvRm/aB6yYzluToAkkXrkJ7 nsZUd88s9T2qTRMc8/Pty3MBUP/3nhuRoJyoDg7Cugq/6r+igTQTE5RYHMX4g9qE26TN Fh9w== X-Gm-Message-State: AOAM531GJ+wgpvPKnlyuZIpkqwVSLk1mILSZFQ04MMuBpCAe7nxLM9Id pvWvJZk6y/lYr227GU7VKC4hDVmZvilsXg== X-Google-Smtp-Source: ABdhPJyjQBHl7e3/O+Wl/73klCJcgdtnXQUZSFYB+xkUQM2pqpXa1uh4XqGMgFDDd7zbH9avMjwEJw== X-Received: by 2002:ac2:569e:: with SMTP id 30mr887893lfr.297.1610411776902; Mon, 11 Jan 2021 16:36:16 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id i10sm168012lfd.202.2021.01.11.16.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 16:36:16 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Olivier Matz , Bruce Richardson , Dmitry Kozlyuk , stable@dpdk.org Date: Tue, 12 Jan 2021 03:36:02 +0300 Message-Id: <20210112003602.29004-1-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] build: fix using ELF-only linker flags with COFF 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 Sender: "dev" The --export-dynamic linker option is only applicable to ELF. On Windows, where COFF is used, it causes warnings: x86_64-w64-mingw32-ld: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols? (MinGW) LINK : warning LNK4044: unrecognized option '/-export-dynamic'; ignored (clang) Don't add --export-dynamic on Windows anywhere. Fixes: b031e13d7f0d ("build: fix plugin load on static build") Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk Acked-by: Ranjit Menon --- Using TLS variables with DLLs is problematic on Windows for now, so not attempting to check or solve the issue with plugin load. app/meson.build | 2 +- buildtools/pkg-config/meson.build | 6 +++++- examples/meson.build | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/meson.build b/app/meson.build index fd72d7da6..903117b86 100644 --- a/app/meson.build +++ b/app/meson.build @@ -26,7 +26,7 @@ lib_execinfo = cc.find_library('execinfo', required: false) default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API'] default_ldflags = [] -if get_option('default_library') == 'static' +if get_option('default_library') == 'static' and not is_windows default_ldflags += ['-Wl,--export-dynamic'] endif diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build index 168ee08e5..39a8fd1c8 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -37,6 +37,10 @@ Use libdpdk.pc instead of this file to query DPDK compile/link arguments''', libraries: ['-Wl,--as-needed'] + dpdk_libraries, libraries_private: dpdk_extra_ldflags) +platform_flags = [] +if not is_windows + platform_flags += ['-Wl,--export-dynamic'] # ELF only +endif pkg.generate(name: 'DPDK', # main DPDK pkgconfig file filebase: 'libdpdk', version: meson.project_version(), @@ -47,7 +51,7 @@ This is required for a number of static inline functions in the public headers.' # if libbsd is not enabled, then this is blank libraries_private: ['-Wl,--whole-archive'] + dpdk_drivers + dpdk_static_libraries + - ['-Wl,--no-whole-archive', '-Wl,--export-dynamic'] + ['-Wl,--no-whole-archive'] + platform_flags ) # For static linking with dependencies as shared libraries, diff --git a/examples/meson.build b/examples/meson.build index f643ec1ba..b9ab24223 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -64,7 +64,7 @@ if cc.has_argument('-Wno-format-truncation') default_cflags += '-Wno-format-truncation' endif default_ldflags = dpdk_extra_ldflags -if get_option('default_library') == 'static' +if get_option('default_library') == 'static' and not is_windows default_ldflags += ['-Wl,--export-dynamic'] endif