Note: before you say it, this is not a duplicate of this. I want a specific library.

I want an ELF loader that can relocate PIC (Position Independent Code) on Cortex-M processors. There is no MMU and relocations on Thumb/Thumb-2 code are required. Traditional ARM won't work.


Try this: https://github.com/martinribelotta/elfloader

This is not a PIC/PIE solution but is library for load-in-time relocatable binary execution for ARMv7M (I have not test it on ARMv6M but I probably work)

| improve this answer | |
  • i'm using ARMV7M (Cortex-M3) so that's not a problem, but do I need these fopen(), close(), read() functions? It would be nice to exec from a char array. – user27945 Nov 23 '16 at 14:35
  • and if it isn't PIC/PIE then why are you relocating? I just need the relocation part, just want to know more about that. – user27945 Nov 23 '16 at 14:39
  • You are free to define the correspondent macros. – martinribelotta Nov 24 '16 at 13:14
  • Can I have a guide on how to do that (possibly in your answer)? – user27945 Nov 24 '16 at 13:14
  • 1
    Question: Your char* program contain all ELF format? For relocate code you need to write code on relocation entries (described on metadata section of ELF). This is true with relocatable code or PIC/PIE. The las method need GOT (global offset table) and PLT (Procedure Linkage table). Even SYSV libraries (*.so) need GOT and PLT on RW area. – martinribelotta Nov 24 '16 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy