Commit Graph

2038 Commits

Author SHA1 Message Date
xuxin19 c60b980968 cmake(bugfix):fix robot openlibm cmake build missing source error
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
wangmingrong1 8461f0ea54 clang: Support compiling rt.profile library
1. Since the implementation of gcov has changed since clang17, versions before clang17 need to use the libunwind.a file

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-30 17:10:23 +08:00
YAMAMOTO Takashi 761ee81956 move readv/writev to the kernel
currently, nuttx implements readv/writev on the top of read/write.
while it might work for the simplest cases, it's broken by design.
for example, it's impossible to make it work correctly for files
which need to preserve data boundaries without allocating a single
contiguous buffer. (udp socket, some character devices, etc)

this change is a start of the migration to a better design.
that is, implement read/write on the top of readv/writev.

to avoid a single huge change, following things will NOT be done in
this commit:

* fix actual bugs caused by the original readv-based-on-read design.
  (cf. https://github.com/apache/nuttx/pull/12674)

* adapt filesystems/drivers to actually benefit from the new interface.
  (except a few trivial examples)

* eventually retire the old interface.

* retire read/write syscalls. implement them in libc instead.

* pread/pwrite/preadv/pwritev (except the introduction of struct uio,
  which is a preparation to back these variations with the new
  interface.)
2024-10-30 17:07:54 +08:00
wangmingrong1 20e33ed84a libbuitlin: distclean should delete all files
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-28 22:19:58 +08:00
wangmingrong1 e174d73cd9 clang:libclang_rt.builtins-xxx.a supports builtin
1. enable CONFIG_BUILTIN_COMPILER_RT  to built libclang_rt.builtins-xxx.a and no longer use the compiler's built-in
2. Modify clang version acquisition to get two decimal points
3. It has been ported to support four architectures: ARM, ARM64, RISCV, and x86_64, among which ARM has been validated

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-28 16:38:45 +08:00
Xiang Xiao 992c8dded5 libc: Fix lib_arc4random.c:111:(.text.arc4random_buf+0x26): undefined reference to `clock_systime_ticks'
by replacing clock_systime_ticks to clock

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-28 09:23:19 +01:00
Xiang Xiao 32784b0898 libc: Refine the arc4random_buf implementation
fill the buffer with getrandom instead random pool
and move the implementation to from crypto to libc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-26 18:04:21 -03:00
chao an c6591c0f49 driver/serial: remove return value of up_putc()
modify the prototype of up_putc(): remove the return value

The architecture code does not care about the return value of up_putc(), so removing it saves two statements:

Before:                                                    After:
de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)    |  de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)
de50: e24dd014  sub sp, sp, #20                         |  de50: e24dd014  sub sp, sp, #20
de54: e58d0004  str r0, [sp, #4]                        |  de54: e58d0004  str r0, [sp, #4]
de58: e30030f8  movw  r3, #248  @ 0xf8                  |  de58: e30030f8  movw  r3, #248  @ 0xf8
de5c: e3423000  movt  r3, #8192 @ 0x2000                |  de5c: e3423000  movt  r3, #8192 @ 0x2000
de60: e58d300c  str r3, [sp, #12]                       |  de60: e58d300c  str r3, [sp, #12]
de64: e59d1004  ldr r1, [sp, #4]                        |  de64: e59d1004  ldr r1, [sp, #4]
de68: e59d000c  ldr r0, [sp, #12]                       |  de68: e59d000c  ldr r0, [sp, #12]
de6c: ebfffe66  bl  d80c <pl011_putc>                   |  de6c: ebfffe66  bl  d80c <pl011_putc>
de70: e59d3004  ldr r3, [sp, #4]                        |  de70: e28dd014  add sp, sp, #20
de74: e1a00003  mov r0, r3                              |  de74: e49df004  pop {pc}    @ (ldr pc, [sp], #4)
de78: e28dd014  add sp, sp, #20                         |
de7c: e49df004  pop {pc}    @ (ldr pc, [sp], #4)        |

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-26 13:21:29 +08:00
anjiahao f4d1f56df7 gdbstub:fix typo
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-24 08:45:21 +08:00
cuiziwei 12fd5ec472 nuttx: Add LIBSUPCXX_TOOLCHAIN to link the prebuilt library provide by toolchain.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-24 01:38:03 +08:00
buxiasen 5c09516a4b lib_gdbstub: fix container of
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-23 20:10:43 +08:00
cuiziwei 7e925dbeaa libxx: C++ low level library select LIBSUPCXX by default.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-23 20:09:16 +08:00
buxiasen cb720024b6 Revert "libc/lib_bzero:Add bzero prototype."
This reverts commit 908814a575.

In macos, memset will be automatic optmize to bzero, caused dead loop, as we not using bzero, macro re-define should ablt to cover the requirements.

Signed-off-by: buxiasen <buxiasen@gmail.com>
2024-10-23 10:08:23 +08:00
yangguangcai f07aba5c1e libc string:Separate code.
Separate the code that follows the BSD license into independent files.

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-10-23 09:49:19 +08:00
ligd cdccce48ac libcxx: fix compile error
from ServiceManager.cpp:17:
/home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/ndk/include_cpp/android/binder_to_string.h:71:24: error: expected nested-name-specifier before numeric constant
   71 |     template <typename _U>
      |                        ^~
/home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/ndk/include_cpp/android/binder_to_string.h:71:24: error: expected ‘>’ before numeric constant
In file included from /home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/aidl/android/os/ConnectionInfo.h:3,
                 from /home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/aidl/android/os/IServiceManager.h:3,
                 from /home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/aidl/android/os/BnServiceManager.h:4:
/home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/ndk/include_cpp/android/binder_to_string.h:72:56: error: no matching function for call to ‘declval<1>()’
   72 |     static auto _test(int) -> decltype(std::declval<_U>().toString(), std::true_type());
      |                                        ~~~~~~~~~~~~~~~~^~
In file included from /home/ligd/platform/dev/nuttx/include/libcxx/__type_traits/is_convertible.h:18,

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-23 09:42:57 +08:00
cuiziwei 35c278b716 libcxx: Ignore compile warnings.
nuttx/libs/libxx/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp:17:4: warning: #warning exception_ptr not yet implemented [-Wcpp]
17 | #  warning exception_ptr not yet implemented
   |    ^~~~~~~

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-21 15:06:42 +02:00
jihandong 444ba4caa4 libcxx: optional localization.
Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-19 14:34:38 +08:00
jihandong 100c43c8c3 libcxx: optional wide characters support.
Disable wchar can reduce approximately 1/3 of the libcxx.
mainly from locale, string and streams.

Platform: sim
Figures: bin size in bytes.

   Size   | Description
----------+------------------------------------------------
 10045336 | Base, enable libcxx whithout any cxx programs.
 42067224 | Add cxxtest.
 29997304 | Disable libcxx wchar support.

Signed-off-by: jihandong <jihandong@xiaomi.com>
2024-10-19 14:34:38 +08:00
zhangbo56 0496984338 libc: Add debug assert to prevent tls allocation failure
So It's easy to find TASK_TLS_ELEM not enough error.

Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
2024-10-18 21:34:18 +08:00
chao an 91cb625f9d memory_region: add static/const for read only instance
Signed-off-by: chao an <anchao@lixiang.com>
2024-10-18 21:32:48 +08:00
chao an d49db03e04 libs/misc/memoryregion: remove unused memory_region
memory region will no longer be used

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-18 21:32:48 +08:00
Tomasz 'CeDeROM' CEDRO 8cc2fbfd00 libc: Fix typo in libc/string/Kconfig.
This typo prevented initial ./tools/configure.sh.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2024-10-18 10:25:07 +02:00
Ville Juven 17c102c10c modlib/modlib_symbols.c: Fix usage of void* arithmetics
In file included from modlib/modlib_symbols.c:34:
modlib/modlib_symbols.c: In function 'modlib_symvalue':
modlib/modlib_symbols.c:432:41: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]
  432 |               (uintptr_t)(sym->st_value + symbol->sym_value));
      |                                         ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:156: bin/modlib_symbols.o] Error 1
2024-10-17 22:54:33 +08:00
yangguangcai fba3967f2f strcpy:skip ubsan check.
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    #2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    #3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    #4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    #5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    #6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    #7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    #8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    #9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    #10 0x48b41eb4 in nxtask_start task/task_start.c:112
    #11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-10-17 22:52:42 +08:00
yangguangcai c113a224e8 newlibc:skip asan check.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-10-17 22:52:42 +08:00
yangguangcai 6e87f11083 Merge the newlibc string into NuttX.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-10-17 22:52:42 +08:00
YAMAMOTO Takashi 4bfde8858d Discourage the use of LIBC_PRINT_EXTENSION
See the discussion in https://github.com/apache/nuttx/pull/13536
2024-10-17 18:08:23 +08:00
Ville Juven e384a6a625 libs/modlib.c: Set VMA for empty and unallocated sections
This fixes issue where empty and unallocated sections are left without
a VMA. Some relocations depend on the section VMA being set even if there
is no data there, as the binary can refer to the symbols. Linker defined
symbols do not contain data -> they can produce empty sections.

This issue is seen when building a loadable file which declares _sctors /
_sdtors linker defined symbols for ctor/dtor sections which are empty.
crt0 references these symbols, so they need to be relocated, but the
section VMA is not set -> they go outside of the addressable range of the
user binary causing a potential crash.
2024-10-17 13:38:01 +08:00
Xiang Xiao 67ed036227 libc: Make getcwd() work even CONFIG_DISABLE_ENVIRON is enabled
since getcwd() can be implemented correctly without using environ

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-16 23:59:07 +08:00
cuiziwei 499de61ec3 libxx: Globally reference the header file of libcxxabi and remove duplication code.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-16 20:05:17 +08:00
yangguangcai 5de562347d libc/memmem:porting open source memmem to Nuttx.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-10-16 18:41:50 +08:00
anjiahao a72e9e5621 modlib:if elf in romfs/tmpfs, try use xipbase
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-16 18:40:06 +08:00
anjiahao 112b6fd9a5 modlib:support modlib can load PIC elf
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-16 18:40:06 +08:00
yinshengkai 6fbe16f40f libs: remove lib_libbsprintf automatic line wrapping
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-16 17:26:14 +08:00
chenjiahua1 c1fb6974ac strptime.c:len is not defined.
Bring all code that uses the variable len under the CONFIG_LIBC_LOCALE

Signed-off-by: chenjiahua1 <chenjiahua1@xiaomi.com>
2024-10-16 17:02:51 +08:00
chenjiahua1 64eecbfede libc/time: add lib_strptime
The community deleted strptime due to license reasons, and we replaced it with musl.

Signed-off-by: chenjiahua1 <chenjiahua1@xiaomi.com>
2024-10-16 17:02:51 +08:00
Bowen Wang 8cfe8a0f3e circbuf: fix circbuf_get_read/writeptr return *size = 0 when circbuf full
In circbuf_get_read/writeptr, when circbuf is full, off == pos, and
*size = off - pos = 0. So add circbuf_is_full() condition to return
correct *size.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-16 16:59:51 +08:00
wangmingrong1 bf70cd2bce bug/fix: Makefile expression error caused
expr: syntax error: unexpected argument "12"
expr: syntax error: unexpected argument "12"

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-16 15:35:04 +08:00
Yongrong Wang 4baec5a248 libs/xxx/CMakeLists.txt: add cmake compile support
Add the lib_bzero.c files to the build use it's API
Add the floating point math C files to the build to use it's API

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-16 12:33:54 +08:00
chenzhijia b63cffe000 libs/libc/unistd:Fix errcode not return normally
Exit the program and return errcode when ioctl fail

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
chenzhijia d52074a9cb libs/libc/unistd: add getspnam function
Add getspnam function to pass tlpi example:
https://man7.org/tlpi/code/online/dist/users_groups/check_password.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
chenzhijia 2a328279ca libs/libc/unistd: add crypt function
Add crypt function to pass tlpi example:
https://man7.org/tlpi/code/online/dist/users_groups/check_password.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
chenzhijia ad70ca33c8 libs/libc/unistd: add getpass function
Add getpass function to pass tlpi example:
https://man7.org/tlpi/code/online/dist/users_groups/check_password.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
chenzhijia c0039d6623 libs/libc/pwd: add new member to passwd struct
Add pw_passwd member to pass tlpi example:
https://man7.org/tlpi/code/online/dist/users_groups/check_password.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
Xiang Xiao 5397a58731 libc/modlib: Make modlib selectable from defconfig
since bootloader may call modlib functions directly
to load elf firmware without binfmt, dlfcn or module.

BTW, this patch also remove the duplicated selecttion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-16 10:11:20 +08:00
liwenxiang1 3fd75efed9 Revert "libs/libc:Openlibm adds exp10 and exp10f function implementations"
This implementation is from glibc, and the license is LGPL

This reverts commit 862244586976b9388f87dc639225d714dd70e4af.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-16 08:03:31 +08:00
raiden00pl c393416580 libs/libxx: uClibc depends on CONFIG_ALLOW_GPL_COMPONENTS=y
uClibc is LGPL so it should depends on CONFIG_ALLOW_GPL_COMPONENTS=y
2024-10-16 07:56:50 +08:00
cuiziwei 9d9857acd2 Change the judgment of GCCVER version to greater equal.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-15 23:32:13 +08:00
anjiahao ae126a8065 lib_stdoutstream:need return write size
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-15 23:30:57 +08:00
likun17 9de0465a8a lib_libvsprintf.c:add option in Kconfig to control "%p*" special format specifier.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-10-15 15:33:13 +08:00