From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13367 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Forney Newsgroups: gmane.linux.lib.musl.general Subject: Re: riscv port for review Date: Thu, 18 Oct 2018 14:52:53 -0700 Message-ID: References: <20180928022404.GQ17995@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1539899464 857 195.159.176.226 (18 Oct 2018 21:51:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 18 Oct 2018 21:51:04 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-13383-gllmg-musl=m.gmane.org@lists.openwall.com Thu Oct 18 23:51:00 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1gDGC4-00006B-83 for gllmg-musl@m.gmane.org; Thu, 18 Oct 2018 23:51:00 +0200 Original-Received: (qmail 17663 invoked by uid 550); 18 Oct 2018 21:53:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 17639 invoked from network); 18 Oct 2018 21:53:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mforney-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=DUFWI72t8oTTJjsFoNu7nIwtXkLJjA0sB7UCy8yCcZ0=; b=KcN8vFPcwu6bBsgawR7WIfyi9arJB8xZk+UQzGGEbW3eMi+1c2ViACwRyFRVbY8ndI Bl4o1RsPYW48arBwSU+/cibl1pcjd0rna9RavUIEtHXZSWvk9cYAVu9/5WfeUsSI4B5f DtBExcSLojBdTF1VBLaEtTul06PLaKYveL8nrxo7mDjSEFki9m4E7U17p5jCpeLVtSx5 jYy3vH3dlLA74e2W3mHzKt1v/WXIpUtvel5lavzmB5aiCm7YI0Rc1nB8XxHT/aBImu/m Cr9gAST5Jv2jrsLU/2Fw/oAh6qxusJnxk1Ysk1LnHM0as98Z3bDs7MKVF4WPdCA9DrAR M6DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=DUFWI72t8oTTJjsFoNu7nIwtXkLJjA0sB7UCy8yCcZ0=; b=Id7stMN7X9Uyb1SeosCJE3Bdkn6D3USPcC2ToMHqkHpTinMQ76bMGKw0094OYiXq7b yjgN71BMhLFGT6HHZIUAD8BAL+1rGZdNp52zY7aixtuDUSgFgS/9ZmWKCH7NpZpNbsoY e9Cx+BnL9LmC3OEdhN/oR82pJGZzT588Powknccn9W/Lx5OsCw6ON0QKX5P4az7UKMqW AbBoe+j3zIZQziDp8W0+o+X6QFe3bskY1cf22pZnwE595t/X9sifx2xJnAOU1IWQjUkj FaQjZyoJh9iNHHqWFXBdSpB2GOMetALtzpK0GTk3M+q2jumta5rUtE2qnnxT0nXojBX4 7Waw== X-Gm-Message-State: ABuFfoiirQha5cR6W/C15poCmM3kdhFAPrKH/VIFcKH8LNPdbjSrsAiz oLcRGPPMJ/XZqwqdrWB3DojuFshKnHohpSDt9repeYwFBkM= X-Google-Smtp-Source: ACcGV63CCX2ZqswAalRNSaOHGhcdC0Fk/Qi9wb5cCX6693RJW+sypM6TX2gUW5c0ScF6PS38oMnEIJmxDCo+/IukBr4= X-Received: by 2002:a9d:728a:: with SMTP id t10mr21878827otj.172.1539899575681; Thu, 18 Oct 2018 14:52:55 -0700 (PDT) X-Originating-IP: [2601:647:5180:35d7::56f7] In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:13367 Archived-At: On 2018-10-11, Michael Forney wrote: > On 2018-09-27, Rich Felker wrote: >> Pulled from here: >> https://github.com/riscv/riscv-musl/commit/6a4f4a9c774608add4b02f95322518bd2f5f51ee >> >> Attached for review. > > I noticed that some fcntl.h constants are incorrect (O_DIRECTORY, > O_NOFOLLOW, O_DIRECT, O_LARGEFILE, and O_TMPFILE). Linux doesn't seem > to have a riscv-specific fcntl.h, so I think they just come from > asm-generic. While playing around with a riscv32-linux-musl toolchain and tinyemu, I found a few more issues: - riscv linux has no renameat syscall. I think __NR_renameat needs to be removed from arch/riscv*/bits/syscall.h.in, and musl's rename and renameat need to fallback to SYS_renameat2 if SYS_renameat is not defined. - arch/riscv32/bits/syscall.h.in defines syscall names as if it were 64-bit. I think the following changes are necessary __NR_fcntl -> __NR_fcntl64 __NR_statfs -> __NR_statfs64 __NR_fstatfs -> __NR_fstatfs64 __NR_truncate -> __NR_truncate64 __NR_ftruncate -> __NR_ftruncate64 __NR_lseek -> __NR__llseek (and __NR_llseek?) __NR_fstatat -> __NR_fstatat64 __NR_fstat -> __NR_fstat64 __NR_mmap -> __NR_mmap2 __NR_fadvise64 -> __NR_fadvise64_64 - Since riscv32 uses fcntl64, and musl's struct flock corresponds to struct flock64 on 32-bit, F_GETLK, F_SETLK, and F_SETLKW should be defined to the corresponding *64 values (12, 13, 14). This matches arch/generic/bits/fcntl.h, so I think arch/riscv32/bits/fcntl.h should just be completely removed as Rich suggested. arch/riscv64/bits/fcntl.h needs to stay to define the non *64 values (5, 6, 7). - For detecting soft float, configure compares $ARCH to riscv and riscv64, but ARCH is set to riscv32 or riscv64 above. Also ARCH is set to riscv32 when $target is riscv* but not riscv64*. Should this be riscv32*? - There are several instances of preprocessor checks __riscv_soft_float, but this does not seem to be defined by gcc. Perhaps this is superseded by __riscv_flen or __riscv_float_abi_soft? - The functions in src/math/riscv* don't fall back to the C implementation for soft float.