From patchwork Sun Jan 24 00:11:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1430844 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=wmp79BYy; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DNYMr6N31z9sWR for ; Sun, 24 Jan 2021 11:12:07 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 926663892453; Sun, 24 Jan 2021 00:12:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 926663892453 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1611447124; bh=geP9awc2pZB7vDUQqsOzslTXaMV4q4JA8VhS9wbR7RI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=wmp79BYye1+vjz5wJKwpyUAX4SFyV0kkHWUwB/hI96ig07e3GKFgwgWaozyGgZGRa tMRxM0P3PaVzK+Zi2D61tI8Q4+kXWF4HlLILc8dsUXcKh8OgkRQ/FijiC/dTmR42Q5 xtSz06VV1Isxc5MkVBZtgHQHIfrS228K7+VToaWk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by sourceware.org (Postfix) with ESMTPS id 2D2B7384A018 for ; Sun, 24 Jan 2021 00:12:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2D2B7384A018 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4DNYMf5F71zQlQw; Sun, 24 Jan 2021 01:11:58 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id wrV3H9esDHAh; Sun, 24 Jan 2021 01:11:55 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [committed] libphobos: Fix executables segfault on mipsel architecture Date: Sun, 24 Jan 2021 01:11:40 +0100 Message-Id: <20210124001141.1005325-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-MBO-SPAM-Probability: ****** X-Rspamd-Score: 8.14 / 15.00 / 15.00 X-Rspamd-Queue-Id: C0B5B17CC X-Rspamd-UID: 22e490 X-Spam-Status: No, score=-16.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch fixes an issue running programs linked to the shared libphobos library on MIPS. The dynamic section on MIPS is read-only, but this was not properly handled in the runtime library. Bootstrapped and regression tested on mipsel-linux-gnu, and committed to mainline with backports to the releases/gcc-10 and gcc-9 branches. Regards Iain --- libphobos/ChangeLog: PR d/98806 * libdruntime/gcc/sections/elf_shared.d (MIPS_Any): Declare version for MIPS32 and MIPS64. (getDependencies): Adjust dlpi_addr on MIPS_Any. --- libphobos/libdruntime/gcc/sections/elf_shared.d | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d index 9050413b261..427759a4f94 100644 --- a/libphobos/libdruntime/gcc/sections/elf_shared.d +++ b/libphobos/libdruntime/gcc/sections/elf_shared.d @@ -22,6 +22,8 @@ module gcc.sections.elf_shared; +version (MIPS32) version = MIPS_Any; +version (MIPS64) version = MIPS_Any; version (RISCV32) version = RISCV_Any; version (RISCV64) version = RISCV_Any; version (S390) version = IBMZ_Any; @@ -763,6 +765,8 @@ version (Shared) // in glibc: #define DL_RO_DYN_SECTION 1 version (RISCV_Any) strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate + else version (MIPS_Any) + strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate else strtab = cast(const(char)*)dyn.d_un.d_ptr; }