Dynamic load real-time tasks

Павел Жданов paul.alex.zhdanov at gmail.com
Tue Jul 4 09:10:13 UTC 2017


>
> >     i386-rtems4.11-gcc -B../../../../../pc486/lib/ -specs bsp_specs
> -qrtems -mtune=i486 -O2 -g -Wall -Wmissing-prototypes
> -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs
> -Wl,-Ttext,0x00100000  -mtune=i486   -o dl01.pre.exe init.o dl-load.o
> dl-o1.o filesystem.o
> >     mv dl01.pre.exe dl01.pre
> >     rtems-syms -e -c "-mtune=i486 -O2 -g -Wall -Wmissing-prototypes
> -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs" -o
> dl-sym.o dl01.pre
> >     i386-rtems4.11-gcc -B../../../../../pc486/lib/ -specs bsp_specs
> -qrtems -mtune=i486 -O2 -g -Wall -Wmissing-prototypes
> -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs
>  -Wl,-Ttext,0x00100000  -mtune=i486 -o dl01.exe init.o dl-load.o dl-o1.o
> dl-sym.o filesystem.o
>
> You have linked the object you wish to run time load into the base kernel
> executable.
> Chris
>

Thanks Chris. So far I can't solve this problem.
I'm sorry for the stupid newbie questions but I just don't get the
mechanism.

I have a printf symbol in the base image dl.exe.
I load the object file dl.o that uses printf. dl.o.
dl.c contains rtems_main and printf functions. dl.o is obtained using the
following command:

i386-rtems4.11-gcc -B$(RTEMS_MAKEFILE_PATH)lib/ -specs bsp_specs -qrtems
-DHAVE_CONFIG_H -I.  -I..  -I./include -mtune=i486 -O2 -g -Wall
-Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes
-Wnested-externs -MT dl.o -MD -MP -MF .deps/dl.Tpo -c -o dl.o dl.c

Symbol table dl-sym.o is obtained using the following commands:

i386-rtems4.11-gcc -B$(RTEMS_MAKEFILE_PATH)lib/ -specs bsp_specs -qrtems
-mtune=i486 -O2 -g \
-Wall -Wmissing-prototypes -Wimplicit-function-declaration
-Wstrict-prototypes -Wnested-externs \
-Wl,-Ttext,0x00100000  -mtune=i486 -o dl.pre init.o filesystem.o dl.o

rtems-syms -e -c "-mtune=i486 -O2 -g -Wall -Wmissing-prototypes
-Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs" -o
dl-sym.o dl.pre

It's content is:
Symbol table '.symtab' contains 1999 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 FILE    LOCAL  DEFAULT  ABS rld--YAfaaa.c
     2: 00000000     0 SECTION LOCAL  DEFAULT    1
     3: 00000000     0 SECTION LOCAL  DEFAULT    3
     4: 00000000     0 SECTION LOCAL  DEFAULT    4
     5: 00000000     0 SECTION LOCAL  DEFAULT    5
     6: 00000000     0 NOTYPE  LOCAL  DEFAULT    5 rtems__rtl_base_globals
     7: 0000c1cc     0 NOTYPE  LOCAL  DEFAULT    5 rtems__rtl_base_globals_s
     8: 00000000     0 SECTION LOCAL  DEFAULT    7
     9: 00000000     0 SECTION LOCAL  DEFAULT    9
    10: 00000000     0 SECTION LOCAL  DEFAULT    8
    11: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND BSPPrintkPort
    12: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND BSP_get_current_rtems_irq
    13: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND BSP_inch
...................................................................
  1051: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND preserve_fd_acls
  1052: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND printCpuInfo
  1053: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND printf
  1054: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND printk
  1055: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND printk_plugin
...................................................................
  1356: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND rtems_main

Is it correct that all symbols are undefined?

When I load dl.o with dl_open the rtl is looking for the symbols from
.rel.text section in local and global symbol tables of dl.o.

Relocation section '.rel.text' at offset 0x618 contains 2 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000027  00000501 R_386_32          00000000   .rodata.str1.1
0000002c  00001002 R_386_PC32        00000000   printf

rtl can't find printf.
I don't link any files against dl-sym.o. Is it possible to use printf of
base image or I need to link dl.o against libc?

Best regards,
Pavel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20170704/cad17c6b/attachment-0001.html>


More information about the users mailing list