Link a simple program and load into RTEMS with dlopen

Boldizsar.Palotas at esa.int Boldizsar.Palotas at esa.int
Mon Sep 17 15:29:26 UTC 2018


Hi,

I'm using RTEMS 4.11 and the builtin POSIX API functions to dynamically 
load a program image into memory. The program image is loaded in RTEMS 
using the following code:
void* handle = dlopen(prog_name, RTLD_NOW | RTLD_GLOBAL);
if (!handle)
    printf("dlopen: %s\n", dlerror());
I'm using the GCC built by RTEMS Source Builder to compile the object 
located at prog_name in the in-memory filesystem.
What command line should I use to properly compile a single C file to be 
loaded this way?
For reference, I've tried the following command line options, but got an 
error:
$ /opt/rtems-4.11/bin/sparc-rtems4.11-gcc test.c -c -o test.elf -shared 
-fPIC
$ # Run in emulator, result:
$ # dlopen: global symbol not found: _GLOBAL_OFFSET_TABLE_
I have also tried some other combinations and also using the rtems-ld 
program. Any ideas?
Thanks,
Boldizsár Palotás
PS. I'v also posted this on Stack Overflow, feel free to answer anywhere:
https://stackoverflow.com/questions/52371011/how-do-i-link-an-application-for-dynamic-loading-by-rtems
This message is intended only for the recipient(s) named above. It may contain proprietary information and/or
protected content. Any unauthorised disclosure, use, retention or dissemination is prohibited. If you have received
this e-mail in error, please notify the sender immediately. ESA applies appropriate organisational measures to protect
personal data, in case of data privacy queries, please contact the ESA Data Protection Officer (dpo at esa.int).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20180917/6f69497c/attachment.html>


More information about the users mailing list