Xiang Xiao
85c1354043
binfmt/elf: Don't close filfd in the fail path
...
to avoid close the same handle twice because
the caller also call elf_uninit in this case
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iddcbae9587d11d3b5b06e876d4a037ac0d11992e
2021-05-12 21:09:29 -07:00
Byron Ellacott
c9db653c8d
symtabs: improve handling of symbol lookups
...
When CONFIG_SYMTAB_ORDEREDBYNAME is selected most code will use
the ordered search function. When it is not selected no code will
use the ordered search function. This change merges the two
functions and varies its behaviour based on the config setting,
such that all callers can simply call the one search function
and get the best behaviour.
An additional configuration option allows leading underscores to
be stripped from symbols being relocated in loaded objects. This
allows toolchains which prefix C symbol with underscores to make
loadable ELF objects.
2021-03-16 10:18:17 -07:00
Abdelatif Guettouche
d85c432278
Few typos fixes in binfmt and libc/machine.
...
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-03-11 10:35:40 +08:00
Gustavo Henrique Nihei
330eff36d7
sourcefiles: Fix relative path in file header
2021-03-09 23:18:28 +08:00
Alin Jerpelea
f9fb182809
Author: Gregory Nutt: update licenses to Apache
...
Update files from Gregory Nutt to Apache 2.0 license.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-05 12:15:56 -03:00
Xiang Xiao
0536953ded
Kernel module should prefer functions with nx/kmm prefix
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 08:57:58 +01:00
YAMAMOTO Takashi
85f38b01c1
binfmt/libelf/libelf_dtors.c: Fix a syslog format
2020-11-27 05:18:57 -06:00
YAMAMOTO Takashi
44e61d7fe7
binfmt/libelf/libelf_ctors.c: Fix a syslog format
2020-11-27 05:18:57 -06:00
YAMAMOTO Takashi
d068713738
binfmt/libelf/libelf_symbols.c: Fix syslog formats
2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
148ee150f0
binfmt/libelf/libelf_bind.c: Fix syslog formats
2020-11-21 19:38:32 -08:00
Xiang Xiao
2b7528feae
binfmt: Fix warning: unused variable ‘exidx’
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I55d3355813b8b24727e2a7f78fcd72622a1e6758
2020-07-21 00:03:47 -07:00
Xiang Xiao
fbfd9d62da
libelf: Parse .ARM.exidx only for ARM architecture
...
since other arch has the different unwind approach
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icefa0d4bc31bff967372949216d337770cd7e768
2020-07-11 10:34:22 -07:00
Alin Jerpelea
7ddf7c6c25
binfmt: nxstyle fixes
...
small nxstyle fixes for binfmt to avoid CI warnings
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-04-22 14:07:04 -06:00
YAMAMOTO Takashi
24c9fa3cd9
Kconfig: Move ELF_64BIT out of !BINFMT_DISABLE
...
Because it's also used by LIBC_MODLIB.
2020-03-27 00:04:36 -05:00
YAMAMOTO Takashi
bb09d564db
libelf: Don't truncate 64-bit values
2020-03-27 00:04:36 -05:00
YAMAMOTO Takashi
f8077022bd
Introduce CONFIG_DEFAULT_TASK_STACKSIZE
...
* The appropriate size of stack varies among archs.
E.g. for 64-bit sim, 2048 is way too small, especially when the task
happens to use host OS functionalities.
I plan to allow an arch provide its own default.
* I plan to use this to replace hardcoded "STACKSIZE = 2048" in APPDIR.
2020-03-26 22:30:13 -05:00
YAMAMOTO Takashi
8ad9d1e0b4
libelf: Appease nxstyle complaints
...
Also, fix a minor typo.
2020-03-26 02:51:34 -05:00
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
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
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
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
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
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
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
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
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
3521aaf944
Squashed commit of the following:
...
binfmt/, configs/, grahics/, libc/, mm/, net/, sched/: OS references to the errno variable should always use the set_errno(), get_errno() macros
arch/arm/src/stm32 and stm32f7: Architecture-specific code is not permitted to modify the errno variable. drivers/ and libc/: OS references to the errno variable should always use the set_errno(), get_errno() macros
2018-01-30 17:57:36 -06:00
Gregory Nutt
181875f3ba
fs/vfs: Add new internal OS interface nx_read(). nx_read() is functionally equivalent to read() except that it does not modify the errno variable and it is not a cancellation point. Changed all references to read() in the OS to nx_read().
2017-10-11 12:13:41 -06:00
Cristian Condurache
2ea054fead
Merged in ccondurache/nuttx/fix_elf_arm_checkarch (pull request #422 )
...
Fix ELF loader up_checkarch on ARM arch
Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-06-28 16:19:51 +00:00
Cristian Condurache
d4add14823
Fix ELF loader up_checkarch on ARM arch
2017-06-28 18:11:39 +03:00
Yasuhiro Osaki
b1008477ac
binfmt: Fix .dtor memory allocation
...
Jira: PDFW15IS-265
Coverity-ID: 11053
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2017-05-19 17:01:48 +09:00
Yasuhiro Osaki
c109e92962
binfmt: Fix offset value when calling elf_read() in elf_sectname()
...
Jira: PDFW15IS-3030
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2017-04-28 17:23:02 +09:00
Yasuhiro Osaki
dd2efb909a
binfmt: Fix offset value when calling elf_read() in elf_symname()
...
Jira: PDFW15IS-1650
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2017-04-26 14:46:34 +09:00
Gregory Nutt
3fa41c0f18
Kconfig files: Fix some dependencies that have CONFIG_ in the variable name
2016-06-17 19:30:19 -06:00
Gregory Nutt
a1469a3e95
Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err()
2016-06-11 15:50:49 -06:00
Gregory Nutt
1cdc746726
Rename CONFIG_DEBUG to CONFIG_DEBUG_FEATURES
2016-06-11 14:14:08 -06:00
Gregory Nutt
fc3540cffe
Replace all occurrences of vdbg with vinfo
2016-06-11 11:59:51 -06:00
Gregory Nutt
3a74a438d9
Rename CONFIG_DEBUG_VERBOSE to CONFIG_DEBUG_INFO
2016-06-11 11:50:18 -06:00
Gregory Nutt
05cb7a9043
Call initializer entry point on start-up; do not create a task
2015-12-11 07:27:45 -06:00
Gregory Nutt
45eebacbb4
binfmt/: More spacing/alignment fixes
2015-10-08 19:20:17 -06:00
Gregory Nutt
342f5fe33d
Fix references to the no-longer-existent misc/ directory in comments, README files, and documentation
2015-06-28 08:08:57 -06:00
Gregory Nutt
c704a5289c
Comment out references to fstat(). It is not yet supported.
2015-06-02 11:43:44 -06:00
Gregory Nutt
6068820bf3
Add support uClibc++ excpetions. This involves additional handling for relative relation types, additional support for unwinding, as well as additional changes. The culmination of a big effort fromo Leo Aloe3132
2015-06-01 14:16:18 -06:00
Gregory Nutt
56dee97fbf
Fix a misnamed symbol in a linker script. I don't think that this symbol is used
2015-05-04 13:45:24 -06:00
Gregory Nutt
916ccc78bb
binfmt: Fix a debug statement that does not have the correct number of arguments. From Leo aloe3132
2015-04-30 14:31:04 -06:00
Gregory Nutt
48271cca05
Make some file section headers more consistent with standard
2015-04-08 08:29:03 -06:00
Gregory Nutt
179fabb019
Add description of work queues to the porting guide. Update comments
2014-10-14 10:21:18 -06:00
Gregory Nutt
dd9e42ec0c
Fix a compile problem noted by Marco Cruz
2014-10-13 12:07:40 -06:00
Gregory Nutt
2311a97ad6
Remaining files under nuttx/binfmt changed to use the corrected syslog interfaces
2014-10-08 15:34:51 -06:00
Gregory Nutt
dadbbb8ac5
Fix some misleading debug output
2014-09-26 14:58:03 -06:00
Gregory Nutt
1329c29ecd
ELF: Critical bugfix.. BSS was not being cleared
2014-09-12 10:32:23 -06:00
Gregory Nutt
205c23b9d6
Add logic to initialize the per-process user heap when each user process is started
2014-09-10 15:55:36 -06:00
Gregory Nutt
c458e72b70
ELF relocations. Some relocation types do not have a named symbol associated with them. The design did not account for that case
2014-09-09 16:52:51 -06:00
Gregory Nutt
b63eea45b6
Improved binfmt debug output
2014-09-07 13:47:01 -06:00
Gregory Nutt
39c95050ab
Fix typo in ELF variable name (only see it when C++ support is enabled)
2014-09-07 13:46:13 -06:00
Gregory Nutt
205260d5e2
Reanem kzalloc to kmm_zalloc for consistency
2014-08-31 17:34:44 -06:00
Gregory Nutt
1780810d3d
Rename kmalloc to kmm_malloc for consistency
2014-08-31 17:26:36 -06:00
Gregory Nutt
54fa3b0b59
Rename kfree to kmm_free for consistency with other naming conventions
2014-08-31 17:04:02 -06:00
Gregory Nutt
9aca0c1c84
Rename kumalloc to kumm_malloc and kuzalloc to kumm_zalloc for consistency with other naming
2014-08-31 16:24:24 -06:00
Gregory Nutt
9ad7dae4c1
Rename kufree to kumm_free for consistency with other naming
2014-08-31 16:15:11 -06:00
Gregory Nutt
9cd1ddada4
Rename kmemalign to kmm_memalign and krealloc to kmm_realooc for consistency with other naming
2014-08-31 15:27:37 -06:00
Gregory Nutt
0db7da1858
Add up_addrenv_coherent which will be called before address environment switches
2014-08-26 14:53:19 -06:00
Gregory Nutt
d52599fe8e
Change when address environment is instantiated; there are/were locations where access is made to the allocation address environment when it is not yet in place
2014-08-26 07:57:30 -06:00
Gregory Nutt
66a5328a68
Cortex-A address environment: Fix some section mapping and address increments
2014-08-26 06:33:26 -06:00
Gregory Nutt
1725946447
Misc changed to get the SAMA5 ELF configuration with address environments working
2014-08-25 13:28:13 -06:00
Gregory Nutt
e0a48b60b6
Change naming of ELF interfaces from arch_ to up_ for consistency
2014-08-25 06:47:14 -06:00
Gregory Nutt
7aea220ebf
After cached related fix, the ELF example is now functional
2014-08-24 14:12:45 -06:00
Gregory Nutt
1708a133f5
Fix some compilation errors in ELF logic that were introduced in a recent commit
2014-08-24 12:57:02 -06:00
Gregory Nutt
241a7e17bd
addrenv interface changes: up_addrenv_create() may need to create .text and .bss/.data separately because of differing access privileges (read/execute vs read/write). And, as a consequence, up_addrenv_vaddr() needs to be split into up_addrenv_vtext(0 and up_addrenv_vdata().
2014-08-24 11:54:14 -06:00
Gregory Nutt
1624e2fbcf
Change CONFIG_ADDRENV to CONFIG_ARCH_ADDRENV; change how it is selected -- the architecure must first declare support
2014-08-24 06:42:11 -06:00
Gregory Nutt
b6f264488a
BINFMT: A framework to support a P-code binary format (a work in progress)
2014-05-07 13:47:52 -06:00
Gregory Nutt
f8024cf409
More trailing whilespace removal
2014-04-13 16:22:22 -06:00
Gregory Nutt
303cc1902b
Make sure that there is one space between if and condition
2014-04-12 12:53:19 -06:00
Gregory Nutt
91b002a043
Many changes to reduce complaints from CppCheck. Several latent bugs fixes, but probably some new typos introduced
2014-02-10 18:08:49 -06:00
Gregory Nutt
bc46b447dc
Fix all occurrences of "the the" in documentation and comments
2013-08-27 09:40:19 -06:00
patacongo
1c52dce216
More changes for a kernel-mode allocator (more to be done)
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5724 42af7a65-404d-4744-a932-0658087f49c3
2013-03-09 21:12:20 +00:00
patacongo
ad430fc198
Add syslog.h; rename lib_rawprintf() to syslog()
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5578 42af7a65-404d-4744-a932-0658087f49c3
2013-01-28 21:55:16 +00:00
patacongo
2545f5c1a9
Verify PATH variable in apps/examples/elf
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5445 42af7a65-404d-4744-a932-0658087f49c3
2012-12-19 22:18:30 +00:00
patacongo
a160442b78
Incorporate address environment interfaces in binfmt/ logic
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5443 42af7a65-404d-4744-a932-0658087f49c3
2012-12-19 17:54:26 +00:00
patacongo
08404c8492
Add documentation for the binary loader
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5278 42af7a65-404d-4744-a932-0658087f49c3
2012-10-30 14:32:52 +00:00
patacongo
948b57f2af
C++ static destructors work with ELF load too now
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5274 42af7a65-404d-4744-a932-0658087f49c3
2012-10-29 20:43:35 +00:00
patacongo
ef6dcd6f90
C++ constructors work with ELF load now
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5273 42af7a65-404d-4744-a932-0658087f49c3
2012-10-29 19:32:05 +00:00
patacongo
0f70f8c9e1
Finish implemention of ELF loader static constructor support. Still some issues.
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5272 42af7a65-404d-4744-a932-0658087f49c3
2012-10-29 00:52:23 +00:00
patacongo
2fc26f191d
The ELF loader is basically functional (needs more testing)
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5265 42af7a65-404d-4744-a932-0658087f49c3
2012-10-27 00:04:47 +00:00
patacongo
49ed90be32
ARM and ARMv7-M ELF support; STM32F4Discovery ELF loader test configuration
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5264 42af7a65-404d-4744-a932-0658087f49c3
2012-10-26 19:53:20 +00:00