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: cl6x and clpru produce object files with invalid ELF header

Tool/software: TI C/C++ Compiler

Using the 'readelf' utility on any .obj file produced by cl6x or clpru produces a warning:

~/tmp$ echo >empty.c
~/tmp$ cl6x empty.c
~/tmp$ readelf --file-header empty.obj | grep program
readelf: Warning: possibly corrupt ELF header - it has a non-zero program header offset, but no program headers
Start of program headers: 2484 (bytes into file)
Size of program headers: 32 (bytes)
Number of program headers: 0

As shown, the file header indeed contains a non-zero program header table offset (e_phoff), even though it doesn't have a program header table. The ELF specification says:

e_phoff
This member holds the program header table's file offset in bytes. If the file has no program header table, this member holds zero.
  • I agree with your analysis.  Thank you for letting us know about this problem.  I filed CODEGEN-3597 in the SDOWP system to have this investigated.  You are welcome to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George