#2552 assigned defect

Add per-section compilation and rtems dynamic linking support

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

Description

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.

Change History (7)

comment:1 Changed on Feb 5, 2016 at 6:27:34 AM by Serg Kruglov

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

comment:2 Changed on Feb 5, 2016 at 1:42:43 PM 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 Feb 16, 2016 at 11:22:37 PM 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 May 11, 2017 at 7:31:02 AM by Sebastian Huber

Milestone: 4.124.12.0

comment:5 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

comment:6 Changed on Oct 13, 2018 at 10:47:38 PM by Joel Sherrill

Milestone: 5.15.2

comment:7 Changed on Oct 14, 2018 at 12:18:34 AM by Chris Johns

Component: unspecifiedlib/dl
Note: See TracTickets for help on using tickets.