From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by sourceware.org (Postfix) with ESMTPS id 7F3E6385802D for ; Sat, 17 Sep 2022 01:33:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F3E6385802D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-qt1-x82d.google.com with SMTP id g12so16846245qts.1 for ; Fri, 16 Sep 2022 18:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=CaWK77L5gt9fqAeWL4+dM4BUVy+qEfX3TcWxn7moRU8=; b=X23rVJ3d9ewpTo3gfvANre5143JssUhbvxd1/sV76p+S9cRsYGAMFCq7hfo9gkF8+K n1K/LuZzmgehK+6a2IF0bTN2Bk+jbSFokT0s+wHIpviNisKgeRxm07nC5euyBhqgyD4I 4YItEEsDxB6pRV1KIDSyPWBRuzA0FvH6heNBvEPGMuirWSRz0RmOw3YoGn+DAioIImWK GairfJLgfzqamF8MejbMs3b+0b0Ok/HZBvL9nsAuypnGEC9v7xJGXPlL9AhF2Q5PqpyN GrFgFOtVzKVuMe7ZoWuqCWfvrFFcT0lGz2X7qHZkmuC+OBXVFiTdqrSpTRTBs+tx6mws fCQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=CaWK77L5gt9fqAeWL4+dM4BUVy+qEfX3TcWxn7moRU8=; b=ShdeN+tI0Pwb62VgPHulCrVNzW8P3OY7L2bBRN/Otrm98V0E/g9CmLtA/jR8aTJiyr Q/KXTxhp6L6C7SmPN2GyTsX0NZ61LhBBO9pnVRsERnq+SgS6kVWQXjqs8pDUahd1zzpi n/na7udikr4eFkV2MtKPis9l1R6tKOm1ZMA2i8ENVJrSJ0Pt6srngg6XJakYnSKZf/5Q 4i0s/U8i95WAqKnmZUK3XOHU5J5NQn5LfJqb2KDX6bP0ztbsmA0fpz97Kls86SHJM7je CJPLXitY9LBnP1UEqvMeogIq0/uVVhkRRoq6l9tdtSL3pexoYaH7ah9ovYOHlnu5zzHh +odA== X-Gm-Message-State: ACrzQf2ePlAL07smEAeUA3PFZ0YaZ8rQGJ3mh7zBYaG3gmdN2syvFyXe Yz/NUhlmAyIGzpXIJJD/ZpzBOzv+bzd9Zg== X-Google-Smtp-Source: AMsMyM4SsNUHSXmYZpJl91IIV/MEVbfW1Dld9auvJJjttXkhXDO5OoSWOORzyOcSwSOoD5K4vYyaCw== X-Received: by 2002:a05:622a:44:b0:35b:ae69:3a66 with SMTP id y4-20020a05622a004400b0035bae693a66mr6702930qtw.217.1663378409640; Fri, 16 Sep 2022 18:33:29 -0700 (PDT) Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com. [209.85.128.181]) by smtp.gmail.com with ESMTPSA id bk41-20020a05620a1a2900b006cdd0939ffbsm7127998qkb.86.2022.09.16.18.33.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Sep 2022 18:33:28 -0700 (PDT) Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-324ec5a9e97so279043507b3.7 for ; Fri, 16 Sep 2022 18:33:28 -0700 (PDT) X-Received: by 2002:a81:4687:0:b0:34b:e08f:2693 with SMTP id t129-20020a814687000000b0034be08f2693mr3019323ywa.56.1663378408396; Fri, 16 Sep 2022 18:33:28 -0700 (PDT) MIME-Version: 1.0 References: <20220916193127.1527992-1-l.stelmach@samsung.com> In-Reply-To: <20220916193127.1527992-1-l.stelmach@samsung.com> From: Andrew Waterman Date: Fri, 16 Sep 2022 18:33:17 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] RISC-V: Allow long jumps to __syscall_error To: =?UTF-8?Q?=C5=81ukasz_Stelmach?= Cc: libc-alpha@sourceware.org, Marek Szyprowski , adhemerval.zanella@linaro.org, alistair.francis@wdc.com, aurelien@aurel32.net, eggert@cs.ucla.edu, joseph@codesourcery.com, palmer@dabbelt.com, k.lewandowsk@samsung.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Thank you for making my suggested change. LGTM. (I don't have commit access, though.) On Fri, Sep 16, 2022 at 12:32 PM =C5=81ukasz Stelmach wrote: > > __syscall_error may end up farther than 1MiB away from a caller, > especially when linking statically large binaries. tail allows for > 4GiB jumps and is reduced to j when a linked symbol is within range. > > Fixes: 36960f0c76 ("RISC-V: Linux Syscall Interface") > Fixes: 7f33b09c65 ("RISC-V: Linux ABI") > Signed-off-by: =C5=81ukasz Stelmach > --- > Changes in v2: > - use tail instead of la+jr as advised by Andrew Waterman > > sysdeps/unix/sysv/linux/riscv/clone.S | 2 +- > sysdeps/unix/sysv/linux/riscv/getcontext.S | 2 +- > sysdeps/unix/sysv/linux/riscv/setcontext.S | 2 +- > sysdeps/unix/sysv/linux/riscv/swapcontext.S | 2 +- > sysdeps/unix/sysv/linux/riscv/sysdep.h | 2 +- > sysdeps/unix/sysv/linux/riscv/vfork.S | 2 +- > 6 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/riscv/clone.S b/sysdeps/unix/sysv/li= nux/riscv/clone.S > index d7d2915e87..45ea8f184b 100644 > --- a/sysdeps/unix/sysv/linux/riscv/clone.S > +++ b/sysdeps/unix/sysv/linux/riscv/clone.S > @@ -63,7 +63,7 @@ L (invalid): > li a0, -EINVAL > /* Something bad happened -- no child created. */ > L (error): > - j __syscall_error > + tail __syscall_error > END (__clone) > > /* Load up the arguments to the function. Put this block of code in > diff --git a/sysdeps/unix/sysv/linux/riscv/getcontext.S b/sysdeps/unix/sy= sv/linux/riscv/getcontext.S > index 499f70b65d..f4f828805c 100644 > --- a/sysdeps/unix/sysv/linux/riscv/getcontext.S > +++ b/sysdeps/unix/sysv/linux/riscv/getcontext.S > @@ -70,7 +70,7 @@ LEAF (__getcontext) > > ret > > -99: j __syscall_error > +99: tail __syscall_error > > PSEUDO_END (__getcontext) > > diff --git a/sysdeps/unix/sysv/linux/riscv/setcontext.S b/sysdeps/unix/sy= sv/linux/riscv/setcontext.S > index e3bc84a2e6..1e529b900c 100644 > --- a/sysdeps/unix/sysv/linux/riscv/setcontext.S > +++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S > @@ -92,7 +92,7 @@ LEAF (__setcontext) > > jr t1 > > -99: j __syscall_error > +99: tail __syscall_error > > END (__setcontext) > libc_hidden_def (__setcontext) > diff --git a/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/sysdeps/unix/s= ysv/linux/riscv/swapcontext.S > index 4da615f6d4..287ba364cd 100644 > --- a/sysdeps/unix/sysv/linux/riscv/swapcontext.S > +++ b/sysdeps/unix/sysv/linux/riscv/swapcontext.S > @@ -118,7 +118,7 @@ LEAF (__swapcontext) > jr t1 > > > -99: j __syscall_error > +99: tail __syscall_error > > PSEUDO_END (__swapcontext) > > diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/l= inux/riscv/sysdep.h > index 37ff07a0d7..aff8d857c9 100644 > --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h > +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h > @@ -102,7 +102,7 @@ > # else > # define SYSCALL_ERROR_HANDLER(name) \ > .Lsyscall_error ## name: \ > - j __syscall_error; > + tail __syscall_error; > # endif > > /* Performs a system call, not setting errno. */ > diff --git a/sysdeps/unix/sysv/linux/riscv/vfork.S b/sysdeps/unix/sysv/li= nux/riscv/vfork.S > index 0970543619..1482406e2d 100644 > --- a/sysdeps/unix/sysv/linux/riscv/vfork.S > +++ b/sysdeps/unix/sysv/linux/riscv/vfork.S > @@ -39,7 +39,7 @@ LEAF (__libc_vfork) > bltz a0, 1f > ret > > -1: j __syscall_error > +1: tail __syscall_error > END (__libc_vfork) > > weak_alias (__libc_vfork, vfork) > -- > 2.30.2 >