[RTEMS Project] #2552: Add per-section compilation and rtems dynamic linking support

RTEMS trac trac at rtems.org
Tue Jan 26 11:56:11 UTC 2016


#2552: Add per-section compilation and rtems dynamic linking support
-------------------------+------------------
 Reporter:  SergKruglov  |      Owner:
     Type:  defect       |     Status:  new
 Priority:  normal       |  Milestone:  4.12
Component:  General      |    Version:  4.12
 Severity:  normal       |   Keywords:
-------------------------+------------------
 If rtems libraries and image build with per-section compilation flags rap
 files (maybe and other) build with duplicate symbols(objects).
 Gnu ld with flag -gc-sections remove unnessary symbols(objects)? but
 rtems-ld this does.
 I wrote small sample with 3 projects:
 a) static lib libtst.a with one file tst.c
 tst.c

 int abcd=5;
 void funcA(void)
 {
     abcd=7;
 }
 void funcB(void)
 {
 }
 b) any rtems project (minimal or any) linked with this lib and in Init
 call function from lib

 extern void funcA(void);
 extern int abcd;
 rtems_task Init(rtems_task_argument argument) {
     funcA();
     abcd = 9;
     rtems_task_delete(RTEMS_SELF);
 }
 c) rap file project with core image from b) and library from a)
 test.c

 extern void funcB(void);
 void rtems(void)
 {
     funcB();
 }

 After generate map files with rtems-rap -sSr

 Map file without per-section compilation
 testrap.rap:
   Strings: 0x00000074 (116) size: 14
                0 (0x000000):
                1 (0x000001): rtems
                2 (0x000007): rtems
                3 (0x00000d):
   Symbols: 0x00000082 (130) size: 12
                      data section  value      name
                0: 0x0012    .text 0x00000000 rtems
   Relocations: 0x0000008e (142)
            .text: info       offset     addend     symbol name
                0: 0x80000504 0x00000008 0x00000000 funcB

 Map file with per-section compilation
 testrap.rap:
   Strings: 0x00000090 (144) size: 31
                0 (0x000000):
                1 (0x000001): rtems
                2 (0x000007): funcA
                3 (0x00000d): abcd
                4 (0x000012): funcB
                5 (0x000018): rtems
                6 (0x00001e):
   Symbols: 0x000000af (175) size: 48
                     data section  value      name
                0: 0x0012    .text 0x00000000 rtems
                1: 0x0012    .text 0x00000000 funcA
                2: 0x0011    .data 0x00000000 abcd
                3: 0x0012    .text 0x00000000 funcB
   Relocations: 0x000000df (223)
            .text: info       offset     addend     symbol name
                0: 0xc0001204 0x00000008 0x00000000
                1: 0xc0000d05 0x00000024 0x00000000
                2: 0xc0000d06 0x0000002c 0x00000000

 If use per-section compilation while insert funcB (from library libtst.a)
 get full tst.o from library.
 Objects funcA and abcd duplicate already available in kernel.

 I do not know as it to correct and remove excess symbols and objects.

--
Ticket URL: <http://devel.rtems.org/ticket/2552>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list