Add a minimal implementation to suppress warnings when building
application code shared with other operating systems.
For example:
When building with a c++ compiler and GCC 12.2.0, the following warning is emitted:
nuttx/include/spawn.h:178:40: warning: statement has no effect [-Wunused-value]
178 | #define posix_spawnattr_destroy(attr) (0)
Add support for POSIX interface fmemopen(). This interface open a memory
buffer as a stream and permits access to this buffer specified by mode.
This allows I/O operations to be performed on the memory buffer.
The implementation uses fopencookie() for custom stream operations and
callbacks.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
CPP: nuttx-names.in-> nuttx-names.dat
LD: nuttx
/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: nuttx.rel:/d/a/nuttx_windows/nuttx_windows/nuttxspace/nuttx/libs/libc/stdlib/lib_exit.c:48: multiple definition of `__dso_handle'; /usr/lib/gcc/x86_64-pc-msys/13.2.0/crtbegin.o:cygming-crtbeg:(.data+0x0): first defined here
Silence two warnings when building libcxx with GCC 12.2.0 and std=c++2b:
libcxx/src/charconv.cpp_CXXFLAGS += -Wno-attributes
- Results from libcxx fallback to use __always_inline__ when exclude_from_explicit_instantiation isn't available.
libcxx/src/locale.cpp_CXXFLAGS += -Wno-attributes
- Results from the expansion of _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS. Should be fine to ignore.
CC: icmp/icmp_input.c modlib/modlib_load.c: In function 'modlib_elfsize':
modlib/modlib_load.c:87:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
87 | textaddr = (FAR void *)phdr->p_vaddr;
| ^
cc1: all warnings being treated as errors
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
modlib/modlib_symbols.c: In function ‘modlib_symcallback’:
modlib/modlib_symbols.c:215:13: warning: implicit declaration of function ‘modlib_depend’; did you mean ‘modlib_read’? [-Wimplicit-function-declaration]
215 | ret = modlib_depend(exportinfo->modp, modp);
| ^~~~~~~~~~~~~
| modlib_read
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
CP: nuttx/include/nuttx/config.h
modlib/modlib_init.c:53: warning: "modlib_dumpbuffer" redefined
53 | # define modlib_dumpbuffer(m,b,n) binfodumpbuffer(m,b,n)
|
In file included from modlib/modlib_init.c:36:
nuttx/include/nuttx/lib/modlib.h:64: note: this is the location of the previous definition
64 | # define modlib_dumpbuffer(m,b,n) sinfodumpbuffer(m,b,n)
|
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
__dtoa is not used because currently NuttX uses other
function called __dtoa_engine() to do the same thing
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit adds support for custom stream via fopencookie function.
The function allows the programmer the create his own custom stream
for IO operations and hook his custom functions to it.
This is a non POSIX interface defined in Standard C library and implemented
according to it. The only difference is in usage of off_t instead of
off64_t. Programmer can use 64 bits offset if CONFIG_FS_LARGEFILE is
enabled. In that case off_t is defined as int64_t (int32_t otherwise).
Field fs_fd is removed from file_struct and fs_cookie is used instead
as a shared variable for file descriptor or user defined cookie.
The interface will be useful for future fmemopen implementation.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
both functions aren't suitable to be put into libc,
because they call the kernel internal functions directly.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
When we build NuttX on macOS, it shows many `sed` messages (and the build still completes successfully):
```text
$ tools/configure.sh pinephone:nsh
$ make
sed: illegal option -- r
```
This is due to the Makefiles executing `sed -r` which is not a valid option on macOS.
This PR proposes to change `sed -r` to `sed -E` because:
- `sed -E` on macOS is equivalent to `sed -r` on Linux
- `sed -E` and `sed -r` are aliases according to the GNU `sed` Manual
- `sed -E` is already used in nuttx_add_romfs.cmake, nuttx_add_symtab.cmake and process_config.sh
https://man7.org/linux/man-pages/man2/memfd_create.2.html:
The name supplied in name is used as a filename and will be
displayed as the target of the corresponding symbolic link in the
directory /proc/self/fd/. The displayed name is always prefixed
with memfd: and serves only for debugging purposes. Names do not
affect the behavior of the file descriptor, and as such multiple
files can have the same name without any side effects.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
For programs with the dependencies logic in pthread_once callback , using global locks may cause deadlock:
task A
pthread_once()
|
|-> nxrmutex_lock(&g_lock);
-> init_routine(); // callback to wait task B
task B
pthread_once()
|
->nxrmutex_lock(&g_lock); // Deadlock
->init_routine(); // hold resource to wake up task A
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Domain name has the similar layout as file path, so it's too small
to use 32 bytes as the default value, and better to has the same
default value as PATH_MAX which is 255.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
- Add __config_site for NuttX.
In libcxx 12.0.0. CMake concatenated __config_site with _config,
which enabled NuttX to build without its inclusion. In 15.0.7, this
file is configured by CMake and included explicitly in __config.
- Add additional include directories.
- Mute always_inline warning.
- Make the download of libcxx/libcxxabi configurable
The ipv6 address filled the cache, and the ipv4 address did not have a
place to store it, causing the resolution to fail. so if IPV6 has already
filled the buffer, rewrite ipv4 DNS results from half of the buffer.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
* build-globals.sh
- Only look in the nuttx for external symbols used when loading
dynamic shared objects
* include/elf64.h
- Correct the type of fields in the Elf64_Phdr structure
* libs/libc/dlfcn/lib_dlclose.c
- Distinguish between ET_DYN and other objects as the former
has both text and data in a single allocation to reserve
GOT offsets
* libs/libc/dlfcn/lib_dlopen.c
- Code formatting
* libs/libc/modlib/modlib_bind.c
- Distinguish between relocation entry sizes by section type
- Handle RELA style relocations
* libs/libc/modlib/modlib_globals.S
- Formatting fixes
- Symbols should not be weak - they exist or they don't
* include/nuttx/lib/modlib.h
- Add an inidcator to module_s to distinguish between ET_DYN and other
* libs/libc/modlib/modlib_load.c
- ET_DYN objects need to keep the relative displacement between the text
and data sections due to GOT references from the former to the latter.
This also implies that linking may require modification from the default
for the shared objects being produced. For example, default alignment may
mean nearly 64K of wasted space.
* libs/libc/modlib/modlib_unload.c
sched/module/mod_rmmod.c
- Distingusih between freeing of ET_DYN storage and other as the former
is a single allocation.
* libs/libc/modlib/mod_insmod.c
- Cater for ET_DYN objects having init and preinit sections
VELAPLATFO-16865
Fix warnings:
CC: libmcs/libmcs/libm/common/fenv.c libmcs/libmcs/libm/common/fenv.c:26:15: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int fegetround()
^
void
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
Corresponds to the problem of name resolution with different IP
address types in networks where only one of IPv4 or IPv6 can be
used due to physical layer reasons (e.g., LTE networks).
When we are using newlib as libm, we can consider newlib-esp32 for esp32
hardware. An it contains some optimization for esp32 hardware.
Besides, two small issues has been fixed.
1. add the tar ball to .gitignore
2. Fix the some build warnings
If the gulp size in the stdio buffer the remaining user buffer size it will:
- Corrupt memory in dest (user memory) and
- Keep corrupting KERNEL memory via the stdio character buffer until the
whole system crashes, as the 'remaining' count underflows
This patch fixes this behavior.
To solve the issue of carrying object files from previous builds,
Matias changed the archiving process to re-archive libapps.a on every compilation,
if libapps.a carries more object files, incremental compilation will waste too
many time in re-archiving, compared with the previous implement, this is a degradation
of the build system. Referring to mature engineering projects such as cmake, if there
is configuration or source file changed, the best solution should be to reconfigure
the environment.
Revert this PR to ensure the compilation speed during incremental compilation.
| commit 34b34e2d45 (tag: nuttx-20200914-172150)
| Author: Matias N <matias@protobits.dev>
| Date: Fri Sep 11 22:31:38 2020 -0300
|
| Fix: ensure archive files do not carry object files from prior builds
|
| In some cases, when NuttX configuration changes and this makes the
| object list used to build one of the .a libraries change as well,
| since the command used to build it is "ar crs" and this simply appends
| the list of object files, the library could still include object
| files from prior builds. This commit modifies the ARCHIVE macro to
| erase the .a file if it already exists.
|
| Since in some cases this behavior was actually expected (object
| files from a subdirectory were appended to a library created one
| level above) I added a ARCHIVE_ADD which works as ARCHIVE did.
|
| This change should greatly improve behavior of building after
| configuration changes.
Testing:
sim:nsh
-------------------------------
| Patched | Current
-------------------------------
|$ time make | $ time make
|real 0m1.270s | real 0m1.728s
|user 0m0.971s | user 0m1.276s
|sys 0m0.363s | sys 0m0.530s
-------------------------------
Private project (20+ 3rd library needs archive to libapps.a)
-------------------------------
| Patched | Current
-------------------------------
|$ time make | $ time make
|real 0m21.181s | real 0m39.721s
|user 0m14.638s | user 0m24.837s
|sys 0m6.919s | sys 0m14.394s
-------------------------------
Signed-off-by: chao an <anchao@xiaomi.com>
vfork use waitpid hang father process,
but waitpid release child processs information by default.
So when user call wait, it return errno 10.
Signed-off-by: yangyalei <yangyalei@xiaomi.com>