From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A8A5A1F5A0 for ; Sun, 5 Feb 2023 19:44:13 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gm40hWzw; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOkvZ-0006DD-3Q; Sun, 05 Feb 2023 14:43:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOkvX-0006Cv-Gn for bug-gnulib@gnu.org; Sun, 05 Feb 2023 14:43:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOkvW-0002aZ-2g for bug-gnulib@gnu.org; Sun, 05 Feb 2023 14:43:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675626227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HN19Gvn4HPE7ZB4nOnB1goExc1JIFBPMXBRlKs8cYFI=; b=gm40hWzwZ/eyUNOjnqiSdIJvUBoKa1g+mrYJvl8vbxDuHFWKZ1afsH4UnBjllnLKH52Pgv n/bYLQQHksPGzBrC8vtGmoYwItHBSsaIn8ptcLR/YxjJoYTyZNXZHwN0JPIQHjvJANPt8l h/UaJjyaMemcOAAFWxNxUDoBBFFy0jI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-111-_xyzVklHMae_MsvYps-ABA-1; Sun, 05 Feb 2023 14:43:46 -0500 X-MC-Unique: _xyzVklHMae_MsvYps-ABA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BC8C685CBE0 for ; Sun, 5 Feb 2023 19:43:45 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.192.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 98CF4400DFDB for ; Sun, 5 Feb 2023 19:43:45 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 2B2D3A80770; Sun, 5 Feb 2023 20:43:44 +0100 (CET) From: Corinna Vinschen To: bug-gnulib@gnu.org Subject: [PATCH] Do not decorate symbols as dllexport on Cygwin Date: Sun, 5 Feb 2023 20:43:44 +0100 Message-Id: <20230205194344.269174-1-vinschen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Received-SPF: pass client-ip=170.10.129.124; envelope-from=vinschen@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Note that dllimport/dllexport decorations are not at all required on Cygwin for quite some time. Worse, this breaks building DLLs and DLL import libs using libtool. On Cygwin --export-all-symbols is default. However, if just a single symbol is decorated with dllexport, ld switches to exporting only these symbols. So, when creating DLLs and DLL import libs which are also linked against libgnu.a, the result is that the actual DLL (i. e. cygfoo-1.dll) contains all symbols of all object files given on the command line. However, the DLL import lib (i. e. libfoo.dll.a) will contain only the default symbols and the single symbol gl_get_setlocale_null_lock. This in turn breaks linking against the just created cygfoo-1.dll. An example of that is current recode. Building this package with --enable-shared is broken, unless one adds -Wl,--export-all-symbols to the link stage command line explicitely, because of the decorated gl_get_setlocale_null_lock variable. Fix this by dropping the dllexport decoration when building for the Cygwin target. * lib/setlocale-lock.c: don't decorate gl_get_setlocale_null_lock as dllexport on Cygwin. * lib/setlocale_null.c: don't dllimport gl_get_setlocale_null_lock on Cygwin. --- lib/setlocale-lock.c | 2 +- lib/setlocale_null.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/setlocale-lock.c b/lib/setlocale-lock.c index b70ba09b0020..ab23cadd2939 100644 --- a/lib/setlocale-lock.c +++ b/lib/setlocale-lock.c @@ -41,7 +41,7 @@ typedef int dummy; # if HAVE_VISIBILITY /* Override the effect of the compiler option '-fvisibility=hidden'. */ # define DLL_EXPORTED __attribute__((__visibility__("default"))) -# elif defined _WIN32 || defined __CYGWIN__ +# elif defined _WIN32 && !defined __CYGWIN__ # define DLL_EXPORTED __declspec(dllexport) # else # define DLL_EXPORTED diff --git a/lib/setlocale_null.c b/lib/setlocale_null.c index 6ac563db14a9..5bf04a5ad84d 100644 --- a/lib/setlocale_null.c +++ b/lib/setlocale_null.c @@ -201,7 +201,7 @@ setlocale_null_with_lock (int category, char *buf, size_t bufsize) # elif HAVE_PTHREAD_API /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin */ extern -# if defined _WIN32 || defined __CYGWIN__ +# if defined _WIN32 && !defined __CYGWIN__ __declspec(dllimport) # endif pthread_mutex_t *gl_get_setlocale_null_lock (void); -- 2.39.1