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

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

 



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:

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?

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux