Link error of an undefined reference to "_fini" in function "__libc_fini_array"

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

Link error of an undefined reference to "_fini" in function "__libc_fini_array"

4,427 Views
ERussell
Contributor IV

I am hoping that some one can help me understand why I am getting a link error of an undefined reference to "_fini" in function "__libc_fini_array"? I am using MCUXpresso v 10.1.1. with a K65 processor and hardware floating point. 

c:/nxp/mcuxpressoide_10.1.1_606/ide/tools/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard\libc.a(lib_a-fini.o): In function `__libc_fini_array':
fini.c:(.text.__libc_fini_array+0x26): undefined reference to `_fini'
collect2.exe: error: ld returned 1 exit status

Thanks,

Elizabeth

0 Kudos
6 Replies

3,270 Views
converse
Senior Contributor V

Does your code call exit()? If so, remove it (it makes no sense in an embedded application) and replace with a while(1) loop, or perhaps wfi.

0 Kudos

3,270 Views
BlackNight
NXP Employee
NXP Employee

Elizabeth,

are you using C++ code? Usually the .fini is for the C++ global constructors, see The .init and .fini Sections 

Check your linker file if it has something like this:

    KEEP (*(.init))     KEEP (*(.fini))

in it.

Erich

0 Kudos

3,270 Views
ERussell
Contributor IV

Erich,

No , I'm not using C++ code. I'm in the process of moving from the IAR IDE (eclipse version) to MCUXpresso. The project is a combination of my C code and copied code from KDS using SDK v1.3 and PE for the k65 processor (which seems to have fallen through the cracks with respect to PE and SDK v2). I am trying to start out using the managed linker script. I don't see any statements with KEEP (*(.fini)) in the .ld file.

Thanks,

Elizabeth

0 Kudos

3,270 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Elizabeth,

You can search "`_fini" on your project using Search button onf MCUXpresso IDE.

And MCUXpresso IDE use SDKv2.x , not SDKv1.3, recommend you use the latest versoin .

BR

Alice

0 Kudos

3,270 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Elizabeth Russell ,

Could you please share your project or a simple one that can reproduce the error, thanks.

BR

Alice

0 Kudos

3,270 Views
ERussell
Contributor IV

Alice,

It is a fairly large project with proprietary code. I’m attaching the build log if that might help. What else could I send that would be helpful?

Thanks,

Elizabeth

0 Kudos