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.

TMS320F28379D: Linker flag option -g usage order issues

Part Number: TMS320F28379D

Hi,

In C28x Assembly Language Tools, it is explained that we can use -g or --make_global= global_symbol for linker. In CCS, if i create a simple project in Debug mode this flag is added for linker as below (4th flag from the beginning)

-v28 -ml -mt -g --diag_warning=225 --diag_wrap=off --display_error_number -z -m"Test.map" --warn_sections -i"E:/share/apps/T9BE1P~I/cgt/win/ti-cgt-c2000_16.9.3.LTS/lib" -i"E:/share/apps/T9BE1P~I/cgt/win/ti-cgt-c2000_16.9.3.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="Test_linkInfo.xml" --rom_model

But in this I do not see any symbol mentioned specifically as --make_global= global_symbol. So does it mean all the symbols defined in the code will be made as global?

If I try to change the order of the -g flag as shown below (defined after the map file flag and before warn_section flag)

-v28 -ml -mt --diag_warning=225 --diag_wrap=off --display_error_number -z -m"Test.map" -g --warn_sections -i"E:/share/apps/T9BE1P~I/cgt/win/ti-cgt-c2000_16.9.3.LTS/lib" -i"E:/share/apps/T9BE1P~I/cgt/win/ti-cgt-c2000_16.9.3.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="Test_linkInfo.xml" --rom_model

the linking fails with error that it does not recognize the next flag --warn_sections. 

Is the flag -g order is fixed that it has to be used before certain flags? Is the order mandatory for any other flags used for linker?

Thanks,

Aditya

  • Aditya,

    Notice the -z option in the command line.  Everything to the left of the -z is a compiler option, and NOT a linker option.  The linker options are to the right of the -z.

    In your first case with the -g at the beginning of the command line, it tells the compiler to include symbolic debug information in the .out file.  See the C28x Compiler User's Guide, SPRU514p. Table 2-4, p.20.

    Regards,

    David

  • Hi David,

    Thanks for the clarification that -g before -z is the compiler option and after -z is linker option.

    -g is also a valid linker flag right? See the C28x Compiler User's Guide, SPRU514p. Table 2-25, p.27. Symbol management options, --make_global=symbol (option) -g (alias) Makes symbol global (overrides -h) (description).

    What is the valid usage of -g flag for linker options? Do you have any example how to use it?

    Thanks,
    Aditya
  • Aditya,

    What is it you are trying to do?  -g linker option is used to selectively override the -h option which makes all global symbols static and local in scope.  The use of -h means you cannot access any symbols external to the object module in which they are defined.  I personally don't see why someone would want to do this.

    You can read about -h and -g in the C28x ASM Tools User's Guide, SPRU513.

    Regards,

    David

  • Hi David,

    Thanks for your inputs on this. I got the understanding of -g flag for the linker. I don't have the need to use it now.

    Thanks,
    Aditya