From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3915EA0551; Mon, 17 Feb 2020 07:27:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E00A858C4; Mon, 17 Feb 2020 07:27:21 +0100 (CET) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by dpdk.org (Postfix) with ESMTP id 63CAE2C4F for ; Mon, 17 Feb 2020 07:27:20 +0100 (CET) Received: by mail-lf1-f52.google.com with SMTP id f24so10968049lfh.3 for ; Sun, 16 Feb 2020 22:27:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TlBWt+4eB5FNmI3qz6JsK9ZReqywSAFG9/2/DMRzwzk=; b=dt3xaJl5VGGWK2SqhiT53N050Pbgsipmqou5h6B7/5kheCptG4FVaum53jKVwqFJsn niPS6WDvcXNNGUoJgxHa8TK20KbUCn88dd9DCwhisPL2IooIZDb9S6tVzk1XNKou/GUV mGaSY4wF4TNGvlnIwAhMhpqXsXogqyRJ0zxsIJ1r4ExnCgm2Uf/WCR+0uhMKa6p+C9cJ 7MJ/4oHek2iHqaUFXLVU5hru3oPTVOASgtK2VG+gS28Fr4IWcrOWinzDmr4XcIRwn0R2 zoqJR8KuRVGDjdE8I0fBIjd5flu2Owj2nExc13tpazwx37WtVo3CumOjFPndxzb0jeeL yfAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TlBWt+4eB5FNmI3qz6JsK9ZReqywSAFG9/2/DMRzwzk=; b=L27cWoSXGEalKWzd3fpZ8w/r/ILGkT+eT6imCBscB88wwp2pfG9JuugaKlK4F1Hw1D o+NU/23TMRUtF0oyrRFQqmZUOSfwDOboAA6F/ozw4iTaouBh1v+L9jSWxQcWzL7FUXO5 ajRl3BU361ArVsfJsTtC+wMJe/iofA8t9K4VfVWZjGROne1saPzlWURzfeV08FDx40Eo RRp1zezCw0GdWSyMMKDQYCkH3Hv/uZcEWBZqWYZLh08rl+oFZQigpV2uhzYruFxSf/AG 8b2Jw22e5znDBxShqPvShtwM+TRbHDfQPdQGJ5uYAY75DCHVgqh1v0nXSKqNPDTII54F lnvA== X-Gm-Message-State: APjAAAXeIbLzFXDkYU/GI1dzJaE17NxwZnYZ6Tl84E+qE244VdzeZ+RX Xt/gAPczZsWy9M6FMhL35DQ= X-Google-Smtp-Source: APXvYqyJoeoe/+APYPPMAtqVNPLwctc+oXg7iqUW1UJRDaWmXcaqKk0BETMwfv+Nq2dpbrp1p+mrAw== X-Received: by 2002:ac2:5626:: with SMTP id b6mr7330679lff.134.1581920839918; Sun, 16 Feb 2020 22:27:19 -0800 (PST) Received: from Sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id m3sm6826161lfl.97.2020.02.16.22.27.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2020 22:27:19 -0800 (PST) Date: Mon, 17 Feb 2020 09:27:18 +0300 From: Dmitry Kozlyuk To: Thomas Monjalon Cc: dev@dpdk.org, Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon , John McNamara , Marko Kovacevic , Tal Shnaiderman , Jeremy Plsek Message-ID: <20200217092718.3c4def72@Sovereign> In-Reply-To: <20200210003937.7dcdcc82@Sovereign> References: <20200131030744.19596-1-dmitry.kozliuk@gmail.com> <2467193.BddDVKsqQX@xps> <20200205025728.4562e90b@Sovereign> <3267218.V25eIC5XRa@xps> <20200210003937.7dcdcc82@Sovereign> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 6/6] doc: guide for Windows build using MinGW-w64 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" > Remembered another issue: thread-local storage (TLS) with shared libraries. > Windows PE doesn't support TLS via special sections, so compilers use TLS > emulation layer. With static libraries, there are no issues described below. > > The first aspect is a build-time issue of MinGW. When linking to DPDK shared > libraries, errors occur: > > undefined reference to `__emutls_v.per_lcore__rte_errno' > undefined reference to `__emutls_v.per_lcore__rte_lcore_id' > > DPDK declares per_lcore__XXX in a map file, but GCC places __thread symbols > in __emutls_v section, so the proper name to export becomes __emutls_v.XXX. > This can be worked around by using an additional version script with MinGW, > as I do in my port [0], however, the proper solution would be fixing the bug > on MinGW side [1]. MinGW already converts TLS variable names when generating > DEF files with `-Wl,--output-def` option (not used by DPDK, just a hint). Did some research and AFAICT, there is not effortless solution for efficient per-lcore variables on Windows. While MinGW-w64 has aforementioned issues (actually, GCC on Windows does), Clang with default TLS options just generates wrong results when exporting variables from dynamic libraries. Demo: https://github.com/PlushBeaver/tlstest Thread [0] claims this is a fundamental problem with PE-COFF executable format, but I honestly lack expertise to tell if this is valid. Microsoft docs [1] suggests that exporting __thread variables won't just work. Can someone from Microsoft or from UNH Lab comment further? [0]: https://sourceforge.net/p/mingw-w64/mailman/message/31777672/ [1]: https://docs.microsoft.com/en-us/windows/win32/dlls/using-thread-local-storage-in-a-dynamic-link-library -- Dmitry Kozlyuk