From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 660733835549 for ; Sat, 17 Sep 2022 07:59:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 660733835549 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com Received: by mail-ej1-x62f.google.com with SMTP id sb3so24416815ejb.9 for ; Sat, 17 Sep 2022 00:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date; bh=9XyjfvtbP+OAomBvZ/sC9KhJny2JY/BO1CjiW41HBgI=; b=2MRCKB7TWqD5C7RZK9yc2HoZ1zlPcFQCB4PLr65LUKqkPWsDrWweEE8/mAOGW4R1K6 6iZe8+vGLpovrHE+Gi/COs9yPeAee2kZGI9SlrBNhxRBoTvb0fRSnX9sUHJEdkKAfDS2 USQVFTbrXl0RfCYr+pLb75y37LQYwm9JfHQCEh3HG/FQ0QYyiXhe8Z1GFIPv89wWPfv/ sW5pnmhUfiw3BYYAnJqmSBvY8pRf5dMWbUc69omiD71EgNAZF5x/zOIFTE20TlUTmrs5 JPDifCiRmp6UyVWKIE+ipv+dzsf5S4IchjY1R6iATLVOsbZ/SvqBOtkokeT2cm0/FCRY WJNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date; bh=9XyjfvtbP+OAomBvZ/sC9KhJny2JY/BO1CjiW41HBgI=; b=vnf068mo/7PChZ1O5Lo0LLO/i3dycY4iKMjl4kp83xphlzS9MxXnvpRD3iwOXIpMP0 GEXlSYGgHmVFo20tVHCScVRerd7k+rNyEU+QqwBIqNFXFhiUSjPoEM94qeR0+ECLUjLi v9tw9ODRRvvyQUqKh4d4xcTmjYO1CgoIHUzGNTL9ufcaoIFw8IBEIrPI47NCr2Db1tle CFNE4kvj/UDJrRDTcgClhqU2NY+Vzn/DaZmZyxx+ZyXCXtsBOuTZNK5rjqgUJsWdZSuj E+amApUWKOJk+44KDFWkpI0ijU5LX2saU44pI7GvrUd92SnUDkHyVCrNCo+dpBDwvXaW rWQg== X-Gm-Message-State: ACrzQf2M5+QWWb+Y2n9AfwUGw0vyglOAuVYI6LxPHwQ5t2CFLiGWE5Qp 7ePl81XoCMU54ad0rgMHHIi4Dw== X-Google-Smtp-Source: AMsMyM5zljTK+ndMsEQWuMVRr4GjHp0KdYX4X75ZLabjdF5vla1igW+OgbS4oVxOdelNGLAiNp/R2w== X-Received: by 2002:a17:906:8466:b0:77b:43e9:48b5 with SMTP id hx6-20020a170906846600b0077b43e948b5mr5960034ejc.254.1663401587929; Sat, 17 Sep 2022 00:59:47 -0700 (PDT) Received: from localhost (vpn-konference.ms.mff.cuni.cz. [195.113.20.101]) by smtp.gmail.com with ESMTPSA id j1-20020a170906094100b0076f1d939128sm9236039ejd.54.2022.09.17.00.59.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Sep 2022 00:59:45 -0700 (PDT) Date: Sat, 17 Sep 2022 00:59:45 -0700 (PDT) X-Google-Original-Date: Sat, 17 Sep 2022 00:22:51 PDT (-0700) Subject: Re: [PATCH v2] RISC-V: Allow long jumps to __syscall_error In-Reply-To: CC: l.stelmach@samsung.com, libc-alpha@sourceware.org, m.szyprowski@samsung.com, adhemerval.zanella@linaro.org, Alistair Francis , aurelien@aurel32.net, eggert@cs.ucla.edu, joseph@codesourcery.com, k.lewandowsk@samsung.com From: Palmer Dabbelt To: Andrew Waterman Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,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: On Fri, 16 Sep 2022 18:33:17 PDT (-0700), Andrew Waterman wrote: > Thank you for making my suggested change. LGTM. (I don't have commit > access, though.) I do have commit access, but I have spotty internet here and it looks like only the review has shown up in my local inbox so far. I'll commit it if this sorts itself out, but in case anyone else is faster Reviewed-by: Palmer Dabbelt Acked-by: Palmer Dabbelt Thanks! > > On Fri, Sep 16, 2022 at 12:32 PM Łukasz 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: Łukasz 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/linux/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/sysv/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/sysv/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/sysv/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/linux/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/linux/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 >>