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.

Compiler: Segmentation fault for constructor attribute and palign(8)

Other Parts Discussed in Thread: TMS570LS0914

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.