Commit Graph

291 Commits

Author SHA1 Message Date
Xiang Xiao cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
chao.an a07ad7a115 binfmt/exec: fix build break in kernel build 2020-02-22 14:32:54 -06:00
chao.an c06adf06b8 binfmt/exec: Make the spawn attribute take effect 2020-02-20 08:55:14 -06:00
YAMAMOTO Takashi 882c82a038 Fix typos in comments 2020-02-12 14:07:56 +01:00
Xiang Xiao a8de37fbec Ensure all source code end with one and only one newline
by this command:
git ls-files -z | while IFS= read -rd '' f; do tail -c1 < "$f" | read -r _ || echo >> "$f"; done
2020-02-08 07:25:56 -06:00
Masayuki Ishikawa 81f1133174 ELF64 support (#220)
* include: Introduce elf64.h and elf.h

    Added elf64.h for 64bit ELF support and moved common definitions
    from elf32.h to elf.h. Also introduced Elf_xxx to be used in
    common libraries such as binfmt.

  * binfmt, include, modlib, module: Add support for ELF64

    Elf_xxx must be used instead of Elf32_xxx to support ELF64.
    To use ELF64, CONFIG_ELF_64BIT must be enabled.

  * binfmt, modlib: Add support for relocate address

  * arch: risc-v: Add include/elf.h

  * libs: machine: Add risc-v related files.

    NOTE: Currently only supports ELF64

  * boards: maix-bit: Add elf and posix_spawn configurations

  * boards: maix-bit: Add support for module configuration
2020-02-07 17:10:23 -06:00
YAMAMOTO Takashi 342b56ae8b Revert "A workaround for macOS linker"
Unnecessary after "sim: Add -fno-common to KERNEL ARCHCPUFLAGS"

This reverts commit cc90d586c0.
2020-02-05 00:36:58 -08:00
Xiang Xiao 68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
YAMAMOTO Takashi cc90d586c0 A workaround for macOS linker
It seems that "ld -r" on macOS doesn't include objects from
libraries for common symbols. Because of that, sim build
ends up with undefined references to globals like g_binfmts
and g_mmheap.

	@(#)PROGRAM:ld  PROJECT:ld64-530
	BUILD 18:57:17 Dec 13 2019
	configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
	LTO support using: LLVM version 11.0.0, (clang-1100.0.33.17) (static support for 23, runtime is 23)
	TAPI support using: Apple TAPI version 11.0.0 (tapi-1100.0.11)
2020-01-29 09:03:48 +01:00
minabeoki 65ff48f7be fix typo berr messages in binfmt_execmodule.c 2020-01-26 07:03:30 -06:00
Xiang Xiao f8bcd58be2 Fix format warn (#96)
* fix warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int'
* fix warning: implicit declaration of function 'up_init_exidx'
2020-01-13 16:41:09 -06:00
Gregory Nutt dd5748cee8 binfmt/: Update copyright dates in all modified files. 2020-01-11 13:44:58 -03:00
Gregory Nutt 7a72d1e8ca binfmt/: Run all .c files under binfmt/ through tools/nxstyle and fix all resulting complaints. 2020-01-11 13:44:58 -03:00
Gregory Nutt 9d5d60fee1 Run all .c and .h files in last PR49 through nxstyle. 2020-01-07 09:54:35 -06:00
Alin Jerpelea a8d63c0cec various fixes (#49)
* libs: libc: math: Fix tanh() math functions
* drivers: mtd: smart: Fix trivial debug message in smartfs
* binfmt: libelf: Fix fd not closed on error
* binfmt: Fix stack memory leak on error
* fs: romfs: Fix private data not free on error
* sched: group: Fix reference after free memory
* sched: clock: Fix clock sync

Fix clock sync when CONFIG_RTC_HIRES is enabled
2020-01-07 09:06:02 -06:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Gregory Nutt 677b0bf47e Remove all support for the ancient Pascal compiler and pcode interpreter. 2019-11-21 06:58:38 -06:00
Xiang Xiao 2d794f4102 Configuration: Auto-select CONFIG_BUILD_LOADABLE when either CONFIG_BUILD_KERNEL or CONFIG_BINFMT_LOADABLE is selected. 2019-09-30 06:57:16 -06:00
Juha Niskanen e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Gregory Nutt 2925c28f8f All linker scripts: Preface all _edata defininitions with . = ALIGN(4). Otherwise, the last bytes in the .data section may not be initialized properly. Also convert all linker scripts indent in units of 8-spaces to units of 4-spaces. 2019-09-15 17:22:16 -06:00
Gregory Nutt 254a906409 libs/libc/builtin/: builtint_isavail() should not set the errno variable because this functions may be used by internal OS logic for which setting the rrno variable would be inappropriate. 2019-09-11 12:37:29 -06:00
Michael Jung 4227d2aaa5 binfmt/: Fix FLAT build with BUILTIN support. Fixes problems introduced in a recent commit. 2019-08-25 08:58:30 -06:00
Gregory Nutt dd97fb991b This commit moves shared builtin information out of binfmt/libbuiltin and into libs/libc/builtin where it can be shared. This should permit builtin application in the PROTECTED build where binfmt/libbuiltin is not available in user space.
Squashed commit of the following:

    Correct some additional compile-related issues.

    Move  include/nuttx/binfmt/builtin.h to include/nuttx/lib/builtin.h.  Move apps/builtin/lib_builtin_forindex.c to libs/libc/builtin/lib_builtin_forindex.c.

    Move binfmt/libbuiltin to libs/libc/builtin.  There are calls made directly from apps/nshlib into this logic and hence, must be part of a library that can be shared between the OS and applications.
2019-08-23 09:07:40 -06:00
Pavel Pisa 04f0ee5198 binfmt/: Change debug macro from berr() to binfo() when dumping module data. The report of problems is important during development but when it enables complete informative output about load binaries then the important information can be easily overlooked. The huge output sent to serial terminal slows loading significantly as well. 2019-08-15 14:41:42 -06:00
Gregory Nutt 721994846c tools/: Change preferred argument of configurations tools to use ':' as the delimiter between <board-name> and <config-name>. This is to emphasize that this is not a path; it is configuration specification.
The legacy '/' delimiter is still supported but not recommend and not advertised.

Squashed commit of the following:

    Update configurations instructions in more README.txt files to show ':' delimiter vs '/' delimiter.
    Update configurations instructions in various README.txt file to show ':' delimiter vs '/' delimiter.
    tools:  Update all configuration-related tools to accept ':' separator between board and configuration name.
2019-08-05 16:55:51 -06:00
Gregory Nutt da1a561b6e binfmt/libelf/libelf_bind.c: Make naming of internal type compliant with coding standard. Yes, the ELF32 types do not follow the standard for historical reasons (and will be fixed someday), but let's not perpetuate the naming violation. 2019-03-20 09:34:08 -06:00
Xiang Xiao 64252a298f arch/: Unify the cache interface for all architectures 2019-03-19 10:37:13 -06:00
anchao 6e69dba341 binfmt/libelf/ and libs/libc/modlib: Add symbol buffer table to reduce filesystem access. 2019-03-19 09:13:50 -06:00
anchao 2f2d432f7c binfmt/libelf and libs/libc/modlib: Add relocation buffer table to reduce access fs. 2019-03-19 08:57:13 -06:00
Valmantas Palikša 956175d9b1 binfmt/libnxflat/libnxflat_init.c: File descriptor leaks when nxflat loading fails 2019-03-19 07:00:54 -06:00
Gregory Nutt ba859ad302 tools/nxstyle.c: Don't complain about certain lowercase characters in otherwise uppercase pre-processor identifers: IPv6, IPv4, ICMPv6, IGMPv2, p as a decimal point, d signifying a divisor. It was a bad idea to let the door open a crack for there. While they improve readability, the inconsistently also causes other problems. 2019-03-12 14:22:52 -06:00
Gregory Nutt 82b276a34c binfmt/nxflat.c: Trivial design simplification. 2019-03-12 10:09:03 -06:00
Gregory Nutt 622202da20 binfmt/nxflat.c: Update to last NxFLAT change: The logic must respect the reference count before freeing the dspace memory region. 2019-03-12 09:44:18 -06:00
Valmantas Palikša ba8714daac binfmt/nxflat.c: Correct a double free debug assertion. This occurs when groups are enabled: (1) once via binfmt_exit and unload_module, and (2) once via sched_releasetcb(). this was corrected by adding logic to free/unload the memory once and nullify the pointer so that cannot be freed a second time. This commit resolves Bitbucket issue #145. 2019-03-12 09:44:04 -06:00
Gregory Nutt a64869aa67 CONFIG_NFILE_DESCRIPTORS=0 can no longer be used to disable the file system. NuttX with no file system does not make sense.
Squashed commit of the following:

    configs/:  The few configurations that formerly set CONFIG_NFILE_DESCRIPTORS=0 should not default, rather they should set the number of descriptors to 3.
    fs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    tools/:  Tools updates for changes to usage of CONFIG_NFILE_DESCRIPTORS.
    syscall/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    drivers/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NFILE_DESCRIPTORS == 0
    binfmt/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    arch/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/Kconfig:  CONFIG_NFILE_DESCRIPTORS may no longer to set to a value less than 3
    configs/:  Remove all settings for CONFIG_NFILE_DESCRIPTORS < 3
2019-02-11 12:09:26 -06:00
Gregory Nutt bb623d1e04 This commit renames all internal OS functions defined under sched/task so that they begin with the prefix. For example, nxtask_exit() vs. task_exit().
Squashed commit of the following:

    Trivial, cosmetic
    sched/, arch/, and include:  Rename task_vforkstart() as nxtask_vforkstart()
    sched/, arch/, and include:  Rename task_vforkabort() as nxtask_vforkabort()
    sched/, arch/, and include:  Rename task_vforksetup() as nxtask_vfork_setup()
    sched/:  Rename notify_cancellation() as nxnotify_cancellation()
    sched/:  Rename task_recover() to nxtask_recover()
    sched/task, sched/pthread/, Documentation/:  Rename task_argsetup() and task_terminate() to nxtask_argsetup() and nxtask_terminate(), respectively.
    sched/task:  Rename task_schedsetup() to nxtask_schedsetup()
    sched/ (plus some binfmt/, include/, and arch/):  Rename task_start() and task_starthook() to nxtask_start() and nxtask_starthook().
    arch/ and sched/:  Rename task_exit() and task_exithook() to nxtask_exit() and nxtask_exithook(), respectively.
    sched/task:  Rename all internal, static, functions to begin with the nx prefix.
2019-02-04 13:42:51 -06:00
Gregory Nutt c17145e550 Revert "binfmt/libelf/libelf_load.c: Remove the guard(CONFIG_BUILD_KERNEL) for umm_initialize()"
This commit has to be reverted because it causes errors in build testing.

This reverts commit b9c7a9a18f.
2019-02-03 18:08:46 -06:00
Xiang Xiao b9c7a9a18f binfmt/libelf/libelf_load.c: Remove the guard(CONFIG_BUILD_KERNEL) for umm_initialize() 2019-01-28 06:19:48 -06:00
Gregory Nutt 78c8485b0d Fix some warnings found in build testing. 2019-01-27 17:23:01 -06:00
Gregory Nutt 6e64b05ef3 Update some Kconfig comments. 2019-01-26 13:34:01 -06:00
Xiang Xiao b7f958a02e binfmt/, binfmt/libelf: binfmt/elf: Call umm_initialize as soon as possible otherwise elf_loadctors/elf_loaddtors will fail to allocate memory. 2019-01-26 11:36:38 -06:00
Xiang Xiao 0edcd6b85e binfmt/libelf, libs/libc/modlib: Optimize elf load speed: (1) Don't zero out memory, (2) Reduce the initial buffer size to 32 bytes. 2019-01-26 11:34:40 -06:00
Xiang Xiao 264a7164bc binfmt/: If there is an address environment (CONFIG_ARCH_ADDRENV), binfmt/elf doesn't need to free ctor/dtor alloc since freeing the address environment releases the heap automatically. 2019-01-26 11:29:08 -06:00
Xiang Xiao 38ffb98f1b Kconfig files, binfmt/libelf, libs/libc/machin, libs/libxx: Correct libcxx exception handling by introducing the generic config(CXX_EXCEPTION and CXX_LIBSUPCXX) 2019-01-26 11:23:31 -06:00
Xiang Xiao 095e28d45e binfmt/, binfmt/libelf/, include/nuttx, libs/libc/machine, libs/libc/modlib, and others: Move elf related arch function to include/nuttx/elf.h because the implementation is located in libs/libc/machine and in order to avoid the conflict with the 3rd party libraries and clean up the file inclusion: (1) Remove redundant elf32.h, (2) Remove nuttx/binfmt/elf.h in libs/libc/machine, (2) Remove nuttx/binfmt/elf.h in modlib, and (4) Rmove nuttx/module.h in modlib. 2019-01-26 11:18:45 -06:00
nchao 6509a0c0ca binfmt/ and libs/libc: Make exepath_*() more common:
1. Move exepath_*() related code to libc/misc
  1. Rename exepath_ to envpath_
  2. Rename BINFMT_EXEPATH to LIB_ENVPATH

libs/libc/modlib:  Add pre module library symbol table support
2018-11-08 07:27:14 -06:00
Gregory Nutt a83b6d990b Replace callse to ioctl() in the OS to file_ioctl() 2018-09-15 11:47:24 -06:00
Gregory Nutt a7fd58c4db Squashed commit of the following:
many locations:  Change occurences of open() followed by file_detach() to file_open().  Change most non-controversion calls to open() to nx_open().

    fs/inode/fs_fileopen.c:  Flesh out file_open() with some interim, placeholder logic.

    fs/inode/fs_fileopen.c:  Add a framework for a file_open() implementation (no real logic in place yet).

    fs/vfs/fs_open.c:  Add nx_open() which is the same as open() except that it does not create a cancellation point nor does it modify the errno variable.
2018-09-15 10:49:41 -06:00
Gregory Nutt 9546481054 Fix some typographical errors. 2018-09-14 06:55:45 -06:00