Comments (3)
Taking the Linux kernel's linker as a reference point - relevant parts being:
- https://github.com/torvalds/linux/blob/a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6/kernel/module/main.c#L1367-L1436
- https://github.com/torvalds/linux/blob/a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6/arch/arm/kernel/module.c#L109-L430
The main difference with Zephyr, as far as I can tell - and ignoring unrelated details - seems to be that Linux completely ignores the ELF_ST_TYPE
of symbols; on the other hand, Zephyr only relocates symbols if they have specific values for it, as seen here:
Lines 840 to 852 in 8c8e2f6
@edersondisouza could you try if the following patch fixes the issue on your side?
diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c
index c92f49abd60..16748d941b4 100644
--- a/subsys/llext/llext.c
+++ b/subsys/llext/llext.c
@@ -835,18 +835,15 @@ static int llext_link(struct llext_loader *ldr, struct llext *ext, bool do_local
} else {
LOG_INF("found symbol %s at 0x%lx", name, link_addr);
}
- } else if (ELF_ST_TYPE(sym.st_info) == STT_SECTION ||
- ELF_ST_TYPE(sym.st_info) == STT_FUNC ||
- ELF_ST_TYPE(sym.st_info) == STT_OBJECT) {
+ } else if (IN_RANGE(sym.st_shndx, 0xFF00, 0xFFFF)) {
+ //0xFF00 => SHN_LORESERVE, 0xFFFF => SHN_HIRESERVE
+ LOG_DBG("section index in RESERVED range - not relocating");
+ continue;
+ } else {
/* Link address is relative to the start of the section */
link_addr = (uintptr_t)ext->mem[ldr->sect_map[sym.st_shndx]]
+ sym.st_value;
LOG_INF("found section symbol %s addr 0x%lx", name, link_addr);
- } else {
- /* Nothing to relocate here */
- LOG_DBG("not relocated");
- continue;
}
LOG_INF("writing relocation symbol %s type %zd sym %zd at addr 0x%lx "
Edit: re-reading the comment thread in EDK PR, I have seen the issue appeared on qemu_cortex_r5
, so I tested on my side. Using ./scripts/twister -p qemu_cortex_r5 --testsuite-root tests/subsys/llext -K
(-K
required because qemu_cortex_r5
is excluded from LLEXT tests):
- Without patch, 8 tests are performed: one is skipped, one passes and the other six fail
- With the patch, one is still skipped but all other tests pass 😄
from zephyr.
@mathieuchopstm I've tested it here with the sample and can confirm that your patch does work!!! Will you submit a PR, please?
from zephyr.
@edersondisouza PR with fix submitted
from zephyr.
Related Issues (20)
- RTC RV3028 clock output disabled by enabling alarm/update callback
- NXP's IMX RT1010 triggers assert on SPI Loopback test when EDMA enabled HOT 3
- bluetooth: audio: race hazard in bt_bap_unicast_client_discover() HOT 5
- spi: stm32 spi slave spi_read should return immediately after a spi transaction. HOT 1
- Reinit Systick when using S2RAM
- Automatically include references to a sample's relevant APIs
- intel_adsp: test_colors fails on tests/subsys/logging/log_output/logging.output.*
- Bluetooth: Controller: ISO: Providing incorrect broadcast code asserts instead of returning MIC failure
- [Backport v3.7-branch] Failed to backport #77008
- ESP32C3: Inconsistent flash erase times in ESP32-C3-MINI-1 (ESP32-C3FN4) modules [zephyr-v3.6.99] HOT 4
- [Backport v3.7-branch] Failed to backport #77054
- multi_heap: support for realloc HOT 1
- SCSI Read Capacity reports wrong capacity when used with USB Mass storage device HOT 1
- Devices using USB Mass storage function sometimes crash upon USB insertion, or during files manipulation from a host computer HOT 1
- RTC RV3028 driver does not disable minutes alarm correctly
- TFM: Nordic pinctrl consumers broken
- Sample USB-C Sink Not Working in Zephyr v3.7.0 on weact_stm32g431_core HOT 6
- Unaligned 32-bit reads following casts on dns_socket_dispatcher::local_addr (Cortex-M0) HOT 4
- off-by-one error on month counting in rtc rv8263 driver HOT 2
- drivers: spi: stm32: Broken device power management on SPI bus HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zephyr.