#2552 assigned defect

Add per-section compilation and rtems dynamic linking support

Reported by: Serg Kruglov Owned by: Chris Johns
Priority: normal Milestone: Indefinite
Component: lib/dl Version: 7
Severity: normal Keywords:
Cc: Blocked By:

Description (last modified by Chris Johns)

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

int abcd=5;
void funcA(void)
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) {
    abcd = 9;

c) rap file project with core image from b) and library from a)

extern void funcB(void);
void rtems(void)

After generate map files with rtems-rap -sSr

Map file without per-section compilation

  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

  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.

Change History (8)

comment:1 Changed on 02/05/16 at 06:27:34 by Serg Kruglov

for build rap file use switches --rap-strip and --one-file

comment:2 Changed on 02/05/16 at 13:42:43 by Joel Sherrill

Owner: set to Chris Johns
Status: newassigned

Chris... is this documented? Where can the instructions go about per function sections and these arguments?

Seems like the ticket is resolved except making sure no one treads this path again.

comment:3 Changed on 02/16/16 at 23:22:37 by Chris Johns

I wonder why those options are needed. We should really look into this.

There is documentation in the linkers dorectory in rtems-tools.git but this should all be moved into the docs projects.

comment:4 Changed on 05/11/17 at 07:31:02 by Sebastian Huber


comment:5 Changed on 11/09/17 at 06:27:14 by Sebastian Huber


Milestone renamed

comment:6 Changed on 10/13/18 at 22:47:38 by Joel Sherrill

Milestone: 5.15.2

comment:7 Changed on 10/14/18 at 00:18:34 by Chris Johns

Component: unspecifiedlib/dl

comment:8 Changed on 11/09/22 at 23:05:20 by Chris Johns

Description: modified (diff)
Milestone: 5.2Indefinite
Version: 57

Needs funding

Note: See TracTickets for help on using tickets.