Skip to content

Relocate absolute pointers in module constants - #331

Closed
JaxCalder wants to merge 1 commit into
developfrom
feat/absolute-pointer-relocations
Closed

JaxCalder wants to merge 1 commit into
developfrom
feat/absolute-pointer-relocations

Conversation

@JaxCalder

@JaxCalder JaxCalder commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Modules compiled as PIC can still contain absolute pointers in static structures and compiler-generated aggregate constants. A TLS entropy callback on Cortex-M7 retained its link offset (0x151), and crypto dispatch tables had the same issue. This adds opt-in, ELF-derived pointer relocations for ARM ELF32 and x86-64 ELF64.

dmod_enable_pointer_relocations() preserves linker relocation metadata, disables unsafe static-link relaxation, and appends an explicit fixup table. The runtime validates every record before applying it; crossplatform inspection validates without writing native pointers. Existing header/API/GOT/license fixups remain separate. Legacy modules retain their format. Older loaders reject the extended header, so consumers must update runtime and host metadata tools together. The installed SDK includes the generator.

Validation: all 32 native test executables pass, including four new loader cases; three integration tests compile actual ARM/x86-64 aggregates and check the relocation metadata. The real dmtls module initializes and parses its CA on x86-64. STM32F746G-DISCO completes TLS 1.2/1.3 encrypted exchanges and rejects five authentication/time failure cases with the updated loader.

Hardware TLS validation: choco-technologies/dmtls#1; boot integration: choco-technologies/dmod-boot#134.

@JohnAmadis

Copy link
Copy Markdown
Contributor

Interesujaca zmiana, ale zbyt powazna, aby ja wprowadzac tak "przy okazji". No i tez nie rozwiazuje wszystkich problemow. Ponadto jej implementacja jest specyficzna dla ARM, a jak dodamy np ESP to tez bedziemy miec te same problemy

@JohnAmadis JohnAmadis closed this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants