mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: 翟小娟 <zhaixiaojuan@loongson.cn>
Cc: musl@lists.openwall.com
Subject: Re: Re: [musl] add loongarch64 port v7.
Date: Sat, 12 Aug 2023 21:41:10 -0400	[thread overview]
Message-ID: <20230813014109.GU4163@brightrain.aerifal.cx> (raw)
In-Reply-To: <20230805154307.GS4163@brightrain.aerifal.cx>

On Sat, Aug 05, 2023 at 11:43:08AM -0400, Rich Felker wrote:
> On Sat, Aug 05, 2023 at 02:18:35PM +0800, 翟小娟 wrote:
> > We are currently working on bringing loongarch support to the alpine
> > community. Alpine depends on musl, and Alpine and its users are
> > waiting for musl to support loongarch. This patch seems to be a long
> > time ago, we hope to know the review status of this patch.
> 
> Last time I set out to look at it, I hit that the exact patch I had
> previously reviewed and tentatively okayed wasn't stored anywhere
> permanent. I realize this has taken quite a while, and now there is a
> patch on the list, so this coming week I will go back and review the
> diff of that against the previous posted version and mailing list
> comments. As long as everything matches up, I expect to commit it.
> 
> Thanks for checking back in on this, and sorry it's taken so long.

OK, I'm looking at this now as the diffs between v5 and v6 (which I
theoretically reviewed before, but the exact v6 I looked at did not
exist in permanent form) and between v6 and v7.

v5->v6:

> -+#define __BYTE_ORDER 1234
> ++#define __BYTE_ORDER  __LITTLE_ENDIAN

This is gratuitous, mismatches what is done on other archs, and is
less safe.

> -+TYPEDEF unsigned nlink_t;
> ++TYPEDEF unsigned int nlink_t;

Gratuitous and in opposite direction of coding style used elsewhere in
musl. There are a few other instances of this too.

> -+      register uintptr_t tp __asm__("tp");
> -+      __asm__ ("" : "=r" (tp) );
> ++      uintptr_t tp;
> ++      __asm__ __volatile__("move %0, $tp" : "=r"(tp));
>  +      return tp;

Not clear what the motivation is here. Is it working around a compiler
bug? The original form was more optimal.

>  +#define CRTJMP(pc,sp) __asm__ __volatile__( \
> -+      "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
> -+
> -+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
> -+      ".hidden " #sym "\n" \
> -+      ".align 8 \n" \
> -+      "       la.local $t1, "#sym" \n" \
> -+      "       move %0, $t1 \n" \
> -+      : "=r"(*(fp)) : : "memory" )
> ++      "move $sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )

Not clear why this was changed. It was never discussed afaik. It looks
somewhat dubious removing GETFUNCSYM and using the maybe-unreliable
default definition.

It also looks like v5->v6 rewrote sigsetjmp.

v6->v7:

sigcontext/mcontext_t change mostly makes sense, but the
namespace-safe and full mcontext_t differ in their use of the aligned
attribute and it's not clear that the attribute is needed (since the
offset is naturally aligned and any instance of the object is produced
by the kernel, not by userspace).

> -+      long               __uc_pad;

This change to ucontext_t actually makes the struct ABI-incompatible
in the namespace-safe version without the alignment attribute. IIRC I
explicitly requested the explicit padding field to avoid this kind of
footgun. Removing it does not seem like a good idea.

In stat.h:

> -+      unsigned long __pad;
> ++      unsigned long __pad1;

This is gratuitous and makes the definition gratuitously mismatch what
will become the "generic" version of bits/stat.h. There is no contract
for applications to be able to access these padding fields by name, so
no motivation to make their names match glibc's names or the kernel's.

In fenv.S:

> ++#ifdef __clang__
> ++#define FCSR $fcsr0
> ++#else
> ++#define FCSR $r0
> ++#endif

It's not clear to me what's going on here. Is there a clang
incompatibility in the assembler language you're working around? Or
what? If so that seems like a tooling bug that should be fixed.

Otherwise, everything looks as expected, I think. I'm okay with making
any fixups for merging rather than throwing this back on your team for
more revisions, but can you please follow up and clarify the above?

Rich

  reply	other threads:[~2023-08-13  1:41 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  1:28 王洪亮
2023-04-18  9:38 ` Szabolcs Nagy
2023-04-18 10:47   ` Szabolcs Nagy
2023-04-18 11:32   ` 王洪亮
2023-05-10  3:36     ` 王洪亮
2023-06-01 12:44       ` wanghongliang
2023-06-25  3:43         ` Hongliang Wang
2023-07-19  6:55           ` Hongliang Wang
2023-08-05  6:18             ` 翟小娟
2023-08-05 15:43               ` Rich Felker
2023-08-13  1:41                 ` Rich Felker [this message]
2023-08-15  9:24                   ` Hongliang Wang
2023-08-15  9:32                     ` alice
2023-08-25  9:27                     ` 翟小娟
     [not found]                   ` <99d954ca-faee-2cac-97af-7fc2ecdb9a89@loongson.cn>
2023-09-20  7:45                     ` Jianmin Lv
2023-09-20 13:16                       ` Szabolcs Nagy
2023-09-22  1:37                         ` Hongliang Wang
2023-09-26  3:28                           ` [musl] add loongarch64 port v8 Hongliang Wang
2023-10-08  3:05                             ` 花静云
2023-11-09 13:15                             ` Jingyun Hua
2023-11-14 13:16                               ` Jingyun Hua
2023-11-16  2:54                                 ` [musl] add loongarch64 port v9 Hongliang Wang
2023-11-16 16:10                                   ` Rich Felker
2023-11-17  7:20                                     ` Hongliang Wang
2023-11-17 17:25                                       ` Rich Felker
2023-11-18  4:19                                         ` Jingyun Hua
2023-11-20  6:11                                           ` Hongliang Wang
2023-12-08  8:23                                             ` [musl] Re:[musl] add loongarch64 port v8 Hongliang Wang
2023-12-18  7:44                                               ` Jingyun Hua
2024-01-29  1:26                                               ` [musl] " Hongliang Wang
2024-01-29  3:14                                                 ` Rich Felker
2024-01-29  7:37                                                   ` Hongliang Wang
2023-11-16 16:44                                   ` [musl] add loongarch64 port v9 Szabolcs Nagy
2023-11-16 17:18                                     ` Szabolcs Nagy
2023-11-17  7:19                                       ` Hongliang Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230813014109.GU4163@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=zhaixiaojuan@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).