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.

Problem with partial linking and eabi using cgtools 7.3.6

Hi,

I'm having problems with partial linking using cgtools 7.3.6 and the ELF EABI for a C66 target. Our product is a library that uses a number of other libraries (for example libtiff) that are partially linked to the object files that call into those libraries (i.e. we have one source file that calls into libtiff, and that file is then partially linked to libtiff). The idea is that we can distribute one library that includes all required dependencies. This approach works fine with COFF objects.

I am currently attempting to migrate our library to ELF - unfortunately, partial linking doesn't work here, as the linker leaves out some of the other libraries' functions (in the case of libtiff, it leaves out _TIFFfree, but includes everything else). I use the exact same command line switches for building COFF and EABI (except for the --abi switch, obviously) . Is there anything special to take into account when partial linking with ELF ? What am I doing wrong ?

I've attached a minimal project that can reproduce the problem on a Linux build system. Just edit the makefile to point to where the compiler is installed, and then type 'make' for building for EABI (which fails), and 'make COFF=yes' for building for COFF, which works).

7317.partial_problem.zip

  • Under EABI, the linker is more aggressive about leaving out sections which are not referenced.  This change, and some methods for handling it, is discussed here.

    Thanks and regards,

    -George 

  • George,

    thanks for your answer, but  the sections I want are referenced, and are removed by the linker anyway. Specifying --retain does not help, as the linker simply ignores it. I also tried creating a linker command file with the sections I want explicitly in a SECTIONS directive, but that doesn't impress the linker either. Playing around some more with the test case I attached to my first post, I noticed that the linker seems to skip referenced sections that contain references to symbols that cannot be resolved during partial linking (i.e. malloc and free). And sure enough, if I add rts6600_elf.lib to the partial link step, the desired sections are added during the partial link. Unfortunately, this also adds parts of the runtime support library, which I do not want during partial linking, so that is not really a viable workaround.

  • This does look like a bug.  This is now SDSCM00044738.



  • Hi Eric,

    Is your lib linking without "partial"?

    Greetings,
    Thomas.

  • Hello Thomas,

    in my test case it does, so I would assume it should work in our library. However, I haven't tested it because it would require a number of changes in our (somewhat complex) makefiles, so it's not something I can do in a few minutes. Considering that TI has acknowledged this as an issue in cgtools, such a test would be wasted effort in my eyes.

  • If it leads to a workaround, it wouldn't be wasted effort.  We don't yet have a fix.

  • Unfortunately, not using partial linking is not an option, as some of the 3rd party libraries we use have commercial licenses that prevent us from distributing them in library form.

  • Hi,

    have you been able to resolve these issues with the latest cgtools?

    Greetings,
    Thomas.

  • It is fixed in releases 7.3.12 and 7.4.4.

    Thanks and regards,

    -George