From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id C76123870895 for ; Fri, 28 Aug 2020 09:44:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C76123870895 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-283-1mhbC50YNdGAe17W2aHGNg-1; Fri, 28 Aug 2020 05:44:48 -0400 X-MC-Unique: 1mhbC50YNdGAe17W2aHGNg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 65FDF10066FB for ; Fri, 28 Aug 2020 09:44:47 +0000 (UTC) Received: from fziglio.remote.csb (unknown [10.33.32.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7088A5D9F1; Fri, 28 Aug 2020 09:44:46 +0000 (UTC) From: fziglio@redhat.com To: binutils@sourceware.org Cc: Frediano Ziglio Subject: [PATCH] Do not use DLL entry point for executables Date: Fri, 28 Aug 2020 10:44:42 +0100 Message-Id: <20200828094442.73277-1-fziglio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 09:44:53 -0000 From: Frediano Ziglio bfd_link_pic check for dll or pie type. If the type is pie the results should be an executable which entry point should be an executable entry point, not a DLL one. Signed-off-by: Frediano Ziglio --- ld/emultempl/pe.em | 2 +- ld/emultempl/pep.em | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 9d2097f486..8b44d65c1d 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -571,7 +571,7 @@ set_entry_point (void) /* Entry point name for arbitrary subsystem numbers. */ static const char default_entry[] = "mainCRTStartup"; - if (bfd_link_pic (&link_info) || dll) + if (bfd_link_dll (&link_info) || dll) { #if defined (TARGET_IS_i386pe) entry = "DllMainCRTStartup@12"; diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index 7d9395168d..4cf38428d8 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -537,7 +537,7 @@ set_entry_point (void) /* Entry point name for arbitrary subsystem numbers. */ static const char default_entry[] = "mainCRTStartup"; - if (bfd_link_pic (&link_info) || dll) + if (bfd_link_dll (&link_info) || dll) { entry = "DllMainCRTStartup"; } -- 2.25.4