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.

Adding library to package.bld



 

Hello,

I'm trying to add a library to my package via lopts but the link order is incorrect.  When I run

XDCOPTIONS=v make

I get

...

/opt/TI/C6000CGT/bin/lnk6x -w -q -u _c_int00 -fs package/cfg/bin/ti_platforms_evm3530/  -l link.cmd  -q -o bin/ti_platforms_evm3530/server_DSP.x64P package/cfg/bin/ti_platforms_evm3530/server_DSP_p64P.o64P  package/cfg/bin/ti_platforms_evm3530/server_DSP/main.o64P  package/cfg/bin/ti_platforms_evm3530/server_DSP_p64P.xdl  -c -m package/cfg//bin/ti_platforms_evm3530/server_DSP.x64P.map -l /opt/TI/C6000CGT/lib/rts64plus.lib

where my library is specified in link.cmd.  The link fails as symbols used in my codec's are defined in a library linked from link.cmd.  If I manually run

/opt/TI/C6000CGT/bin/lnk6x -w -q -u _c_int00 -fs package/cfg/bin/ti_platforms_evm3530/  -q -o bin/ti_platforms_evm3530/server_DSP.x64P package/cfg/bin/ti_platforms_evm3530/server_DSP_p64P.o64P  package/cfg/bin/ti_platforms_evm3530/server_DSP/main.o64P  package/cfg/bin/ti_platforms_evm3530/server_DSP_p64P.xdl  -l link.cmd -c -m package/cfg//bin/ti_platforms_evm3530/server_DSP.x64P.map -l /opt/TI/C6000CGT/lib/rts64plus.lib

Everything links OK.

I've read some previous posts about using the link order interface with the GUI but how do I do it with the command line tools?

 

Thanks.

Steve Goldberg

  • Try using the "re-read libraries" option for the linker: -x or --reread_libs so that the order of libraries does not matter.

    Mark

     

  • You can add the content of link.cmd to the generated linker command file package/cfg/bin/ti_platforms_evm3530/server_DSP_p64P.xdl. In your package, add the file package.xs, and in there define the function getSects. The function only need to return "link.cmd", but it has to be a fully qualified package name. For example, if your package is 'myPackages.pkgA', the function should return "myPackages/pkgA/link.cmd". The result of it will be that the content of link.cmd is added at the end of the generated linker command file, which is similar to what you have on the second command line in your post.

    function getSects() {
        return "myPackages/pkgA/link.cmd";
    }