From patchwork Thu Nov 23 10:29:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Storsjo X-Patchwork-Id: 119512 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp621054qgn; Thu, 23 Nov 2017 02:30:16 -0800 (PST) X-Google-Smtp-Source: AGs4zMYCkdzeyH8pV7SIQ3LcgUhcO84jCPnxnJYKpqMrgdAXY5OBohdfhj9VZgbU+ic39Fl+kWhP X-Received: by 10.101.70.196 with SMTP id n4mr2008718pgr.353.1511433016559; Thu, 23 Nov 2017 02:30:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511433016; cv=none; d=google.com; s=arc-20160816; b=gRowwLDtDP36u7aE47a+FPO1sZIzEbQf/X+XqXt1WzOo3OX+gkupfhr3B0lEcBiegT VlnY0usNA5rnQJ/6x98sNUD/OEUVfniMxesLYAyCIyXU8LGsp+DoGEKXoN0IvFJQmMif qvJFyUifVRAGPG4L1r+kpOtoF9dp/9eOPROvWKSQ7WjXJIQybwOab2+pHIGduWLu0KMq 8Mj0sT8ZUbAjmcHbKAYLybrviUPO+N3co90ikV4LSnqKfe6ZQYYJ8jdx13XseSKwCC5t lzHe8SOm87Zq4rN+gZaXw8dPDmdj4JVR6xPx9gsbXQOHFA/NHjLOo2i3uN/K8+xlHFVH WM5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:delivered-to:sender:list-help :list-post:list-archive:list-subscribe:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=yz8CQ6IkwWencanYWbLFjpGCOkDgl2dH/1yPWvO07sg=; b=x2SDW0TSXMAYqx3MO+3ys50639grW4JZbUQRKE3PS2s7M+pF5vu4l8tcyHq9Wy8ZEw /lxOAUbVAiyB3fbGRnXy0mpmGUGidGKc0fX+JFBy59TIsvF0MR4Cz9FD8Ept8DzK1QAq 2IjmKaF8yOXBS9DfITQrt5+71OHf5pSV/Mya1/7YvScSUsmHteumsClJOIfbMdLRli7d TH445lt2K/LU/M5xEHR+er6OkexND6POWOh5E/J/2DW7LIRYIjO3nEcHqH3iFWrkM99V 3mPEpDMs9PiPS8tEibd8jPCPxjTyZfeAlJY2C2HyOSsq830wiFK4VMYjygUA3YlFBhRD CVRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=v2FG9nLR; spf=pass (google.com: domain of binutils-return-99462-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-99462-patch=linaro.org@sourceware.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id r66si17225975pfi.217.2017.11.23.02.30.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 02:30:16 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-return-99462-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=v2FG9nLR; spf=pass (google.com: domain of binutils-return-99462-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-99462-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=VpQSYcUtIrHfctwh5syPkwplq7nT5yxq/3DvDg10pyFA/1+n9Op6R TuFfYa0zfbgJQfvf6/5iM6cUGvt893feTkoXb4oKbSlhSsLJsMfRJeeJSpKZZ9FM PTMiGzxh+xBfYotUSGFcRSAk9EusC45OXGBDkNG+S9Fn75LUZVVkYU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=JKWg6UxlcnQMSexY2KLY9r/Cqa0=; b=v2FG9nLRRZJ9DTGDfwttGJaWi2WT D1vvzfPG7gn3qX/clbicJGNf0GL9h8UhmIynJJ7Fqsaxc8JtZcTdhEs6C1EN6kfV XkbGeBXRBehFVjjypisBbAKQkDY+H7p18/lOrddDWynhduuDzjSH6nUETGRyhcaz jj60+xtvcXzcj0A= Received: (qmail 22072 invoked by alias); 23 Nov 2017 10:29:59 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 20288 invoked by uid 89); 23 Nov 2017 10:29:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=H*r:TLS1, libsupc, libgcj, (unknown) X-HELO: mail-lf0-f42.google.com Received: from mail-lf0-f42.google.com (HELO mail-lf0-f42.google.com) (209.85.215.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Nov 2017 10:29:57 +0000 Received: by mail-lf0-f42.google.com with SMTP id i14so21484203lfc.1 for ; Thu, 23 Nov 2017 02:29:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=yz8CQ6IkwWencanYWbLFjpGCOkDgl2dH/1yPWvO07sg=; b=MFa7CQv8B47dclfDb4asnzFIurIfC8f9kaiD62k0Su6A9UVil3pzr5cyWYnxQYgJfz yTg+moQlW0X+6zhShfrZwuyIIUDZgiLKLNTKAa8yfTb3G3eV+RIND+i7jfpCuK9f7PC8 P68esgIIESqZit5zZ++Rp+YCPJbXQcJ3V35wV53Jt7pofHbWZ0/59vtfhbDRdFIyUg8/ WDTWf7e60TbHwXWX0s/pfGVVzZeBjlocixmg37qsYlzXisEMy5IQSDENWHJPuLEcne9O q3UJegxd+7/hxbx/LiaTtQD/JC4Tqr9d+HQ2SXM0jc+CHZZVRpqBaxAKYv0Qchze5wG/ e8uQ== X-Gm-Message-State: AJaThX6KvXHWDpwZsu2yB9dXrYAdZT9sz6hx2hPeDJWq0DGHP08WCH7e C06wSl0vsf1UzabCQ46gMvYImwGs X-Received: by 10.25.161.132 with SMTP id k126mr3314732lfe.110.1511432994385; Thu, 23 Nov 2017 02:29:54 -0800 (PST) Received: from localhost (dsl-tkubng21-58c1cd-45.dhcp.inet.fi. [88.193.205.45]) by smtp.gmail.com with ESMTPSA id d27sm788378lfb.93.2017.11.23.02.29.53 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 23 Nov 2017 02:29:53 -0800 (PST) From: Martin Storsjo To: binutils@sourceware.org Subject: [PATCH] Exclude libmsvcrt and similar libraries from being autoexported from DLLs Date: Thu, 23 Nov 2017 12:29:53 +0200 Message-Id: <20171123102953.68132-1-martin@martin.st> X-IsSubscribed: yes In the latest git version of mingw-w64, one can set the default libmsvcrt.a to actually be the import library of another CRT version, to facilitate switching to ucrtbase.dll. In these versions, the traditional libmsvcrt.a (for linking to msvcrt.dll) is also provided with the name libmsvcrt-os.a. The import libraries for the CRT also contain a number of compatibility wrapper functions. The ones in libmsvcrt.a have so far been excluded automatically since they in most cases come with a corresponding __imp_foo function. None of these make sense to export automatically from a DLL though, so add these libraries to the exclude list. libucrtbase.a contains a number of compatibility wrapper functions that don't have a corresponding __imp_foo symbol, which cause these symbols to be exported from DLLs. This can be worked around on the mingw-w64 side by adding extra __imp_ symbols, but since they aren't strictly necessary for linking to succeed, it's probably better long-term to add these libraries to the exclusion list. ld/ChangeLog: 2017-11-23 Martin Storsjo * pe-dll.c: Exclude libmsvcrt, libmsvcrt-os and libucrtbase. --- ld/ChangeLog | 4 ++++ ld/pe-dll.c | 3 +++ 2 files changed, 7 insertions(+) -- 2.13.6 (Apple Git-96) diff --git a/ld/ChangeLog b/ld/ChangeLog index 4cfcf6d8ba..b4abe6e1e6 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2017-11-23 Martin Storsjo + + * pe-dll.c: Exclude libmsvcrt, libmsvcrt-os and libucrtbase. + 2017-11-21 Nick Clifton PR 22419 diff --git a/ld/pe-dll.c b/ld/pe-dll.c index aee7b9dacb..d916766ea0 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -344,6 +344,9 @@ static const autofilter_entry_type autofilter_liblist[] = { STRING_COMMA_LEN ("libsupc++") }, { STRING_COMMA_LEN ("libobjc") }, { STRING_COMMA_LEN ("libgcj") }, + { STRING_COMMA_LEN ("libmsvcrt") }, + { STRING_COMMA_LEN ("libmsvcrt-os") }, + { STRING_COMMA_LEN ("libucrtbase") }, { NULL, 0 } };