Commit Graph

1775 Commits

Author SHA1 Message Date
Yingwei Zheng 871cd306c5 libm/copysign: respect signed zero/NaN in copysign 2024-08-01 01:08:19 +08:00
Tiago Medicci Serrano 84d39a8d9a binfmt/libelf: Enable ELF loader if text heap read is word-aligned
The ELF loader needs to load the app into the memory before
executing it from the same location. As expected, this memory space
should be able to execute code. For architectures containing data
and instruction buses, the instruction bus may not be able to be
accessed in a non-aligned way, which is usually required when
copying data to that location. Eventually, this same memory space
can be accessed through the data bus, using different address
ranges. This commit enables accessing the memory through the data
bus to copy the app's data before executing it when
`CONFIG_ARCH_HAVE_TEXT_HEAP_WORD_ALIGNED_READ` is enabled.
2024-07-31 02:33:12 +08:00
Huang Qi 0228e52646 nxtk: Remove sapce between oprand and operator in nxtk_drawframe.c
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-07-27 03:11:39 +08:00
Huang Qi f84d35de50 libc/net: Fix indent issue in lib_base64.c
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-07-27 03:11:39 +08:00
Huang Qi 09568c6147 dlfcn: Fix indent issue in lib_dlopen.c
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-07-27 03:11:39 +08:00
Huang Qi f714669da4 dlfcn: Add stub for dladdr
Implement a stub for dladdr() to avoid build errors
with some applications that use dladdr().

The API definition is from:
1. https://man7.org/linux/man-pages/man3/dladdr.3.html
2. https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/dladdr.html

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-07-26 14:39:10 -03:00
Huang Qi caa4c226bd dlfcn: Fix indent issue in lib_dlclose.c
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-07-26 16:34:41 +02:00
chao an 7780cfc5a6 tricore/cmake: add support of cmake build for tricore
Toolchain Upstream:
https://github.com/EEESlab/tricore-gcc-toolchain-11.3.0

CMake command:
$ cmake -B build -DBOARD_CONFIG=tc397/nsh -GNinja
$ cmake --build build

Signed-off-by: chao an <anchao@lixiang.com>
2024-07-18 13:40:49 +08:00
zhanghongyu bcd64bf2bf libc/unistd: added an implementation of the lib_flock function
To solve some compilation issues encountered during the porting of
third-party libraries, this function has been added.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-07-14 10:51:41 -03:00
p-szafonimateusz 53d112fa95 x86_64: add ELF support
add arch_elf64.c for x86_64, ported from sim/x86

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-07-03 17:40:53 +08:00
p-szafonimateusz e6553eee5a libc/x86_64: port string functions from bionic
port optimized string functions for x86_64 from Bionic (BSD licensed)

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-07-02 23:59:18 +08:00
buxiasen 7445c97c77 libc: scanf, printf %z change switch const to if
switch const will cause a switch_selector_expr_is_constant
warning catched by coverity.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-07-02 02:57:00 +08:00
buxiasen b08d219849 mkstemp: permission 0666 to 0600
https://man7.org/linux/man-pages/man3/mkstemp.3.html
remove the read/write permission of other users for temp file

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-07-02 02:56:05 +08:00
fangpeina 242b50f921 libc/execinfo: extract a common backtrace format function
Add a common method to format backtrace to buffer, so it can be used by both mm, fs and other possoble modules.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-06-29 22:44:39 +08:00
p-szafonimateusz c932fe3045 libm/newlib: disable optimization for sincos
Disable sincos optimization for all functions in this file,
otherwise gcc would generate infinite calls.
Refer to gcc bug 46926.
-fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
but these two options do not work inside optimize pragma in-file.
Thus we just enforce -O0 when compiling this file.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-06-28 01:26:18 +08:00
p-szafonimateusz 23b2f96c9d libm/libm: disable optimization for sincos
Disable sincos optimization for all functions in this file,
otherwise gcc would generate infinite calls.
Refer to gcc bug 46926.
-fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
but these two options do not work inside optimize pragma in-file.
Thus we just enforce -O0 when compiling this file.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-06-28 01:26:18 +08:00
Huang Qi a14d94c548 gdbstub: Minor style fix
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-06-26 10:19:14 -03:00
zhanghongyu e14ae3e681 pthread: add pthread_self/pthread_gettid_np function
explicitly defined functions can support assignment as function pointers

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-26 17:40:55 +08:00
anjiahao 1b2ad4ff7d gdbstub: fix typo
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-06-26 00:20:58 +08:00
Huang Qi add8b71fee serial/gdbstub: Change GDBSTUB_ to GDB_
Fix nameing convention inconsistent

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-06-24 23:51:43 +08:00
anjiahao 3c7162338d gdbstub:support gdbstub_debugpoint_add/remove smp call
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-06-24 23:51:43 +08:00
Xiang Xiao e9558a88cd gdbstub: Change GDBSTUB_ to GDB_
Make the naming convention more consistent

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-06-24 23:51:43 +08:00
Yanfeng Liu 3b1f4562a0 sched/tls: drop ta_argv and g_idleargv
- replaces `ta_argv` with `stackargs`
- drops `ta_argv` from `task_info_s`
- drops `g_idleargv` and checks idle accordingly

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-23 22:24:19 +08:00
Yanfeng Liu 8ebc3aa9e8 arch/risc-v: initial qemu-rv64ilp32 support
This applies uintreg_t in risc-v commons and fixes araised ci issues
for multiple devices. The FLAT build runs on qemu-rv64ilp32 target.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-14 19:50:00 +08:00
zhanghongyu ee4c25f34e sem_open: return error code, sem returned by parameter
pointer comparison is unsigned, when returning -errno will be converted
to a large positive number, can not enter the error handling branch,
therefore, the error code is returned directly and the sem is returned
through the parameters.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-06 02:40:50 +08:00
raiden00pl 105e4f44d4 libdsp: fix gcc14 error and clean up includes 2024-06-02 09:27:36 -03:00
raiden00pl 13fa50c94a cmake: fix compilation
there is no spawn/lib_task_spawn. file
2024-06-02 09:27:36 -03:00
anjiahao 3312ab2087 gdbstub:fix get thread rsp command crash
riscv-gdb/gdb/thread.c:1309: internal-error: void switch_to_thread(thread_info*): Assertion `thr != NULL' failed.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-05-31 23:19:18 +08:00
Huang Qi 047c9fce40 libc.csv: Guard execv with LIBC_EXECFUNCS
execv only available if LIBC_EXECFUNCS enabled.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-05-29 20:37:12 +08:00
yinshengkai 20ebe0e64c Replace all asserts in kernel code with ASSERT
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-05-17 10:18:16 -03:00
simbit18 d1789d84e8 fix nxstyle
fix Relative file path does not match actual file.
2024-05-13 22:24:36 +02:00
simbit18 09bfaa7292 fix nxstyle
fix Relative file path does not match actual file.
2024-05-11 01:19:06 +08:00
zhanghongyu 908814a575 libc/lib_bzero:Add bzero prototype.
Implement the bzero function as an alternative to macro expansion.

and support gcc FORTIFY_SOURCE features for nuttx libc

This function will use gcc's function
__builtin_dynamic_object_size and __builtin_object_size

Its function is to obtain the size of the object through compilation,
so as to judge whether there are out-of-bounds operations in commonly used functions.
It should be noted that the option -O2 and above is required to enable this function

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-05-07 14:59:05 +02:00
yinshengkai b87804c2ba libc/string: replace __builtin_ffsl with inline function
In the gcc-riscv compiler, __builtin_ffs will call ffs, and calling __builtin_ffs in ffs will cause recursion

Change ffs to an inline function, and compile ffs implemented by nuttx by default.
Only call the implementation of nuttx when the compiler cannot provide an ffs implementation.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-04-30 19:47:08 +08:00
Philippe Leduc 3dc6b4c9bd Add basic support for locales in order to C++ streams to build and work for simple cases (POSIX / C locale).
Fix build with C++ GCC toolchain
2024-04-29 17:34:10 +08:00
Juha Niskanen 3348d03f95 libs/libc/inttypes: add support for imaxdiv
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2024-04-23 10:26:48 -03:00
xuxin19 859247c224 cmake:enhance set_source_files_properties for NuttX CMake module
Because `set_source_files_properties` in cmake will overwrite the properties instead of appending them.
This module implements addition and deletion by
first `getting_source_file_property` and then `set_source_files_properties`

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-04-18 14:57:58 -03:00
Michal Lenc 9798674f27 libc: add support for reallocarray
This commit adds support for reallocarray function. The functionality
is the same as for standard realloc, but the function also checks for
multiplication overflow and fails safely in case it occurs.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-04-17 11:36:39 -03:00
Huang Qi 4bcb33926e libc.csv: Fix macro guard for TLS related symbols
The current macro guard for TLS related symbols is
not enough, only if !defined(CONFIG_DISABLE_PTHREAD)
and CONFIG_TLS_NELEM > 0, the TLS related symbols
will enabled.

So if CONFIG_DISABLE_PTHREAD is not defined, but
TLS is disabled, the reference to TLS related symbols
will cause build error (undefined reference to xxx).

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-04-17 19:45:26 +08:00
simbit18 7677f10d3f fix nxstyle
fix Relative file path does not match actual file.
2024-04-16 19:09:12 +08:00
hujun5 638716504d fdcheck: update fdcheck impl
1 store fd in the high position
2 removing the pid information , as the tag information is sufficient.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-04-11 10:45:44 +08:00
shizhenghui be48a913cc audio/libsrc: fix build warning
libsamplerate/src/samplerate.c:468:5: warning: "CPU_CLIPS_POSITIVE" is not defined, evaluates to 0 [-Wundef]
  468 | #if CPU_CLIPS_POSITIVE == 0
      |     ^~~~~~~~~~~~~~~~~~

Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-03-26 09:40:42 +08:00
shizhenghui 510d55a783 audio/libsrc: move download path to libs/libc/audio/libsrc
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-03-26 09:40:42 +08:00
Alan Carvalho de Assis 97e217b0ff libc/uname: Add option to disable uname timestamp
Don't include the build timestamp into final binary when the symbol
CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP is defined.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2024-03-23 11:42:22 +08:00
chao an d4d49e9645 stdio/file: unify group file list to common single queue
unify group file list to common single queue

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-18 19:32:49 +08:00
xuxin19 2c9d46f176 cmake:enable libxx for CMake build
distinguish whether to add the CXX header file search path
according to the target Language.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-03-15 01:28:53 +08:00
wangmingrong d4b5991589 libcxxabi: Path <cxxabi.h> not found
./helloxx_main.cxx:29:10: fatal error: cxxabi.h: No such file or directory
   29 | #include <cxxabi.h>
      |          ^~~~~~~~~~
CONFIG_LIBCXXABI is turned on, but the library include is not linked to nuttx/include, causing the compilation to fail.

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-14 22:47:55 +08:00
Juha Niskanen 47026978bf libs/libc/string: fix memmem() boundary case when needle is at end of haystack
This fixes calls like memmem("hello", 5, "lo", 2);

Also zero-length needle is deemed to exist at beginning of haystack.
This behavior matches memmem() on Linux, FreeBSD, NetBSD and OpenBSD.

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2024-03-11 22:06:19 +08:00
hujun5 577eb47966 fdcheck: Enable fdcheck to automatically detect ownership of fd
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-03-07 09:08:48 +08:00
trns1997 54e9e582d5 Use C++ standard lib from toolchain
Signed-off-by: trns1997 <trns1997@gmail.com>
2024-03-06 08:42:44 +08:00