This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hello!
palign(8) in link.cmd file not compatible with .init_array section. How to reproduce:
Create program with one (or any odd number) function with _attribute_((constructor)). This will lead to creation of .init_array section.
In link.cmd file specify palign(8) for .init_array section. For sample - .init_array > FLASH, palign(8), fill = 0xffffffff
Compile with map file. Check map file. You can see what .init_array allocate 8 bytes. Check SHT$$INIT_ARRAY$$Base & SHT$$INIT_ARRAY$$Limit symbols in map file. Difference between symbols must be 4 bytes (functions_count*4) but in real difference == 8. SHT$$INIT_ARRAY$$Limit point not to end of init_array data, but to end of section including padding 0xFFFFFFFF. When application start and pinit run_pinit function called, code try to iterate over constructors. At first real constructor called, later called function at 0xFFFFFFFF - HUNG!
I use paling attribute to calculate code CRC32.
I reproduce problem using TI ARM Linker PC v17.3.0.LTS and TI ARM Linker PC v16.9.3 (STS) on TMS570LS0914. I mean this problem is related to linker.
Constructor attribute mentioned in manual (ARM Optimizing C/C++ Compiler v17.3.0.STS)
5.16.2 Function Attributes
The following GCC function attributes are supported:
• constructor
void const_test (void); static int val = 0; __attribute__((constructor)) void const_test (void){ val = 10; }