bss_init and data_init doesn't work with -fPIC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

bss_init and data_init doesn't work with -fPIC

976 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pgr on Thu Apr 03 05:33:03 MST 2014
Hi,

I have then realized that the functions bss_init() and data_init() from cr_startup are never called when compiling the application using -fPIC option. The variables __data_section_table, __data_section_table_end, __bss_section_table and __bss_section_table_end are all set to 0.

Is this the expected behavior ?

Thanks in advance

0 Kudos
Reply
3 Replies

900 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Apr 03 06:46:30 MST 2014
To load and run position independent code (PIC) you need a loader that will
- read the image
- set up the GOT
- initialise the registers (normally R9)
- jump into your application.

PIC is not designed to be run standalone. We do not support the use of PIC.
0 Kudos
Reply

900 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pgr on Thu Apr 03 06:23:35 MST 2014
Ok thanks for your quick answer.
What is really strange is that the debugger see the right (expected) values when debugging... but the code that run see 0.
0 Kudos
Reply

900 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Apr 03 05:53:37 MST 2014
This is expected as the Managed Linker Scripts do not support position independent code.
0 Kudos
Reply