Commit Graph

103 Commits

Author SHA1 Message Date
Kinsey Moore
6bc3ad3ed4 libdl: Add support for LDST128_ABS_LO12_NC 2023-05-22 08:55:47 -05: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
Kinsey Moore
d3662980d0 cpukit/libdl: Add AArch64 TLS reloc support
This adds basic TLS relocation support for AArch64 to libdl. This lets
loadable modules use TLS symbols hosted in the main binary. This does
not allow loadable modules to host their own TLS symbols.
2023-01-20 08:26:35 -06:00
Kinsey Moore
189539f70d cpukit/libdl: Print the missing AArch64 reloc type
This prints the relocation type that was found to be missing in addition
to its address to aid in bug reports.
2023-01-20 08:26:35 -06:00
Kinsey Moore
df0de7810f cpukit/libdl: Use correct mask for reloc type
The mask 0xff is used by ELF32 while ELF64 uses 0xffffffff. These are
automatically selected based on the build type when using ELF_R_TYPE().
2023-01-20 08:26:35 -06:00
Ryan Long
5500232a89 libdl: Refactor shared code in ARM and AArch64
rtl-mdreloc-arm.c was used as the basis for rtl-mdreloc-aarch64.c. This lead
to some code being shared by the two files. The code was consolidated into
rtl-unwind-arm.c.

Closes #4686
2022-08-08 12:02:03 -05:00
Chris Johns
46131ce0e1 libdl: Fix warnings on 64bit architectures
Updates #4662
2022-08-05 07:54:13 +10:00
Ryan Long
1c6ac88f93 cpukit/libdl/rtl-sym.c: Fix increment of variable
In rtems_rtl_symbol_global_add() the loop that gets to the end of the symbol
table used "unsigned long" to increment the index for the table. For most
architectures this resulted in 4, but with AArch64, it results in 8. This
resulted in the symbols being read in wrong. Changing this to void* along with
changing the RISC-V specific code for 8 byte pointers in rtems-tools to work
independent of the architecture.

Updates #4673
Closes #4682
2022-07-29 08:32:47 -05:00
Ryan Long
0bd6514aa2 cpukit/libdl: Add support for AArch64
rtl-mdreloc-aarch64.c and elf_machdep.h came from NetBSD.

Updates #4682
2022-07-29 08:32:47 -05:00
Ryan Long
f643215648 libdl/rtl-elf.h: Fix aarch64 define
The aarch64 define was incorrect. This was causing the libdl tests to not
work correctly.

Updates #4682
2022-07-29 08:32:47 -05:00
Ryan Long
5e0e0675e2 libdl: Manually adding file headers and licenses
These files had no file header, copyright, or license. Chris identified
that these were made by him.

Updates #4521
2022-04-27 15:19:24 -05: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
Joel Sherrill
a50839ffd8 cpukit/libdl/rtl-alloc-check.py: Change to BSD-2 by hand
Updates #3053.
2022-03-22 11:34:23 -05:00
Joel Sherrill
f6385b4edc libdl/rtl-mdreloc-h8300.c: Remove remnant of h8300 port
Updates #2452.
2021-10-08 10:44:44 -05:00
Ryan Long
09d811b8a5 fastlz.c: Unused value (CID #1399751)
CID 1399751: Unused value in fastlz2_compress().

Closes #4341
2021-04-08 17:58:19 -05:00
Aschref Ben Thabet
cbfdcba555 Fix -Wchar-subscripts warnings
The argument to the ctype functions must be an int and the value of the
character must be representable as an unsigned char or equal to the
value of the macro EOF. If the argument has any other value, the
behavior is undefined.
2020-08-20 07:44:33 +02:00
Chris Johns
e9762d74b8 libdl: Add allocator check script
Use with the trace outout to check for allocation leaks.
2020-05-06 18:39:15 +10:00
Chris Johns
b7702c541c libdl/rap: Correctly check the return enum from rela calls
- The change from bool to an enum did not trip a compiler warning
  and only the rel path was changed. The rela path was missed so
  archs like SPARC failed.

Updates #3969
2020-05-05 14:58:27 +10:00
Chris Johns
3635d6a836 libdl/obj-comp: Add trace prints when decompressing
Updates #3969
2020-05-05 14:57:34 +10:00
Chris Johns
d5fc2a6ad6 libdl/obj-cache: Fail if the read offset is past the file length
- The check was for greater than and not equal or greater

Updates #3969
2020-05-05 14:55:34 +10:00
Chris Johns
b77670fd3f libdl/obj: Fix RAP format call table.
Updates #3969
2020-05-05 14:54:39 +10:00
Chris Johns
fe77587c64 libdl/sparc: Print trace message of reloc failture path
Updates #3969
2020-05-05 14:53:53 +10:00
Chris Johns
285cda38e1 libdl: Fix comment.
Updates #3969
2020-05-05 14:53:14 +10:00
Chris Johns
0b41675971 libdl/mips: Fix MIPS16hi/lo relocation support.
This patch is an updated version from:

https://lists.rtems.org/pipermail/users/2016-January/029740.html

Closes #3693
2020-04-28 13:58:20 +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
Hesham Almatary
a4c5da686d riscv: preliminarily support for libdl
Support for targets compiled with -fno-pic and -mno-relax
2019-11-12 10:21:40 +00: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
8c66acc8dc libdl/arm: Add support for ARM trampolines
Closes #3776
2019-08-04 12:32:50 +10:00
Chris Johns
5a678de90c libdl/arm: Fix ARM mode trampoline parsing of relocs
- No need to dump globals syms in test dl01 when tracing

Closes #3775
2019-07-28 09:12:53 +10:00
zhengxiaojun
38b29232fd libdl/rap: fix RAP file load error. 2019-06-12 17:01:27 +10:00
Chris Johns
327e45dac2 libdl: Sort object file symbols and use a binary search to find
- Replace the linear object file symbol search with a binary search.
- Sort the object file symbols after loading.

Closes #3748
2019-05-22 09:28:06 +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
dad6fd4333 libdl: Add an archive command
- The archive command lists archives, symbols and any duplicate
  symbols.
- Change the RTL shell commands to the rtems_printer to allow
  the output to be captured.
2019-03-22 14:16:52 +11:00
Chris Johns
ec1dd51aae libdl: Add small data support to the remaining PowerPC BSPs.
Updates #3687
2019-03-07 06:33:47 +11:00
Chris Johns
c5615ddc0b libdl/unresolved: Fix return value for rtems_rtl_unresolved_remove
Coverity 1399717

Updates #3686
2019-02-20 09:08:38 +11:00
Chris Johns
7aa0530973 libdl/archive: Check for an overflow of the symbol table.
Coverty 1442636

Updates #3686
2019-02-20 09:08:38 +11:00
Chris Johns
62b01ab2d2 libdl/archive: Fix the config file string index while removing tailing white space.
Coverity issue 1442540

Updates #3686
2019-02-20 09:08:38 +11:00
Chris Johns
be62def981 libdl/archive: Return false on read failure.
Coverity issue 1442641

Updates #3686
2019-02-20 09:08:38 +11: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
3ecb207d05 libdl/rap: Add the section alloc call after section load was split
Updates #3687
2019-02-15 10:38:41 +11:00
Chris Johns
e309f7769f libdl: Allocator does not unlock and lock memory on loading.
Close #3692
2019-02-15 09:55:16 +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
e2f13430be libdl: Fix dlerror non-conformance
Closes #3298
2019-02-09 10:06:33 +11:00