[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <51e1db37-3981-4ea5-9348-b6f6b31ecc8a@app.fastmail.com>
Date: Sun, 04 Jun 2023 11:24:39 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Zhangjin Wu" <falcon@...ylab.org>,
Thomas Weißschuh <thomas@...ch.de>
Cc: "Willy Tarreau" <w@....eu>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-kselftest <linux-kselftest@...r.kernel.org>,
linux-riscv <linux-riscv@...ts.infradead.org>
Subject: Re: [PATCH v3 11/12] selftests/nolibc: add new gettimeofday test cases
On Sun, Jun 4, 2023, at 10:29, 吴章金 wrote:
>
> Sorry for missing part of your feedbacks, I will check if -nostdlib
> stops the linking of libgcc_s or my own separated test script forgot
> linking the libgcc_s manually.
According to the gcc documentation, -nostdlib drops libgcc.a, but
adding -lgcc is the recommended way to bring it back.
> And as suggestion from Thomas' reply,
>
>>> Perhaps we really need to add the missing __divdi3 and __aeabi_ldivmod and the
>>> ones for the other architectures, or get one from lib/math/div64.c.
>
>>No, these ones come from the compiler via libgcc_s, we must not try to
> reimplement them. And we should do our best to avoid depending on them
> to avoid the error you got above.
>
> So, the explicit conversion is used instead in the patch.
I think a cast to a 32-bit type is ideal when converting the
clock_gettime() result into microseconds, since the kernel guarantees
that the timespec value is normalized, with all zeroes in the
upper 34 bits. Going through __aeabi_ldivmod would make the
conversion much slower.
For user supplied non-normalized timeval values, it's not obvious
whether we need the full 64-bit division
Arnd
Powered by blists - more mailing lists