* [GIT PULL] nolibc for 6.12-rc1
@ 2024-08-24 18:53 Thomas Weißschuh
2024-08-27 12:56 ` Shuah Khan
0 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2024-08-24 18:53 UTC (permalink / raw)
To: Shuah Khan; +Cc: Willy Tarreau, Paul E. McKenney, linux-kernel
Hi Shuah,
The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:
Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git nolibc-20240824-for-6.12-1
for you to fetch changes up to 25fb329a23c78d59a055a7b1329d18f30a2be92d:
tools/nolibc: x86_64: use local label in memcpy/memmove (2024-08-16 17:23:13 +0200)
----------------------------------------------------------------
nolibc changes for 6.12
Highlights
----------
* Clang support (including LTO)
Other Changes
-------------
* stdbool.h support
* argc/argv/envp arguments for constructors
* Small #include ordering fix
----------------------------------------------------------------
Thomas Weißschuh (21):
tools/nolibc: include arch.h from string.h
tools/nolibc: add stdbool.h header
tools/nolibc: pass argc, argv and envp to constructors
tools/nolibc: arm: use clang-compatible asm syntax
tools/nolibc: mips: load current function to $t9
tools/nolibc: powerpc: limit stack-protector workaround to GCC
tools/nolibc: compiler: introduce __nolibc_has_attribute()
tools/nolibc: move entrypoint specifics to compiler.h
tools/nolibc: compiler: use attribute((naked)) if available
selftests/nolibc: report failure if no testcase passed
selftests/nolibc: avoid passing NULL to printf("%s")
selftests/nolibc: determine $(srctree) first
selftests/nolibc: add support for LLVM= parameter
selftests/nolibc: add cc-option compatible with clang cross builds
selftests/nolibc: run-tests.sh: avoid overwriting CFLAGS_EXTRA
selftests/nolibc: don't use libgcc when building with clang
selftests/nolibc: use correct clang target for s390/systemz
selftests/nolibc: run-tests.sh: allow building through LLVM
tools/nolibc: crt: mark _start_c() as used
tools/nolibc: stackprotector: mark implicitly used symbols as used
tools/nolibc: x86_64: use local label in memcpy/memmove
tools/include/nolibc/Makefile | 1 +
tools/include/nolibc/arch-aarch64.h | 4 +--
tools/include/nolibc/arch-arm.h | 8 +++---
tools/include/nolibc/arch-i386.h | 4 +--
tools/include/nolibc/arch-loongarch.h | 4 +--
tools/include/nolibc/arch-mips.h | 8 ++++--
tools/include/nolibc/arch-powerpc.h | 6 ++--
tools/include/nolibc/arch-riscv.h | 4 +--
tools/include/nolibc/arch-s390.h | 4 +--
tools/include/nolibc/arch-x86_64.h | 8 +++---
tools/include/nolibc/compiler.h | 24 +++++++++++-----
tools/include/nolibc/crt.h | 25 +++++++++--------
tools/include/nolibc/nolibc.h | 3 +-
tools/include/nolibc/stackprotector.h | 4 +--
tools/include/nolibc/stdbool.h | 16 +++++++++++
tools/include/nolibc/string.h | 1 +
tools/testing/selftests/nolibc/Makefile | 41 +++++++++++++++++++---------
tools/testing/selftests/nolibc/nolibc-test.c | 9 +++---
tools/testing/selftests/nolibc/run-tests.sh | 16 ++++++++---
19 files changed, 123 insertions(+), 67 deletions(-)
create mode 100644 tools/include/nolibc/stdbool.h
Test results
------------
tools/testing/selftests/nolibc$ ./run-tests.sh
i386: 195 test(s): 195 passed, 0 skipped, 0 failed => status: success
x86_64: 195 test(s): 195 passed, 0 skipped, 0 failed => status: success
arm64: 195 test(s): 195 passed, 0 skipped, 0 failed => status: success
arm: 195 test(s): 195 passed, 0 skipped, 0 failed => status: success
mips32le: 195 test(s): 194 passed, 1 skipped, 0 failed => status: warning
mips32be: 195 test(s): 194 passed, 1 skipped, 0 failed => status: warning
ppc: 195 test(s): 195 passed, 0 skipped, 0 failed => status: success
ppc64: 195 test(s): 195 passed, 0 skipped, 0 failed => status: success
ppc64le: 195 test(s): 195 passed, 0 skipped, 0 failed => status: success
riscv: 195 test(s): 195 passed, 0 skipped, 0 failed => status: success
s390: 195 test(s): 194 passed, 1 skipped, 0 failed => status: warning
loongarch: 195 test(s): 194 passed, 1 skipped, 0 failed => status: warning
tools/testing/selftests/nolibc$ ./run-tests.sh -m user
i386: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
x86_64: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
arm64: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
arm: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
mips32le: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
mips32be: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
ppc: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
ppc64: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
ppc64le: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
riscv: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
s390: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
loongarch: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
tools/testing/selftests/nolibc$ ./run-tests.sh -m user -l
i386: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
x86_64: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
arm64: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
arm: 195 test(s): 193 passed, 2 skipped, 0 failed => status: warning
mips32le: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
mips32be: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
ppc: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
ppc64: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
ppc64le: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
riscv: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
s390: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
loongarch: 195 test(s): 192 passed, 3 skipped, 0 failed => status: warning
Thomas
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [GIT PULL] nolibc for 6.12-rc1
2024-08-24 18:53 [GIT PULL] nolibc for 6.12-rc1 Thomas Weißschuh
@ 2024-08-27 12:56 ` Shuah Khan
2024-09-04 21:04 ` Shuah Khan
0 siblings, 1 reply; 16+ messages in thread
From: Shuah Khan @ 2024-08-27 12:56 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Willy Tarreau, Paul E. McKenney, linux-kernel, Shuah Khan
On 8/24/24 12:53, Thomas Weißschuh wrote:
> Hi Shuah,
>
> The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:
>
> Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)
>
> are available in the Git repository at:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git nolibc-20240824-for-6.12-1
>
> for you to fetch changes up to 25fb329a23c78d59a055a7b1329d18f30a2be92d:
>
> tools/nolibc: x86_64: use local label in memcpy/memmove (2024-08-16 17:23:13 +0200)
>
> ----------------------------------------------------------------
> nolibc changes for 6.12
>
> Highlights
> ----------
>
> * Clang support (including LTO)
>
> Other Changes
> -------------
>
> * stdbool.h support
> * argc/argv/envp arguments for constructors
> * Small #include ordering fix
>
Thank you Thomas.
Pulled and pushed to linux-kselftest nolibc branch for Linux 6.12-rc1
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] nolibc for 6.12-rc1
2024-08-27 12:56 ` Shuah Khan
@ 2024-09-04 21:04 ` Shuah Khan
2024-09-04 21:13 ` Thomas Weißschuh
0 siblings, 1 reply; 16+ messages in thread
From: Shuah Khan @ 2024-09-04 21:04 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Willy Tarreau, Paul E. McKenney, linux-kernel, Shuah Khan
On 8/27/24 06:56, Shuah Khan wrote:
> On 8/24/24 12:53, Thomas Weißschuh wrote:
>> Hi Shuah,
>>
>> The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:
>>
>> Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)
>>
>> are available in the Git repository at:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git nolibc-20240824-for-6.12-1
>>
>> for you to fetch changes up to 25fb329a23c78d59a055a7b1329d18f30a2be92d:
>>
>> tools/nolibc: x86_64: use local label in memcpy/memmove (2024-08-16 17:23:13 +0200)
>>
>> ----------------------------------------------------------------
>> nolibc changes for 6.12
>>
>> Highlights
>> ----------
>>
>> * Clang support (including LTO)
>>
>> Other Changes
>> -------------
>>
>> * stdbool.h support
>> * argc/argv/envp arguments for constructors
>> * Small #include ordering fix
>>
>
> Thank you Thomas.
>
> Pulled and pushed to linux-kselftest nolibc branch for Linux 6.12-rc1
>
I am running sanity tests and getting this message:
$HOME/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
I tried setting TOOLCHAIN_BASE to the directory I installed gcc-13.2.0-nolibc
Something changed since the last time I did the pull request handling.
Any help is much appreciated.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-04 21:04 ` Shuah Khan
@ 2024-09-04 21:13 ` Thomas Weißschuh
2024-09-04 21:19 ` Shuah Khan
0 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2024-09-04 21:13 UTC (permalink / raw)
To: Shuah Khan; +Cc: Willy Tarreau, Paul E. McKenney, linux-kernel
On 2024-09-04 15:04:35+0000, Shuah Khan wrote:
> On 8/27/24 06:56, Shuah Khan wrote:
> > On 8/24/24 12:53, Thomas Weißschuh wrote:
> > > Hi Shuah,
> > >
> > > The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:
> > >
> > > Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)
> > >
> > > are available in the Git repository at:
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git nolibc-20240824-for-6.12-1
> > >
> > > for you to fetch changes up to 25fb329a23c78d59a055a7b1329d18f30a2be92d:
> > >
> > > tools/nolibc: x86_64: use local label in memcpy/memmove (2024-08-16 17:23:13 +0200)
> > >
> > > ----------------------------------------------------------------
> > > nolibc changes for 6.12
> > >
> > > Highlights
> > > ----------
> > >
> > > * Clang support (including LTO)
> > >
> > > Other Changes
> > > -------------
> > >
> > > * stdbool.h support
> > > * argc/argv/envp arguments for constructors
> > > * Small #include ordering fix
> > >
> >
> > Thank you Thomas.
> >
> > Pulled and pushed to linux-kselftest nolibc branch for Linux 6.12-rc1
> >
>
> I am running sanity tests and getting this message:
>
> $HOME/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
This indicates you are using 'run-tests.sh'.
Pass "-p" to let it download the toolchain automatically.
> I tried setting TOOLCHAIN_BASE to the directory I installed gcc-13.2.0-nolibc
Not sure where this variable comes from, but I have never seen it.
> Something changed since the last time I did the pull request handling.
In the test setup not much has changed.
Maybe you cleaned out your ~/.cache?
Or it's the first PR with run-tests.sh?
> Any help is much appreciated.
Hope this helped.
Thomas
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-04 21:13 ` Thomas Weißschuh
@ 2024-09-04 21:19 ` Shuah Khan
2024-09-05 3:08 ` Willy Tarreau
2024-09-05 5:59 ` Thomas Weißschuh
0 siblings, 2 replies; 16+ messages in thread
From: Shuah Khan @ 2024-09-04 21:19 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Willy Tarreau, Paul E. McKenney, linux-kernel, Shuah Khan
On 9/4/24 15:13, Thomas Weißschuh wrote:
> On 2024-09-04 15:04:35+0000, Shuah Khan wrote:
>> On 8/27/24 06:56, Shuah Khan wrote:
>>> On 8/24/24 12:53, Thomas Weißschuh wrote:
>>>> Hi Shuah,
>>>>
>>>> The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:
>>>>
>>>> Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)
>>>>
>>>> are available in the Git repository at:
>>>>
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git nolibc-20240824-for-6.12-1
>>>>
>>>> for you to fetch changes up to 25fb329a23c78d59a055a7b1329d18f30a2be92d:
>>>>
>>>> tools/nolibc: x86_64: use local label in memcpy/memmove (2024-08-16 17:23:13 +0200)
>>>>
>>>> ----------------------------------------------------------------
>>>> nolibc changes for 6.12
>>>>
>>>> Highlights
>>>> ----------
>>>>
>>>> * Clang support (including LTO)
>>>>
>>>> Other Changes
>>>> -------------
>>>>
>>>> * stdbool.h support
>>>> * argc/argv/envp arguments for constructors
>>>> * Small #include ordering fix
>>>>
>>>
>>> Thank you Thomas.
>>>
>>> Pulled and pushed to linux-kselftest nolibc branch for Linux 6.12-rc1
>>>
>>
>> I am running sanity tests and getting this message:
>>
>> $HOME/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
>
> This indicates you are using 'run-tests.sh'.
> Pass "-p" to let it download the toolchain automatically.
>
>> I tried setting TOOLCHAIN_BASE to the directory I installed gcc-13.2.0-nolibc
>
> Not sure where this variable comes from, but I have never seen it.
This is from the notes I got from Willy.
>
>> Something changed since the last time I did the pull request handling.
>
> In the test setup not much has changed.
> Maybe you cleaned out your ~/.cache?
Not intentionally ...
Guess I just have to do run download.sh again.
> Or it's the first PR with run-tests.sh?
I have been running the following successfully in the past:
From tools/testing/selftests/nolibc
make run
make run-user
./run-tests.sh -m user
./run-tests.sh -m system
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-04 21:19 ` Shuah Khan
@ 2024-09-05 3:08 ` Willy Tarreau
2024-09-05 5:59 ` Thomas Weißschuh
1 sibling, 0 replies; 16+ messages in thread
From: Willy Tarreau @ 2024-09-05 3:08 UTC (permalink / raw)
To: Shuah Khan; +Cc: Thomas Weißschuh, Paul E. McKenney, linux-kernel
On Wed, Sep 04, 2024 at 03:19:42PM -0600, Shuah Khan wrote:
> On 9/4/24 15:13, Thomas Weißschuh wrote:
> > On 2024-09-04 15:04:35+0000, Shuah Khan wrote:
> > > On 8/27/24 06:56, Shuah Khan wrote:
> > > > On 8/24/24 12:53, Thomas Weißschuh wrote:
> > > > > Hi Shuah,
> > > > >
> > > > > The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:
> > > > >
> > > > > Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)
> > > > >
> > > > > are available in the Git repository at:
> > > > >
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git nolibc-20240824-for-6.12-1
> > > > >
> > > > > for you to fetch changes up to 25fb329a23c78d59a055a7b1329d18f30a2be92d:
> > > > >
> > > > > tools/nolibc: x86_64: use local label in memcpy/memmove (2024-08-16 17:23:13 +0200)
> > > > >
> > > > > ----------------------------------------------------------------
> > > > > nolibc changes for 6.12
> > > > >
> > > > > Highlights
> > > > > ----------
> > > > >
> > > > > * Clang support (including LTO)
> > > > >
> > > > > Other Changes
> > > > > -------------
> > > > >
> > > > > * stdbool.h support
> > > > > * argc/argv/envp arguments for constructors
> > > > > * Small #include ordering fix
> > > > >
> > > >
> > > > Thank you Thomas.
> > > >
> > > > Pulled and pushed to linux-kselftest nolibc branch for Linux 6.12-rc1
> > > >
> > >
> > > I am running sanity tests and getting this message:
> > >
> > > $HOME/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
> >
> > This indicates you are using 'run-tests.sh'.
> > Pass "-p" to let it download the toolchain automatically.
Maybe it appends a "$CC" at the end that's not yet set anymore for some
reason, e.g. the change of includes.
> > > Something changed since the last time I did the pull request handling.
> >
> > In the test setup not much has changed.
> > Maybe you cleaned out your ~/.cache?
>
> Not intentionally ...
> Guess I just have to do run download.sh again.
>
> > Or it's the first PR with run-tests.sh?
>
> I have been running the following successfully in the past:
>
> From tools/testing/selftests/nolibc
> make run
> make run-user
>
> ./run-tests.sh -m user
> ./run-tests.sh -m system
At least it means we've broken some setups and we need to figure how,
and what to do to fix them :-/
Thanks Shuah for the report,
Willy
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-04 21:19 ` Shuah Khan
2024-09-05 3:08 ` Willy Tarreau
@ 2024-09-05 5:59 ` Thomas Weißschuh
2024-09-05 6:22 ` Willy Tarreau
1 sibling, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2024-09-05 5:59 UTC (permalink / raw)
To: Shuah Khan; +Cc: Willy Tarreau, Paul E. McKenney, linux-kernel
On 2024-09-04 15:19:42+0000, Shuah Khan wrote:
> On 9/4/24 15:13, Thomas Weißschuh wrote:
> > On 2024-09-04 15:04:35+0000, Shuah Khan wrote:
> > > On 8/27/24 06:56, Shuah Khan wrote:
> > > > On 8/24/24 12:53, Thomas Weißschuh wrote:
> > > > > Hi Shuah,
> > > > >
> > > > > The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:
> > > > >
> > > > > Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)
> > > > >
> > > > > are available in the Git repository at:
> > > > >
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git nolibc-20240824-for-6.12-1
> > > > >
> > > > > for you to fetch changes up to 25fb329a23c78d59a055a7b1329d18f30a2be92d:
> > > > >
> > > > > tools/nolibc: x86_64: use local label in memcpy/memmove (2024-08-16 17:23:13 +0200)
> > > > >
> > > > > ----------------------------------------------------------------
> > > > > nolibc changes for 6.12
> > > > >
> > > > > Highlights
> > > > > ----------
> > > > >
> > > > > * Clang support (including LTO)
> > > > >
> > > > > Other Changes
> > > > > -------------
> > > > >
> > > > > * stdbool.h support
> > > > > * argc/argv/envp arguments for constructors
> > > > > * Small #include ordering fix
> > > > >
> > > >
> > > > Thank you Thomas.
> > > >
> > > > Pulled and pushed to linux-kselftest nolibc branch for Linux 6.12-rc1
> > > >
> > >
> > > I am running sanity tests and getting this message:
> > >
> > > $HOME/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
> >
> > This indicates you are using 'run-tests.sh'.
> > Pass "-p" to let it download the toolchain automatically.
> >
> > > I tried setting TOOLCHAIN_BASE to the directory I installed gcc-13.2.0-nolibc
> >
> > Not sure where this variable comes from, but I have never seen it.
>
> This is from the notes I got from Willy.
Could you forward those to me?
> > > Something changed since the last time I did the pull request handling.
> >
> > In the test setup not much has changed.
> > Maybe you cleaned out your ~/.cache?
>
> Not intentionally ...
> Guess I just have to do run download.sh again.
I guess download.sh also comes from Willy?
> > Or it's the first PR with run-tests.sh?
>
> I have been running the following successfully in the past:
>
> From tools/testing/selftests/nolibc
> make run
> make run-user
>
> ./run-tests.sh -m user
> ./run-tests.sh -m system
Ack.
Could you provide a transcript of the commands you are running and their
outputs, including the failing command?
From the error it looks like run-tests.sh is the one failing, but that
script was written completely oblivious to download.sh and
TOOLCHAIN_BASE, so those probably won't help solving the issue.
The following command should automatically download the toolchains into
the location from the error message:
./run-tests.sh -p -m user
These toolchains can then also be used for direct "make" invocations
through CROSS_COMPILE.
As Willy said, thanks for the report!
Thomas
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-05 5:59 ` Thomas Weißschuh
@ 2024-09-05 6:22 ` Willy Tarreau
2024-09-05 6:32 ` Willy Tarreau
0 siblings, 1 reply; 16+ messages in thread
From: Willy Tarreau @ 2024-09-05 6:22 UTC (permalink / raw)
To: Thomas Weißschuh; +Cc: Shuah Khan, Paul E. McKenney, linux-kernel
Hi Thomas,
On Thu, Sep 05, 2024 at 07:59:13AM +0200, Thomas Weißschuh wrote:
> > > > I tried setting TOOLCHAIN_BASE to the directory I installed gcc-13.2.0-nolibc
> > >
> > > Not sure where this variable comes from, but I have never seen it.
> >
> > This is from the notes I got from Willy.
>
> Could you forward those to me?
I've finding this in the old "test-all-full4.sh" script that I shared
last year:
https://lore.kernel.org/all/ZNvIkD1oxZENVkoe@1wt.eu/
> > > > Something changed since the last time I did the pull request handling.
> > >
> > > In the test setup not much has changed.
> > > Maybe you cleaned out your ~/.cache?
> >
> > Not intentionally ...
> > Guess I just have to do run download.sh again.
>
> I guess download.sh also comes from Willy?
I was about to say no until I saw it in the mail above :-) I did
not remember about it.
> > > Or it's the first PR with run-tests.sh?
> >
> > I have been running the following successfully in the past:
> >
> > From tools/testing/selftests/nolibc
> > make run
> > make run-user
> >
> > ./run-tests.sh -m user
> > ./run-tests.sh -m system
>
> Ack.
>
> Could you provide a transcript of the commands you are running and their
> outputs, including the failing command?
> From the error it looks like run-tests.sh is the one failing, but that
> script was written completely oblivious to download.sh and
> TOOLCHAIN_BASE, so those probably won't help solving the issue.
>
> The following command should automatically download the toolchains into
> the location from the error message:
>
> ./run-tests.sh -p -m user
>
> These toolchains can then also be used for direct "make" invocations
> through CROSS_COMPILE.
I really suspect an empty CC variable somewhere that could explain why
only CROSS_COMPILE is used. I'll try to find time today to give it a
try here as well, just in case I can reproduce the same issue.
Thanks,
Willy
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-05 6:22 ` Willy Tarreau
@ 2024-09-05 6:32 ` Willy Tarreau
2024-09-05 15:57 ` Thomas Weißschuh
0 siblings, 1 reply; 16+ messages in thread
From: Willy Tarreau @ 2024-09-05 6:32 UTC (permalink / raw)
To: Thomas Weißschuh; +Cc: Shuah Khan, Paul E. McKenney, linux-kernel
On Thu, Sep 05, 2024 at 08:22:18AM +0200, Willy Tarreau wrote:
> >
> > ./run-tests.sh -p -m user
> >
> > These toolchains can then also be used for direct "make" invocations
> > through CROSS_COMPILE.
>
> I really suspect an empty CC variable somewhere that could explain why
> only CROSS_COMPILE is used. I'll try to find time today to give it a
> try here as well, just in case I can reproduce the same issue.
In fact I'm getting it without any options:
$ ./run-tests.sh
realpath: /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
It comes from here in test_arch():
cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
Thus it's indeed related to the absence of the toolchain there. It's
just that the way the error is reported (due to set -e) is a bit harsh.
What about this ?
$ ./run-tests.sh
No toolchain found in /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux.
Did you install the toolchains or set the correct arch ? Rerun with -h for help.
Aborting...
or anything similar, achieved by this patch (warning copy-paste, mangled
indents):
diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
index e7ecda4ae796..0f67e80051dc 100755
--- a/tools/testing/selftests/nolibc/run-tests.sh
+++ b/tools/testing/selftests/nolibc/run-tests.sh
@@ -143,6 +143,13 @@ test_arch() {
arch=$1
ct_arch=$(crosstool_arch "$arch")
ct_abi=$(crosstool_abi "$1")
+
+ if [ ! -d "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/." ]; then
+ echo "No toolchain found in ${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}."
+ echo "Did you install the toolchains or set the correct arch ? Rerun with -h for help."
+ return 1
+ fi
+
cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
build_dir="${build_location}/${arch}"
if [ "$werror" -ne 0 ]; then
Willy
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-05 6:32 ` Willy Tarreau
@ 2024-09-05 15:57 ` Thomas Weißschuh
2024-09-05 16:35 ` Willy Tarreau
0 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2024-09-05 15:57 UTC (permalink / raw)
To: Willy Tarreau; +Cc: Shuah Khan, Paul E. McKenney, linux-kernel
On 2024-09-05 08:32:14+0000, Willy Tarreau wrote:
> On Thu, Sep 05, 2024 at 08:22:18AM +0200, Willy Tarreau wrote:
> > >
> > > ./run-tests.sh -p -m user
> > >
> > > These toolchains can then also be used for direct "make" invocations
> > > through CROSS_COMPILE.
> >
> > I really suspect an empty CC variable somewhere that could explain why
> > only CROSS_COMPILE is used. I'll try to find time today to give it a
> > try here as well, just in case I can reproduce the same issue.
>
> In fact I'm getting it without any options:
>
> $ ./run-tests.sh
> realpath: /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
>
> It comes from here in test_arch():
>
> cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
>
> Thus it's indeed related to the absence of the toolchain there. It's
> just that the way the error is reported (due to set -e) is a bit harsh.
Ack. It should not occur with "-p" though.
> What about this ?
>
> $ ./run-tests.sh
> No toolchain found in /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux.
> Did you install the toolchains or set the correct arch ? Rerun with -h for help.
> Aborting...
>
> or anything similar, achieved by this patch (warning copy-paste, mangled
> indents):
>
> diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
> index e7ecda4ae796..0f67e80051dc 100755
> --- a/tools/testing/selftests/nolibc/run-tests.sh
> +++ b/tools/testing/selftests/nolibc/run-tests.sh
> @@ -143,6 +143,13 @@ test_arch() {
> arch=$1
> ct_arch=$(crosstool_arch "$arch")
> ct_abi=$(crosstool_abi "$1")
> +
> + if [ ! -d "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/." ]; then
> + echo "No toolchain found in ${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}."
> + echo "Did you install the toolchains or set the correct arch ? Rerun with -h for help."
> + return 1
> + fi
> +
> cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
> build_dir="${build_location}/${arch}"
> if [ "$werror" -ne 0 ]; then
Looks good.
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-05 15:57 ` Thomas Weißschuh
@ 2024-09-05 16:35 ` Willy Tarreau
2024-09-05 23:57 ` Shuah Khan
0 siblings, 1 reply; 16+ messages in thread
From: Willy Tarreau @ 2024-09-05 16:35 UTC (permalink / raw)
To: Thomas Weißschuh; +Cc: Shuah Khan, Paul E. McKenney, linux-kernel
On Thu, Sep 05, 2024 at 05:57:22PM +0200, Thomas Weißschuh wrote:
> On 2024-09-05 08:32:14+0000, Willy Tarreau wrote:
> > On Thu, Sep 05, 2024 at 08:22:18AM +0200, Willy Tarreau wrote:
> > > >
> > > > ./run-tests.sh -p -m user
> > > >
> > > > These toolchains can then also be used for direct "make" invocations
> > > > through CROSS_COMPILE.
> > >
> > > I really suspect an empty CC variable somewhere that could explain why
> > > only CROSS_COMPILE is used. I'll try to find time today to give it a
> > > try here as well, just in case I can reproduce the same issue.
> >
> > In fact I'm getting it without any options:
> >
> > $ ./run-tests.sh
> > realpath: /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
> >
> > It comes from here in test_arch():
> >
> > cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
> >
> > Thus it's indeed related to the absence of the toolchain there. It's
> > just that the way the error is reported (due to set -e) is a bit harsh.
>
> Ack. It should not occur with "-p" though.
Agreed, I was focusing on first experience for users essentially.
> > What about this ?
> >
> > $ ./run-tests.sh
> > No toolchain found in /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux.
> > Did you install the toolchains or set the correct arch ? Rerun with -h for help.
> > Aborting...
> >
> > or anything similar, achieved by this patch (warning copy-paste, mangled
> > indents):
> >
> > diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
> > index e7ecda4ae796..0f67e80051dc 100755
> > --- a/tools/testing/selftests/nolibc/run-tests.sh
> > +++ b/tools/testing/selftests/nolibc/run-tests.sh
> > @@ -143,6 +143,13 @@ test_arch() {
> > arch=$1
> > ct_arch=$(crosstool_arch "$arch")
> > ct_abi=$(crosstool_abi "$1")
> > +
> > + if [ ! -d "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/." ]; then
> > + echo "No toolchain found in ${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}."
> > + echo "Did you install the toolchains or set the correct arch ? Rerun with -h for help."
> > + return 1
> > + fi
> > +
> > cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
> > build_dir="${build_location}/${arch}"
> > if [ "$werror" -ne 0 ]; then
>
> Looks good.
OK thanks, I'll try to handle it this week-end if I'm not beaten to
it. If you or Shuah want to merge it before, feel free to, no offense
on my side!
Cheers,
Willy
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-05 16:35 ` Willy Tarreau
@ 2024-09-05 23:57 ` Shuah Khan
2024-09-08 10:22 ` Willy Tarreau
0 siblings, 1 reply; 16+ messages in thread
From: Shuah Khan @ 2024-09-05 23:57 UTC (permalink / raw)
To: Willy Tarreau, Thomas Weißschuh
Cc: Paul E. McKenney, linux-kernel, Shuah Khan
On 9/5/24 10:35, Willy Tarreau wrote:
> On Thu, Sep 05, 2024 at 05:57:22PM +0200, Thomas Weißschuh wrote:
>> On 2024-09-05 08:32:14+0000, Willy Tarreau wrote:
>>> On Thu, Sep 05, 2024 at 08:22:18AM +0200, Willy Tarreau wrote:
>>>>>
>>>>> ./run-tests.sh -p -m user
>>>>>
>>>>> These toolchains can then also be used for direct "make" invocations
>>>>> through CROSS_COMPILE.
>>>>
>>>> I really suspect an empty CC variable somewhere that could explain why
>>>> only CROSS_COMPILE is used. I'll try to find time today to give it a
>>>> try here as well, just in case I can reproduce the same issue.
>>>
>>> In fact I'm getting it without any options:
>>>
>>> $ ./run-tests.sh
>>> realpath: /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
>>>
>>> It comes from here in test_arch():
>>>
>>> cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
>>>
>>> Thus it's indeed related to the absence of the toolchain there. It's
>>> just that the way the error is reported (due to set -e) is a bit harsh.
>>
>> Ack. It should not occur with "-p" though.
>
> Agreed, I was focusing on first experience for users essentially.
>
>>> What about this ?
>>>
>>> $ ./run-tests.sh
>>> No toolchain found in /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux.
>>> Did you install the toolchains or set the correct arch ? Rerun with -h for help.
>>> Aborting...
>>>
>>> or anything similar, achieved by this patch (warning copy-paste, mangled
>>> indents):
>>>
>>> diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
>>> index e7ecda4ae796..0f67e80051dc 100755
>>> --- a/tools/testing/selftests/nolibc/run-tests.sh
>>> +++ b/tools/testing/selftests/nolibc/run-tests.sh
>>> @@ -143,6 +143,13 @@ test_arch() {
>>> arch=$1
>>> ct_arch=$(crosstool_arch "$arch")
>>> ct_abi=$(crosstool_abi "$1")
>>> +
>>> + if [ ! -d "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/." ]; then
>>> + echo "No toolchain found in ${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}."
>>> + echo "Did you install the toolchains or set the correct arch ? Rerun with -h for help."
>>> + return 1
>>> + fi
>>> +
>>> cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
>>> build_dir="${build_location}/${arch}"
>>> if [ "$werror" -ne 0 ]; then
>>
>> Looks good.
>
> OK thanks, I'll try to handle it this week-end if I'm not beaten to
> it. If you or Shuah want to merge it before, feel free to, no offense
> on my side!
>
Sounds good. My system is back to a good state with the tests after running
./run-tests.sh -p -m user
My guess is my setup was lost when I upgraded my system.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-05 23:57 ` Shuah Khan
@ 2024-09-08 10:22 ` Willy Tarreau
2024-09-09 17:50 ` Shuah Khan
0 siblings, 1 reply; 16+ messages in thread
From: Willy Tarreau @ 2024-09-08 10:22 UTC (permalink / raw)
To: Shuah Khan; +Cc: Thomas Weißschuh, Paul E. McKenney, linux-kernel
On Thu, Sep 05, 2024 at 05:57:52PM -0600, Shuah Khan wrote:
> On 9/5/24 10:35, Willy Tarreau wrote:
> > On Thu, Sep 05, 2024 at 05:57:22PM +0200, Thomas Weißschuh wrote:
> > > On 2024-09-05 08:32:14+0000, Willy Tarreau wrote:
> > > > On Thu, Sep 05, 2024 at 08:22:18AM +0200, Willy Tarreau wrote:
> > > > > >
> > > > > > ./run-tests.sh -p -m user
> > > > > >
> > > > > > These toolchains can then also be used for direct "make" invocations
> > > > > > through CROSS_COMPILE.
> > > > >
> > > > > I really suspect an empty CC variable somewhere that could explain why
> > > > > only CROSS_COMPILE is used. I'll try to find time today to give it a
> > > > > try here as well, just in case I can reproduce the same issue.
> > > >
> > > > In fact I'm getting it without any options:
> > > >
> > > > $ ./run-tests.sh
> > > > realpath: /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
> > > >
> > > > It comes from here in test_arch():
> > > >
> > > > cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
> > > >
> > > > Thus it's indeed related to the absence of the toolchain there. It's
> > > > just that the way the error is reported (due to set -e) is a bit harsh.
> > >
> > > Ack. It should not occur with "-p" though.
> >
> > Agreed, I was focusing on first experience for users essentially.
> >
> > > > What about this ?
> > > >
> > > > $ ./run-tests.sh
> > > > No toolchain found in /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux.
> > > > Did you install the toolchains or set the correct arch ? Rerun with -h for help.
> > > > Aborting...
> > > >
> > > > or anything similar, achieved by this patch (warning copy-paste, mangled
> > > > indents):
> > > >
> > > > diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
> > > > index e7ecda4ae796..0f67e80051dc 100755
> > > > --- a/tools/testing/selftests/nolibc/run-tests.sh
> > > > +++ b/tools/testing/selftests/nolibc/run-tests.sh
> > > > @@ -143,6 +143,13 @@ test_arch() {
> > > > arch=$1
> > > > ct_arch=$(crosstool_arch "$arch")
> > > > ct_abi=$(crosstool_abi "$1")
> > > > +
> > > > + if [ ! -d "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/." ]; then
> > > > + echo "No toolchain found in ${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}."
> > > > + echo "Did you install the toolchains or set the correct arch ? Rerun with -h for help."
> > > > + return 1
> > > > + fi
> > > > +
> > > > cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
> > > > build_dir="${build_location}/${arch}"
> > > > if [ "$werror" -ne 0 ]; then
> > >
> > > Looks good.
> >
> > OK thanks, I'll try to handle it this week-end if I'm not beaten to
> > it. If you or Shuah want to merge it before, feel free to, no offense
> > on my side!
> >
>
> Sounds good. My system is back to a good state with the tests after running
> ./run-tests.sh -p -m user
>
> My guess is my setup was lost when I upgraded my system.
Makes sense.
FWIW I've just pushed the patch above to nolibc-next. Since it's not a
result of a change of the last PR, there's no need to udpate it I think,
it can easily wait for the next one (it's just a help message after all).
During the tests I've also got caught with -d which needs a trailing slash
otherwise doesn't concatenate directories correctly. I don't know if that's
intentional or not so I didn't change it (and it's not important either).
Best regards,
Willy
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-08 10:22 ` Willy Tarreau
@ 2024-09-09 17:50 ` Shuah Khan
0 siblings, 0 replies; 16+ messages in thread
From: Shuah Khan @ 2024-09-09 17:50 UTC (permalink / raw)
To: Willy Tarreau
Cc: Thomas Weißschuh, Paul E. McKenney, linux-kernel, Shuah Khan
On 9/8/24 04:22, Willy Tarreau wrote:
> On Thu, Sep 05, 2024 at 05:57:52PM -0600, Shuah Khan wrote:
>> On 9/5/24 10:35, Willy Tarreau wrote:
>>> On Thu, Sep 05, 2024 at 05:57:22PM +0200, Thomas Weißschuh wrote:
>>>> On 2024-09-05 08:32:14+0000, Willy Tarreau wrote:
>>>>> On Thu, Sep 05, 2024 at 08:22:18AM +0200, Willy Tarreau wrote:
>>>>>>>
>>>>>>> ./run-tests.sh -p -m user
>>>>>>>
>>>>>>> These toolchains can then also be used for direct "make" invocations
>>>>>>> through CROSS_COMPILE.
>>>>>>
>>>>>> I really suspect an empty CC variable somewhere that could explain why
>>>>>> only CROSS_COMPILE is used. I'll try to find time today to give it a
>>>>>> try here as well, just in case I can reproduce the same issue.
>>>>>
>>>>> In fact I'm getting it without any options:
>>>>>
>>>>> $ ./run-tests.sh
>>>>> realpath: /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-: No such file or directory
>>>>>
>>>>> It comes from here in test_arch():
>>>>>
>>>>> cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
>>>>>
>>>>> Thus it's indeed related to the absence of the toolchain there. It's
>>>>> just that the way the error is reported (due to set -e) is a bit harsh.
>>>>
>>>> Ack. It should not occur with "-p" though.
>>>
>>> Agreed, I was focusing on first experience for users essentially.
>>>
>>>>> What about this ?
>>>>>
>>>>> $ ./run-tests.sh
>>>>> No toolchain found in /home/willy/.cache/crosstools/gcc-13.2.0-nolibc/i386-linux.
>>>>> Did you install the toolchains or set the correct arch ? Rerun with -h for help.
>>>>> Aborting...
>>>>>
>>>>> or anything similar, achieved by this patch (warning copy-paste, mangled
>>>>> indents):
>>>>>
>>>>> diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
>>>>> index e7ecda4ae796..0f67e80051dc 100755
>>>>> --- a/tools/testing/selftests/nolibc/run-tests.sh
>>>>> +++ b/tools/testing/selftests/nolibc/run-tests.sh
>>>>> @@ -143,6 +143,13 @@ test_arch() {
>>>>> arch=$1
>>>>> ct_arch=$(crosstool_arch "$arch")
>>>>> ct_abi=$(crosstool_abi "$1")
>>>>> +
>>>>> + if [ ! -d "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/." ]; then
>>>>> + echo "No toolchain found in ${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}."
>>>>> + echo "Did you install the toolchains or set the correct arch ? Rerun with -h for help."
>>>>> + return 1
>>>>> + fi
>>>>> +
>>>>> cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
>>>>> build_dir="${build_location}/${arch}"
>>>>> if [ "$werror" -ne 0 ]; then
>>>>
>>>> Looks good.
>>>
>>> OK thanks, I'll try to handle it this week-end if I'm not beaten to
>>> it. If you or Shuah want to merge it before, feel free to, no offense
>>> on my side!
>>>
>>
>> Sounds good. My system is back to a good state with the tests after running
>> ./run-tests.sh -p -m user
>>
>> My guess is my setup was lost when I upgraded my system.
>
> Makes sense.
>
> FWIW I've just pushed the patch above to nolibc-next. Since it's not a
> result of a change of the last PR, there's no need to udpate it I think,
> it can easily wait for the next one (it's just a help message after all).
>
Sounds good. We can add this later too during the release cycle for one
of the rcs.
> During the tests I've also got caught with -d which needs a trailing slash
> otherwise doesn't concatenate directories correctly. I don't know if that's
> intentional or not so I didn't change it (and it's not important either).
>
It is good to fix this and give more information to users.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 16+ messages in thread
* [GIT PULL] nolibc for 6.12-rc1
@ 2024-09-16 23:37 Shuah Khan
2024-09-17 15:00 ` pr-tracker-bot
0 siblings, 1 reply; 16+ messages in thread
From: Shuah Khan @ 2024-09-16 23:37 UTC (permalink / raw)
To: Linus Torvalds
Cc: shuah, Shuah Khan, Thomas Weißschuh, Willy Tarreau,
Paul E. McKenney, linux-kselftest, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4203 bytes --]
Hi Linus,
Please pull the following nolibc update for Linux 6.12-rc1.
This nolibc update for Linux 6.12-rc1 consists of:
Highlights
----------
* Clang support (including LTO)
Other Changes
-------------
* stdbool.h support
* argc/argv/envp arguments for constructors
* Small #include ordering fix
Test Results:
Passed:
tools/testing/selftests/nolibc/run-tests.sh
tools/testing/selftests/nolibc/run-tests.sh -m user
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:
Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-nolibc-6.12-rc1
for you to fetch changes up to 248f6b935bbd8f7bc211cce2b6fd76be4c449848:
Merge tag 'nolibc-20240824-for-6.12-1' of https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc into nolibc (2024-08-27 06:43:34 -0600)
----------------------------------------------------------------
linux_kselftest-nolibc-6.12-rc1
This nolibc update for Linux 6.12-rc1 consists of:
Highlights
----------
* Clang support (including LTO)
Other Changes
-------------
* stdbool.h support
* argc/argv/envp arguments for constructors
* Small #include ordering fix
----------------------------------------------------------------
Shuah Khan (1):
Merge tag 'nolibc-20240824-for-6.12-1' of https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc into nolibc
Thomas Weißschuh (21):
tools/nolibc: include arch.h from string.h
tools/nolibc: add stdbool.h header
tools/nolibc: pass argc, argv and envp to constructors
tools/nolibc: arm: use clang-compatible asm syntax
tools/nolibc: mips: load current function to $t9
tools/nolibc: powerpc: limit stack-protector workaround to GCC
tools/nolibc: compiler: introduce __nolibc_has_attribute()
tools/nolibc: move entrypoint specifics to compiler.h
tools/nolibc: compiler: use attribute((naked)) if available
selftests/nolibc: report failure if no testcase passed
selftests/nolibc: avoid passing NULL to printf("%s")
selftests/nolibc: determine $(srctree) first
selftests/nolibc: add support for LLVM= parameter
selftests/nolibc: add cc-option compatible with clang cross builds
selftests/nolibc: run-tests.sh: avoid overwriting CFLAGS_EXTRA
selftests/nolibc: don't use libgcc when building with clang
selftests/nolibc: use correct clang target for s390/systemz
selftests/nolibc: run-tests.sh: allow building through LLVM
tools/nolibc: crt: mark _start_c() as used
tools/nolibc: stackprotector: mark implicitly used symbols as used
tools/nolibc: x86_64: use local label in memcpy/memmove
tools/include/nolibc/Makefile | 1 +
tools/include/nolibc/arch-aarch64.h | 4 +--
tools/include/nolibc/arch-arm.h | 8 +++---
tools/include/nolibc/arch-i386.h | 4 +--
tools/include/nolibc/arch-loongarch.h | 4 +--
tools/include/nolibc/arch-mips.h | 8 ++++--
tools/include/nolibc/arch-powerpc.h | 6 ++--
tools/include/nolibc/arch-riscv.h | 4 +--
tools/include/nolibc/arch-s390.h | 4 +--
tools/include/nolibc/arch-x86_64.h | 8 +++---
tools/include/nolibc/compiler.h | 24 +++++++++++-----
tools/include/nolibc/crt.h | 25 +++++++++--------
tools/include/nolibc/nolibc.h | 3 +-
tools/include/nolibc/stackprotector.h | 4 +--
tools/include/nolibc/stdbool.h | 16 +++++++++++
tools/include/nolibc/string.h | 1 +
tools/testing/selftests/nolibc/Makefile | 41 +++++++++++++++++++---------
tools/testing/selftests/nolibc/nolibc-test.c | 9 +++---
tools/testing/selftests/nolibc/run-tests.sh | 16 ++++++++---
19 files changed, 123 insertions(+), 67 deletions(-)
create mode 100644 tools/include/nolibc/stdbool.h
----------------------------------------------------------------
[-- Attachment #2: linux_kselftest-nolibc-6.12-rc1.diff --]
[-- Type: text/x-patch, Size: 21493 bytes --]
diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index e69c26abe1ea..a1f55fb24bb3 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -35,6 +35,7 @@ all_files := \
stackprotector.h \
std.h \
stdarg.h \
+ stdbool.h \
stdint.h \
stdlib.h \
string.h \
diff --git a/tools/include/nolibc/arch-aarch64.h b/tools/include/nolibc/arch-aarch64.h
index b23ac1f04035..06fdef7b291a 100644
--- a/tools/include/nolibc/arch-aarch64.h
+++ b/tools/include/nolibc/arch-aarch64.h
@@ -142,13 +142,13 @@
})
/* startup code */
-void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector _start(void)
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
{
__asm__ volatile (
"mov x0, sp\n" /* save stack pointer to x0, as arg1 of _start_c */
"and sp, x0, -16\n" /* sp must be 16-byte aligned in the callee */
"bl _start_c\n" /* transfer to c runtime */
);
- __builtin_unreachable();
+ __nolibc_entrypoint_epilogue();
}
#endif /* _NOLIBC_ARCH_AARCH64_H */
diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc/arch-arm.h
index cae4afa7c1c7..6180ff99ab43 100644
--- a/tools/include/nolibc/arch-arm.h
+++ b/tools/include/nolibc/arch-arm.h
@@ -185,15 +185,15 @@
})
/* startup code */
-void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector _start(void)
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
{
__asm__ volatile (
- "mov %r0, sp\n" /* save stack pointer to %r0, as arg1 of _start_c */
- "and ip, %r0, #-8\n" /* sp must be 8-byte aligned in the callee */
+ "mov r0, sp\n" /* save stack pointer to %r0, as arg1 of _start_c */
+ "and ip, r0, #-8\n" /* sp must be 8-byte aligned in the callee */
"mov sp, ip\n"
"bl _start_c\n" /* transfer to c runtime */
);
- __builtin_unreachable();
+ __nolibc_entrypoint_epilogue();
}
#endif /* _NOLIBC_ARCH_ARM_H */
diff --git a/tools/include/nolibc/arch-i386.h b/tools/include/nolibc/arch-i386.h
index 28c26a00a762..ff5afc35bbd8 100644
--- a/tools/include/nolibc/arch-i386.h
+++ b/tools/include/nolibc/arch-i386.h
@@ -162,7 +162,7 @@
* 2) The deepest stack frame should be set to zero
*
*/
-void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector _start(void)
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
{
__asm__ volatile (
"xor %ebp, %ebp\n" /* zero the stack frame */
@@ -174,7 +174,7 @@ void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_
"call _start_c\n" /* transfer to c runtime */
"hlt\n" /* ensure it does not return */
);
- __builtin_unreachable();
+ __nolibc_entrypoint_epilogue();
}
#endif /* _NOLIBC_ARCH_I386_H */
diff --git a/tools/include/nolibc/arch-loongarch.h b/tools/include/nolibc/arch-loongarch.h
index 3f8ef8f86c0f..fb519545959e 100644
--- a/tools/include/nolibc/arch-loongarch.h
+++ b/tools/include/nolibc/arch-loongarch.h
@@ -149,14 +149,14 @@
#endif
/* startup code */
-void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector _start(void)
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
{
__asm__ volatile (
"move $a0, $sp\n" /* save stack pointer to $a0, as arg1 of _start_c */
LONG_BSTRINS " $sp, $zero, 3, 0\n" /* $sp must be 16-byte aligned */
"bl _start_c\n" /* transfer to c runtime */
);
- __builtin_unreachable();
+ __nolibc_entrypoint_epilogue();
}
#endif /* _NOLIBC_ARCH_LOONGARCH_H */
diff --git a/tools/include/nolibc/arch-mips.h b/tools/include/nolibc/arch-mips.h
index 62cc50ef3288..1791a8ce58da 100644
--- a/tools/include/nolibc/arch-mips.h
+++ b/tools/include/nolibc/arch-mips.h
@@ -179,7 +179,7 @@
})
/* startup code, note that it's called __start on MIPS */
-void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector __start(void)
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector __start(void)
{
__asm__ volatile (
".set push\n"
@@ -194,11 +194,13 @@ void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_
"li $t0, -8\n"
"and $sp, $sp, $t0\n" /* $sp must be 8-byte aligned */
"addiu $sp, $sp, -16\n" /* the callee expects to save a0..a3 there */
- "jal _start_c\n" /* transfer to c runtime */
+ "lui $t9, %hi(_start_c)\n" /* ABI requires current function address in $t9 */
+ "ori $t9, %lo(_start_c)\n"
+ "jalr $t9\n" /* transfer to c runtime */
" nop\n" /* delayed slot */
".set pop\n"
);
- __builtin_unreachable();
+ __nolibc_entrypoint_epilogue();
}
#endif /* _NOLIBC_ARCH_MIPS_H */
diff --git a/tools/include/nolibc/arch-powerpc.h b/tools/include/nolibc/arch-powerpc.h
index ac212e6185b2..ee2fdb8d601d 100644
--- a/tools/include/nolibc/arch-powerpc.h
+++ b/tools/include/nolibc/arch-powerpc.h
@@ -172,7 +172,7 @@
_ret; \
})
-#ifndef __powerpc64__
+#if !defined(__powerpc64__) && !defined(__clang__)
/* FIXME: For 32-bit PowerPC, with newer gcc compilers (e.g. gcc 13.1.0),
* "omit-frame-pointer" fails with __attribute__((no_stack_protector)) but
* works with __attribute__((__optimize__("-fno-stack-protector")))
@@ -184,7 +184,7 @@
#endif /* !__powerpc64__ */
/* startup code */
-void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector _start(void)
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
{
#ifdef __powerpc64__
#if _CALL_ELF == 2
@@ -215,7 +215,7 @@ void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_
"bl _start_c\n" /* transfer to c runtime */
);
#endif
- __builtin_unreachable();
+ __nolibc_entrypoint_epilogue();
}
#endif /* _NOLIBC_ARCH_POWERPC_H */
diff --git a/tools/include/nolibc/arch-riscv.h b/tools/include/nolibc/arch-riscv.h
index 1927c643c739..8827bf936212 100644
--- a/tools/include/nolibc/arch-riscv.h
+++ b/tools/include/nolibc/arch-riscv.h
@@ -140,7 +140,7 @@
})
/* startup code */
-void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector _start(void)
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
{
__asm__ volatile (
".option push\n"
@@ -151,7 +151,7 @@ void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_
"andi sp, a0, -16\n" /* sp must be 16-byte aligned */
"call _start_c\n" /* transfer to c runtime */
);
- __builtin_unreachable();
+ __nolibc_entrypoint_epilogue();
}
#endif /* _NOLIBC_ARCH_RISCV_H */
diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s390.h
index 5d60fd43f883..2ec13d8b9a2d 100644
--- a/tools/include/nolibc/arch-s390.h
+++ b/tools/include/nolibc/arch-s390.h
@@ -139,7 +139,7 @@
})
/* startup code */
-void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector _start(void)
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
{
__asm__ volatile (
"lgr %r2, %r15\n" /* save stack pointer to %r2, as arg1 of _start_c */
@@ -147,7 +147,7 @@ void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_
"xc 0(8,%r15), 0(%r15)\n" /* clear backchain */
"brasl %r14, _start_c\n" /* transfer to c runtime */
);
- __builtin_unreachable();
+ __nolibc_entrypoint_epilogue();
}
struct s390_mmap_arg_struct {
diff --git a/tools/include/nolibc/arch-x86_64.h b/tools/include/nolibc/arch-x86_64.h
index 68609f421934..1e40620a2b33 100644
--- a/tools/include/nolibc/arch-x86_64.h
+++ b/tools/include/nolibc/arch-x86_64.h
@@ -161,7 +161,7 @@
* 2) The deepest stack frame should be zero (the %rbp).
*
*/
-void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_stack_protector _start(void)
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
{
__asm__ volatile (
"xor %ebp, %ebp\n" /* zero the stack frame */
@@ -170,7 +170,7 @@ void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_
"call _start_c\n" /* transfer to c runtime */
"hlt\n" /* ensure it does not return */
);
- __builtin_unreachable();
+ __nolibc_entrypoint_epilogue();
}
#define NOLIBC_ARCH_HAS_MEMMOVE
@@ -193,10 +193,10 @@ __asm__ (
"movq %rdi, %rdx\n\t"
"subq %rsi, %rdx\n\t"
"cmpq %rcx, %rdx\n\t"
- "jb .Lbackward_copy\n\t"
+ "jb 1f\n\t"
"rep movsb\n\t"
"retq\n"
-".Lbackward_copy:"
+"1:" /* backward copy */
"leaq -1(%rdi, %rcx, 1), %rdi\n\t"
"leaq -1(%rsi, %rcx, 1), %rsi\n\t"
"std\n\t"
diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h
index beddc3665d69..9bc6a706a332 100644
--- a/tools/include/nolibc/compiler.h
+++ b/tools/include/nolibc/compiler.h
@@ -6,20 +6,30 @@
#ifndef _NOLIBC_COMPILER_H
#define _NOLIBC_COMPILER_H
+#if defined(__has_attribute)
+# define __nolibc_has_attribute(attr) __has_attribute(attr)
+#else
+# define __nolibc_has_attribute(attr) 0
+#endif
+
+#if __nolibc_has_attribute(naked)
+# define __nolibc_entrypoint __attribute__((naked))
+# define __nolibc_entrypoint_epilogue()
+#else
+# define __nolibc_entrypoint __attribute__((optimize("Os", "omit-frame-pointer")))
+# define __nolibc_entrypoint_epilogue() __builtin_unreachable()
+#endif /* __nolibc_has_attribute(naked) */
+
#if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__) || defined(__SSP_EXPLICIT__)
#define _NOLIBC_STACKPROTECTOR
#endif /* defined(__SSP__) ... */
-#if defined(__has_attribute)
-# if __has_attribute(no_stack_protector)
-# define __no_stack_protector __attribute__((no_stack_protector))
-# else
-# define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
-# endif
+#if __nolibc_has_attribute(no_stack_protector)
+# define __no_stack_protector __attribute__((no_stack_protector))
#else
# define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
-#endif /* defined(__has_attribute) */
+#endif /* __nolibc_has_attribute(no_stack_protector) */
#endif /* _NOLIBC_COMPILER_H */
diff --git a/tools/include/nolibc/crt.h b/tools/include/nolibc/crt.h
index 43b551468c2a..bbcd5fd09806 100644
--- a/tools/include/nolibc/crt.h
+++ b/tools/include/nolibc/crt.h
@@ -13,23 +13,24 @@ const unsigned long *_auxv __attribute__((weak));
static void __stack_chk_init(void);
static void exit(int);
-extern void (*const __preinit_array_start[])(void) __attribute__((weak));
-extern void (*const __preinit_array_end[])(void) __attribute__((weak));
+extern void (*const __preinit_array_start[])(int, char **, char**) __attribute__((weak));
+extern void (*const __preinit_array_end[])(int, char **, char**) __attribute__((weak));
-extern void (*const __init_array_start[])(void) __attribute__((weak));
-extern void (*const __init_array_end[])(void) __attribute__((weak));
+extern void (*const __init_array_start[])(int, char **, char**) __attribute__((weak));
+extern void (*const __init_array_end[])(int, char **, char**) __attribute__((weak));
extern void (*const __fini_array_start[])(void) __attribute__((weak));
extern void (*const __fini_array_end[])(void) __attribute__((weak));
-__attribute__((weak))
+__attribute__((weak,used))
void _start_c(long *sp)
{
long argc;
char **argv;
char **envp;
int exitcode;
- void (* const *func)(void);
+ void (* const *ctor_func)(int, char **, char **);
+ void (* const *dtor_func)(void);
const unsigned long *auxv;
/* silence potential warning: conflicting types for 'main' */
int _nolibc_main(int, char **, char **) __asm__ ("main");
@@ -66,16 +67,16 @@ void _start_c(long *sp)
;
_auxv = auxv;
- for (func = __preinit_array_start; func < __preinit_array_end; func++)
- (*func)();
- for (func = __init_array_start; func < __init_array_end; func++)
- (*func)();
+ for (ctor_func = __preinit_array_start; ctor_func < __preinit_array_end; ctor_func++)
+ (*ctor_func)(argc, argv, envp);
+ for (ctor_func = __init_array_start; ctor_func < __init_array_end; ctor_func++)
+ (*ctor_func)(argc, argv, envp);
/* go to application */
exitcode = _nolibc_main(argc, argv, envp);
- for (func = __fini_array_end; func > __fini_array_start;)
- (*--func)();
+ for (dtor_func = __fini_array_end; dtor_func > __fini_array_start;)
+ (*--dtor_func)();
exit(exitcode);
}
diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index 989e707263a4..92436b1e4441 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -74,7 +74,8 @@
* -I../nolibc -o hello hello.c -lgcc
*
* The available standard (but limited) include files are:
- * ctype.h, errno.h, signal.h, stdarg.h, stdio.h, stdlib.h, string.h, time.h
+ * ctype.h, errno.h, signal.h, stdarg.h, stdbool.h stdio.h, stdlib.h,
+ * string.h, time.h
*
* In addition, the following ones are expected to be provided by the compiler:
* float.h, stddef.h
diff --git a/tools/include/nolibc/stackprotector.h b/tools/include/nolibc/stackprotector.h
index 13f1d0e60387..1d0d5259ec41 100644
--- a/tools/include/nolibc/stackprotector.h
+++ b/tools/include/nolibc/stackprotector.h
@@ -18,7 +18,7 @@
* triggering stack protector errors themselves
*/
-__attribute__((weak,noreturn,section(".text.nolibc_stack_chk")))
+__attribute__((weak,used,noreturn,section(".text.nolibc_stack_chk")))
void __stack_chk_fail(void)
{
pid_t pid;
@@ -34,7 +34,7 @@ void __stack_chk_fail_local(void)
__stack_chk_fail();
}
-__attribute__((weak,section(".data.nolibc_stack_chk")))
+__attribute__((weak,used,section(".data.nolibc_stack_chk")))
uintptr_t __stack_chk_guard;
static __no_stack_protector void __stack_chk_init(void)
diff --git a/tools/include/nolibc/stdbool.h b/tools/include/nolibc/stdbool.h
new file mode 100644
index 000000000000..60feece22f17
--- /dev/null
+++ b/tools/include/nolibc/stdbool.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
+/*
+ * Boolean types support for NOLIBC
+ * Copyright (C) 2024 Thomas Weißschuh <linux@weissschuh.net>
+ */
+
+#ifndef _NOLIBC_STDBOOL_H
+#define _NOLIBC_STDBOOL_H
+
+#define bool _Bool
+#define true 1
+#define false 0
+
+#define __bool_true_false_are_defined 1
+
+#endif /* _NOLIBC_STDBOOL_H */
diff --git a/tools/include/nolibc/string.h b/tools/include/nolibc/string.h
index f9ab28421e6d..9ec9c24f38c0 100644
--- a/tools/include/nolibc/string.h
+++ b/tools/include/nolibc/string.h
@@ -7,6 +7,7 @@
#ifndef _NOLIBC_STRING_H
#define _NOLIBC_STRING_H
+#include "arch.h"
#include "std.h"
static void *malloc(size_t len);
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 3fbabab46958..8de98ea7af80 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -1,19 +1,21 @@
# SPDX-License-Identifier: GPL-2.0
# Makefile for nolibc tests
-include ../../../scripts/Makefile.include
-include ../../../scripts/utilities.mak
-# We need this for the "cc-option" macro.
-include ../../../build/Build.include
+# we're in ".../tools/testing/selftests/nolibc"
+ifeq ($(srctree),)
+srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR)))
+endif
+
+include $(srctree)/tools/scripts/utilities.mak
+# We need this for the "__cc-option" macro.
+include $(srctree)/scripts/Makefile.compiler
ifneq ($(O),)
ifneq ($(call is-absolute,$(O)),y)
$(error Only absolute O= parameters are supported)
endif
-endif
-
-# we're in ".../tools/testing/selftests/nolibc"
-ifeq ($(srctree),)
-srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR)))
+objtree := $(O)
+else
+objtree ?= $(srctree)
endif
ifeq ($(ARCH),)
@@ -21,7 +23,7 @@ include $(srctree)/scripts/subarch.include
ARCH = $(SUBARCH)
endif
-objtree ?= $(srctree)
+cc-option = $(call __cc-option, $(CC),$(CLANG_CROSS_FLAGS),$(1),$(2))
# XARCH extends the kernel's ARCH with a few variants of the same
# architecture that only differ by the configuration, the toolchain
@@ -155,9 +157,22 @@ CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wex
$(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA)
LDFLAGS :=
+LIBGCC := -lgcc
+
+ifneq ($(LLVM),)
+# Not needed for clang
+LIBGCC :=
+endif
+
+# Modify CFLAGS based on LLVM=
+include $(srctree)/tools/scripts/Makefile.include
+
+# GCC uses "s390", clang "systemz"
+CLANG_CROSS_FLAGS := $(subst --target=s390-linux,--target=systemz-linux,$(CLANG_CROSS_FLAGS))
+
REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \
END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \
- if (f) printf("failure\n"); else if (s) printf("warning\n"); else printf("success\n");; \
+ if (f || !p) printf("failure\n"); else if (s) printf("warning\n"); else printf("success\n");; \
printf("\nSee all results in %s\n", ARGV[1]); }'
help:
@@ -204,11 +219,11 @@ sysroot/$(ARCH)/include:
ifneq ($(NOLIBC_SYSROOT),0)
nolibc-test: nolibc-test.c nolibc-test-linkage.c sysroot/$(ARCH)/include
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
- -nostdlib -nostdinc -static -Isysroot/$(ARCH)/include nolibc-test.c nolibc-test-linkage.c -lgcc
+ -nostdlib -nostdinc -static -Isysroot/$(ARCH)/include nolibc-test.c nolibc-test-linkage.c $(LIBGCC)
else
nolibc-test: nolibc-test.c nolibc-test-linkage.c
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
- -nostdlib -static -include $(srctree)/tools/include/nolibc/nolibc.h nolibc-test.c nolibc-test-linkage.c -lgcc
+ -nostdlib -static -include $(srctree)/tools/include/nolibc/nolibc.h nolibc-test.c nolibc-test-linkage.c $(LIBGCC)
endif
libc-test: nolibc-test.c nolibc-test-linkage.c
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 093d0512f4c5..6fba7025c5e3 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -542,7 +542,7 @@ int expect_strzr(const char *expr, int llen)
{
int ret = 0;
- llen += printf(" = <%s> ", expr);
+ llen += printf(" = <%s> ", expr ? expr : "(null)");
if (expr) {
ret = 1;
result(llen, FAIL);
@@ -561,7 +561,7 @@ int expect_strnz(const char *expr, int llen)
{
int ret = 0;
- llen += printf(" = <%s> ", expr);
+ llen += printf(" = <%s> ", expr ? expr : "(null)");
if (!expr) {
ret = 1;
result(llen, FAIL);
@@ -686,9 +686,10 @@ static void constructor1(void)
}
__attribute__((constructor))
-static void constructor2(void)
+static void constructor2(int argc, char **argv, char **envp)
{
- constructor_test_value *= 2;
+ if (argc && argv && envp)
+ constructor_test_value *= 2;
}
int run_startup(int min, int max)
diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
index 0446e6326a40..e7ecda4ae796 100755
--- a/tools/testing/selftests/nolibc/run-tests.sh
+++ b/tools/testing/selftests/nolibc/run-tests.sh
@@ -15,10 +15,11 @@ download_location="${cache_dir}/crosstools/"
build_location="$(realpath "${cache_dir}"/nolibc-tests/)"
perform_download=0
test_mode=system
-CFLAGS_EXTRA="-Werror"
+werror=1
+llvm=
archs="i386 x86_64 arm64 arm mips32le mips32be ppc ppc64 ppc64le riscv s390 loongarch"
-TEMP=$(getopt -o 'j:d:c:b:a:m:peh' -n "$0" -- "$@")
+TEMP=$(getopt -o 'j:d:c:b:a:m:pelh' -n "$0" -- "$@")
eval set -- "$TEMP"
unset TEMP
@@ -42,6 +43,7 @@ Options:
-b [DIR] Build location (default: ${build_location})
-m [MODE] Test mode user/system (default: ${test_mode})
-e Disable -Werror
+ -l Build with LLVM/clang
EOF
}
@@ -69,7 +71,10 @@ while true; do
test_mode="$2"
shift 2; continue ;;
'-e')
- CFLAGS_EXTRA=""
+ werror=0
+ shift; continue ;;
+ '-l')
+ llvm=1
shift; continue ;;
'-h')
print_usage
@@ -140,7 +145,10 @@ test_arch() {
ct_abi=$(crosstool_abi "$1")
cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
build_dir="${build_location}/${arch}"
- MAKE=(make -j"${nproc}" XARCH="${arch}" CROSS_COMPILE="${cross_compile}" O="${build_dir}")
+ if [ "$werror" -ne 0 ]; then
+ CFLAGS_EXTRA="$CFLAGS_EXTRA -Werror"
+ fi
+ MAKE=(make -j"${nproc}" XARCH="${arch}" CROSS_COMPILE="${cross_compile}" LLVM="${llvm}" O="${build_dir}")
mkdir -p "$build_dir"
if [ "$test_mode" = "system" ] && [ ! -f "${build_dir}/.config" ]; then
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [GIT PULL] nolibc for 6.12-rc1
2024-09-16 23:37 Shuah Khan
@ 2024-09-17 15:00 ` pr-tracker-bot
0 siblings, 0 replies; 16+ messages in thread
From: pr-tracker-bot @ 2024-09-17 15:00 UTC (permalink / raw)
To: Shuah Khan
Cc: Linus Torvalds, shuah, Shuah Khan, Thomas Weißschuh,
Willy Tarreau, Paul E. McKenney, linux-kselftest, linux-kernel
The pull request you sent on Mon, 16 Sep 2024 17:37:52 -0600:
> git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-nolibc-6.12-rc1
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/395b15778e8f1b580334c558c9a6e9f1b28fcc76
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-09-17 15:00 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-24 18:53 [GIT PULL] nolibc for 6.12-rc1 Thomas Weißschuh
2024-08-27 12:56 ` Shuah Khan
2024-09-04 21:04 ` Shuah Khan
2024-09-04 21:13 ` Thomas Weißschuh
2024-09-04 21:19 ` Shuah Khan
2024-09-05 3:08 ` Willy Tarreau
2024-09-05 5:59 ` Thomas Weißschuh
2024-09-05 6:22 ` Willy Tarreau
2024-09-05 6:32 ` Willy Tarreau
2024-09-05 15:57 ` Thomas Weißschuh
2024-09-05 16:35 ` Willy Tarreau
2024-09-05 23:57 ` Shuah Khan
2024-09-08 10:22 ` Willy Tarreau
2024-09-09 17:50 ` Shuah Khan
-- strict thread matches above, loose matches on Subject: below --
2024-09-16 23:37 Shuah Khan
2024-09-17 15:00 ` pr-tracker-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox