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.

ARM-CGT: Use of -mllvm -align-all-functions=2 compiler option

Part Number: ARM-CGT

Hi
I want to enable "mllvm -align-all-functions=2" compiler option to reduce holes. I am using it for an example provided in MCU-PLUS-SDK-AM243X.

MCU+ SDK provides two ways of building an example: makefile and CCS project. I see that enabling the above mentioned option behaves differently with these options. When I enable it for CCS project, I see following warning. When I enable it for makefile based build, I do not see this warning.

"tiarmclang: warning: argument unused during compilation: '-mllvm -align-all-functions=2' [-Wunused-command-line-argument]"

And I do see a difference of 0.2KB between memory consumption of binary generated by CCS and makefile.

Can you explain why this warning is seen when the option is enabled for CCS project?

Regards
Dhaval Khandla

  • Hi Dhaval,

    Can you please share a bit more information?

    • What version of the AM243x MCU+SDK are you using?
    • What version of the TI CLANG compiler?
    • Which example from the SDK?
    • Can you show exactly how you're adding the compiler option for the make file and CCS builds?

    Regards,
    Frank

  • Hi

    What version of the AM243x MCU+SDK are you using?

    08_02_00_12

    What version of the TI CLANG compiler?

    1.3.0.LTS

    Which example from the SDK?

    examples\industrial_comms\ethernetip_adapter_demo

    Can you show exactly how you're adding the compiler option for the make file and CCS builds?
    • CCS : Adding this option in Project Properties -> Arm Compiler -> Edit Flags
    • Makefile : Adding the flags inside "CFLAGS_common :=" in makefile

    Regards
    Dhaval Khandla

  • CCS : Adding this option in Project Properties -> Arm Compiler -> Edit Flags

    With CCS 11.1 and TI CLANG 1.3.0.LTS I tried adding -mllvm -align-all-functions=2 under Arm Compiler -> Advanced Options -> Miscellaneous -> Miscellaneous C source specific flags and Miscellaneous C++ source specific flags:

    Looking at the linked executable the size of the text has reduced.

    Setting the above flags causes the -mllvm -align-all-functions=2 option to be passed to clang when only compiling C or C++ source files.

    When initially tried adding  -mllvm -align-all-functions=2 under Miscellaneous flags the options were passed to clang also during linking, and it was during linking that the following was reported:

    tiarmclang: warning: argument unused during compilation: '-mllvm -align-all-functions=2' [-Wunused-command-line-argument]

  • Hi Dhaval,

    I selected the example in <SDK>/examples/industrial_comms/ethernetip_adapter_demo/mii/am243x-evm/r5fss0-0_freertos/ti-arm-clang.

    I was able to reproduce your results using the release build configuration:

    • No warning issued for make file build when adding the option to CFLAGS_common.
    • Warning issued for CCS build adding option as you described. The warning is issued by the Linker.

    For the CCS build, no warning is issued by the Linker when I add the option as described by Chester.

    do see a difference of 0.2KB between memory consumption of binary generated by CCS and makefile.

    For me, the difference is ~1.5 KB. Do you consider this a problem?

    Regards,
    Frank

  • Hi Dhaval,

    I can't find any documentation for '-mllvm -align-all-functions=2'. Can you please point me to some documentation for this option?

    Thanks and regards,
    Frank

  • Hi
    I could not find it in TI CLANG documentation.

    There is a short explanation here : https://easyperf.net/blog/2018/01/25/Code_alignment_options_in_llvm#align-all-functions

    Regards
    Dhaval Khandla 

  • Hi Dhaval,

    Thanks much for sharing the docs.

    I'll close this thread for now since the warnings issue is resolved. Let me know if anything else is required.

    Regards,
    Frank