From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 6D2EC3858402 for ; Thu, 9 Dec 2021 14:59:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6D2EC3858402 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-109-lQdfmFTWMe24-XCwJyPHuA-1; Thu, 09 Dec 2021 09:59:47 -0500 X-MC-Unique: lQdfmFTWMe24-XCwJyPHuA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A6C221015DA6; Thu, 9 Dec 2021 14:59:46 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1ADF35BE0B; Thu, 9 Dec 2021 14:59:45 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 1B9Exfct1547846 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 9 Dec 2021 15:59:42 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 1B9ExeUC1547845; Thu, 9 Dec 2021 15:59:40 +0100 Date: Thu, 9 Dec 2021 15:59:40 +0100 From: Jakub Jelinek To: Iain Sandoe Cc: Richard Biener , Jeff Law , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] pch: Add support for relocation of the PCH data [PR71934] Message-ID: <20211209145940.GI2646553@tucnak> Reply-To: Jakub Jelinek References: <20211207095507.GV2646553@tucnak> <20211207145007.GX2646553@tucnak> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Thu, 09 Dec 2021 14:59:51 -0000 On Wed, Dec 08, 2021 at 08:00:03AM +0000, Iain Sandoe wrote: > > On 7 Dec 2021, at 14:50, Jakub Jelinek via Gcc-patches wrote: > The attached patch should be applied before (or merged with) the change for > relocation when it is applied - since the operation of the PCH hooks needs some > adjustment on Darwin. Oops, didn't do this change and therefore likely broke Darwin and apparently HP-UX. Went through other targets and they don't do this reading in there and so aren't problematic. Of course, as I said before, to enable relocation support one has to do minor changes to the hook not to fail on those but update the reference parameter. I've committed following which should hopefully unbreak it (untested), please go ahead with your patch without the last hunk incrementally when you're ready. 2021-12-09 Jakub Jelinek PR pch/71934 * config/host-darwin.c (darwin_gt_pch_use_address): When reading manually the file into mapped area, update mapped_addr as an automatic variable rather than addr which is a reference parameter. * config/host-hpux.c (hpux_gt_pch_use_address): When reading manually the file into mapped area, update addr as an automatic variable rather than base which is a reference parameter. --- gcc/config/host-darwin.c.jj 2021-12-09 15:40:06.232022601 +0100 +++ gcc/config/host-darwin.c 2021-12-09 15:48:51.397467287 +0100 @@ -185,10 +185,10 @@ darwin_gt_pch_use_address (void *&addr, { ssize_t nbytes; - nbytes = read (fd, addr, MIN (sz, (size_t) -1 >> 1)); + nbytes = read (fd, mapped_addr, MIN (sz, (size_t) -1 >> 1)); if (nbytes <= 0) return -1; - addr = (char *) addr + nbytes; + mapped_addr = (char *) mapped_addr + nbytes; sz -= nbytes; } --- gcc/config/host-hpux.c.jj 2021-12-09 15:40:06.251022328 +0100 +++ gcc/config/host-hpux.c 2021-12-09 15:49:25.464977378 +0100 @@ -115,10 +115,10 @@ hpux_gt_pch_use_address (void *&base, si { ssize_t nbytes; - nbytes = read (fd, base, MIN (size, SSIZE_MAX)); + nbytes = read (fd, addr, MIN (size, SSIZE_MAX)); if (nbytes <= 0) return -1; - base = (char *) base + nbytes; + addr = (char *) addr + nbytes; size -= nbytes; } Jakub