Commit Graph

33 Commits

Author SHA1 Message Date
zhengxiaojun
4655ceee4d fix dynamic loading error, close #3740. 2024-05-03 18:03:13 +08:00
Chris Johns
b9f11607b1 libdl: Realloc text memory if there are trampolines
- Add resize to the allocator interface

- Rework the trampoline variables in the obj struct
  to make better sense of what is happening

Closes #4944
2023-08-27 07:31:49 +10:00
Chris Johns
27da374e48 libdl: Add support to import base image TLS symbols
This change requires an rtems-tools update for symbol generation.

Working architectures:
 - aarch64
 - arm
 - powerpc
 - sparc

No newlib TLS support but checked:
 - i386
 - m69k

Updates #4920
2023-08-21 11:16:17 +10:00
Kinsey Moore
05dd54d11c cpukit/libdl: Resolve size mismatch warnings
Resolve warnings about mismatched pointer and integer sizes in AArch64
libdl when building with the ILP32 ABI.
2023-04-05 08:19:09 -05:00
Chris Johns
46131ce0e1 libdl: Fix warnings on 64bit architectures
Updates #4662
2022-08-05 07:54:13 +10:00
Joel Sherrill
5dec08934f cpukit/libdl: Manual file header reordering (SPDX, Doxygen, Copyright)
Updates #3053.
2022-03-22 11:34:23 -05:00
Joel Sherrill
5a65257d0c cpukit/libdl Change license to BSD-2
Updates #3053.
2022-03-22 11:34:23 -05:00
Chris Johns
285cda38e1 libdl: Fix comment.
Updates #3969
2020-05-05 14:53:14 +10:00
Sebastian Huber
80cf60efec Canonicalize config.h include
Use the following variant which was already used by most source files:

  #ifdef HAVE_CONFIG_H
  #include "config.h"
  #endif
2020-04-16 07:30:00 +02:00
Chris Johns
9cb19ded5c libdl/debugger: Fix the broken list delete when unloading an object module.
Closes #3777
2019-08-12 08:49:33 +10:00
Chris Johns
d0f627d894 libdl: Fix size bug in loading symbols.
This was introduced in 74883be5d4.

Updates #3746
2019-05-14 10:15:51 +10:00
Chris Johns
74883be5d4 libdl: Fix loading symbol that reference unknown sections.
- Make the symbol parsing and loading stage match.
- Check for possible overflow of the tables when loading.

Closes #3746
2019-05-14 08:54:19 +10:00
Chris Johns
b36c52097f libdl: Do not access the ELF file while the allocator is locked.
- Load symbols before allocation.
- Parse reloc records and place any reloc recs in a cache to use
  while the allocator is locked.
- Relocate symbols after section allocation.
- Split section loading into allocation/locating and loading.
- Update all arch back-ends with a new reloc interface to control
  tramp handling.
- Add `-a` and `-t` to the object list shell command.

Closes #3741
2019-05-03 10:15:20 +10:00
Chris Johns
22afb03411 libdl/alloc: Add a locking interface to the allocator.
- Allow an allocator to lock the allocations. This is needed to
  lock the heap allocator so the text and trampoline table are
  as close together as possible to allow for the largest possible
  object file size.

- Update the default heap allocator to lock the heap allocator.

- Update ELF loading to lock the allocator.

Updates #3685
2019-02-20 09:08:14 +11:00
Chris Johns
6c9f0176a9 libdl: Add powerpc large memory and small data support.
- Add support for architecure sections that can be handled by the
  architecture back end.

- Add trampoline/fixup support for PowerPC. This means the PowerPC
  now supports large memory loading of applications.

- Add a bit allocator to manage small block based regions of memory.

- Add small data (sdata/sbss) support for the PowerPC. The support
  makes the linker allocated small data region of memory a global
  resource available to libdl loaded object files.

Updates #3687
Updates #3685
2019-02-09 10:06:34 +11:00
Chris Johns
194eb403c3 libdl: Add support for large memory programs
- Add trampolines to support relocs that are out of range on
  support architectures.

- Support not loading separate text/data sections in an object
  file if the symbol provided in the section is a duplicate.
  A base image may have pulled in part of an object and another
  part needs to be dynamically loaded.

- Refactor the unresolved handling to scale to hundreds of
  unresolved symbols when loading large number of files.

Updates #3685
2019-02-09 10:06:34 +11:00
Chris Johns
d8c70ba65b libdl: Add support for trampolines
- Trampolines or fixups for veneers provide long jump support
  for instruciton sets that implement short relative address
  branches. The linker provides trampolines when creating a
  static image. This patch adds trampoline support to libdl
  and the ARM architecture.

- The dl09 test requires enough memory so modules are outside
  the relative branch instruction ranges for the architecture.

Updates #3685
2019-02-09 10:06:34 +11:00
Chris Johns
4408603e27 libdl: Fix the support for constructors and desctructors.
- Fix the handling of pending objects.
- Add a constructor flags in objects to track then being called.

Closes #2921
2019-02-09 10:06:34 +11:00
Chris Johns
89c59be38d libdl: Add symbol searching and loading from archives.
- Load archive symbol tables to support searching of archives
  for symbols.
- Search archive symbols and load the object file that contains
  the symbol.
- Search the global and archives until all remaining unresolved symbols
  are not found. Group the loaded object files in the pending queue.
- Run the object file and loaded dependents as a group before adding to the
  main object list.
- Remove orphaned object files after references are removed.

Updates #3686
2019-02-09 10:06:34 +11:00
Chris Johns
03139d5b1c libdl: Add object file dependencies to track references
Tracking references lets us manage when an object file can be
unloaded. If an object file has references to it, it cannot be
unloaded.

Modules that depend on each other cannot be unloaded.

Updates #3605
2018-11-22 12:43:31 +11:00
Chris Johns
803eac954e libdl: Manage the allocation of common uninitialised variables.
The use of separate text and data results in uninitialised variables
being placed in the common section. There is no section in ELF for
the common variables so the loader needs to create the section and
allocate the variables in that section. This patch does that.

The patch adds a second pass over the symbols.

The issue can also be seen as a section 65522 error.

Updates #3604
2018-11-22 12:43:21 +11:00
Chris Johns
f59d435d16 libdl: Remove _t from all structures as this is reserved for the standards 2018-04-12 17:57:40 +10:00
Sebastian Huber
990adc5438 libdl: Include <rtems/rtl/rtl-*.h>
Prepare for header file move to common include directory.

Update #3254.
2017-12-13 09:04:26 +01:00
Sebastian Huber
8bdbefedd5 libdl: Fix warnings
Update #3155.
2017-10-06 09:43:17 +02:00
Chris Johns
bba48d90bc libdl: Support link ordered loading of ELF sections.
The ARM C++ exception ABI uses an address ordered index table to
locate the correct frame data and this requires the EXIDX sections are
loaded in the order the order the matching text is loaded.

The EXIDX sections set the SHF_LINK_ORDER flag and link field. This patch
adds support to load those flagged sections in the linked-to section
order.

Updates #2955.
Closes #2959
2017-03-31 09:00:14 +11:00
Chris Johns
c6eead1353 libdl: Add C++ exception support to loaded modules.
This has been tested on SPARC, i386, PowerPC and ARM.

Closes #2767.
2016-12-14 09:07:16 +11:00
Chris Johns
75386e1131 libdl: Add trace output when reading section headers. 2016-08-15 15:41:52 +10:00
Pavel Pisa
8709aa0459 libdl/rtl-obj.c: synchronize cache after code relocation.
Memory content changes caused by relocation has to be
propagated to memory/cache level which is used/snooped
during instruction cache fill.

Closes #2438
2016-07-21 02:35:00 +02:00
Sebastian Huber
d4edbdbcbf Replace www.rtems.com with www.rtems.org 2015-03-20 15:42:34 +01:00
Chris Johns
580466cc9c libdl: Update comment with details about the error fix.
See refs #2192.
2014-11-20 13:52:12 +11:00
Chris Johns
fc523ac869 libdl: Fix possible 16-bit overflow (Coverity 1255339) refs #2192.
On a 16-bit target the section value could result in a sign-extension
overflow.
2014-11-20 10:18:16 +11:00
Chris Johns
a2e1e30d98 libdl: Add a local symbol table to the object module.
Adding a local symbol lets the relocator find local symbols referenced
in relocation records. The local symbol table is erased once the object
module has been loaded.
2014-11-04 12:12:25 +11:00
Chris Johns
ae5fe7e6bc cpukit: Add libdl with the Runtime Loader (RTL) code.
This is a merge of the RTL project.
2014-10-31 11:04:15 +11:00