Re: [PATCH v3 3/4] tools/nolibc: implement fd-based FILE streams

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mark,


Apr 12, 2023 17:58:45 Mark Brown <broonie@xxxxxxxxxx>:

> On Sun, Apr 02, 2023 at 06:04:36PM +0000, Thomas Weißschuh wrote:
>
>> This enables the usage of the stream APIs with arbitrary filedescriptors.
>>
>> It will be used by a future testcase.
>
> This breaks the explicit use of standard streams:
>
>> -static __attribute__((unused)) FILE* const stdin  = (FILE*)-3;
>> -static __attribute__((unused)) FILE* const stdout = (FILE*)-2;
>> -static __attribute__((unused)) FILE* const stderr = (FILE*)-1;
>> +static __attribute__((unused)) FILE* const stdin  = (FILE*)(intptr_t)~STDIN_FILENO;
>> +static __attribute__((unused)) FILE* const stdout = (FILE*)(intptr_t)~STDOUT_FILENO;
>> +static __attribute__((unused)) FILE* const stderr = (FILE*)(intptr_t)~STDERR_FILENO;
>
> Nothing in this change (or anything else in the series AFAICT) causes
> STDx_FILENO to be declared so we get errors like below in -next when a
> kselftest is built with this version of nolibc:

These definitions come from
"tools/nolibc: add definitions for standard fds".
This patch was part of the nolibc stack protector series which is older than this series and went through the same channels.
So I'm not sure how one series made it into next and the other didn't.

This would also have been noticed by Willy and Paul running their tests.

>
> clang --target=aarch64-linux-gnu -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -Werror=option-ignored -Werror=unused-command-line-argument --target=aarch64-linux-gnu -fintegrated-as -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \
>     -include ../../../../include/nolibc/nolibc.h -I../..\
>     -static -ffreestanding -Wall za-fork.c /tmp/kci/linux/build/kselftest/arm64/fp/za-fork-asm.o -o /tmp/kci/linux/build/kselftest/arm64/fp/za-fork
> In file included from <built-in>:1:
> In file included from ./../../../../include/nolibc/nolibc.h:97:
> In file included from ./../../../../include/nolibc/arch.h:25:
> ./../../../../include/nolibc/arch-aarch64.h:176:35: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
> void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
>                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from <built-in>:1:
> In file included from ./../../../../include/nolibc/nolibc.h:102:
> ./../../../../include/nolibc/stdio.h:33:71: error: use of undeclared identifier 'STDIN_FILENO'
> static __attribute__((unused)) FILE* const stdin  = (FILE*)(intptr_t)~STDIN_FILENO;
>                                                                       ^
> ./../../../../include/nolibc/stdio.h:34:71: error: use of undeclared identifier 'STDOUT_FILENO'
> static __attribute__((unused)) FILE* const stdout = (FILE*)(intptr_t)~STDOUT_FILENO;
>                                                                       ^
> ./../../../../include/nolibc/stdio.h:35:71: error: use of undeclared identifier 'STDERR_FILENO'
> static __attribute__((unused)) FILE* const stderr = (FILE*)(intptr_t)~STDERR_FILENO;
>                                                                       ^
> 1 warning and 3 errors generated.
>
> The kselftest branch itself is fine, the issues manifest when it is
> merged with the nolibc branch.  I'm not quite sure what the implicit> include that's been missed here is?

These defines should be available to all users of nolibc.
It seems more of an issue with the patchsets going through different trees.

I can investigate this more tomorrow with my proper development setup.

Thomas




[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux