> On 9 Dec 2021, at 14:59, Jakub Jelinek <ja...@redhat.com> wrote:
> 
> 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 
>>> <gcc-patches@gcc.gnu.org> 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.

I was just retesting my patch on top of master - will merge the two.
thanks
Iain
> 
> 2021-12-09  Jakub Jelinek  <ja...@redhat.com>
> 
>       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
> 

Reply via email to