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.

AM2434: Possible Race Condition in tiarmlink with -flto When Using Parallel Build (TI ARM CGT 3.2.2 LTS)

Part Number: AM2434


Tool/software:

Hi TI team,

I believe I’ve encountered a bug related to Link Time Optimization (LTO) in the tiarmlink tool when using TI ARM CGT 3.2.2 LTS.

Setup:

  • Build system: CMake with Makefile generator
  • Target: Sitara AM2434, using two R5 cores
  • Toolchain: TI ARM Compiler Tools 3.2.2 LTS
  • We build multiple static libraries and link two executables (one per core)
  • LTO is enabled via the -flto flag

Issue:

  • The build succeeds reliably when run without parallelism
  • When using --parallel with CMake (i.e., make -jN), the build sporadically fails during linking
  • The issue only occurs with -flto; without it, the build is stable
  • The errors vary slightly, suggesting a possible race condition in tiarmlink

Error Snippets:

Example 1:

[100%] Linking CXX executable CommunicationCore_lp_r5_1-0.out
../../master/ELFLNK/symbol.c:880:internal fatal error #10158: ("sprintf")

INTERNAL ERROR: ...\tiarmlnk executed an illegal instruction

This is caused by a defect in the TI Linker.
TI Customer Support may be able to suggest a workaround to avoid this.
...

Example 2:

[ 97%] Linking CXX executable CommunicationCore_lp_r5_1-0.out
[100%] Linking CXX executable ControllerCore_lp_r5_0-0.out
llvm-lto2: .../_Build/_Temp\100: Malformed block
tiarmclang: error: tiarmlnk command failed with exit code 1 (use -v to see invocation)

Conclusion:

This seems to point to a concurrency issue in the LTO phase of the linker. Has this been reported before? Are there known workarounds or fixes in newer versions of the toolchain?

Best regards,
Stefan