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.

How to retain relocation entries in elf files (executables) using cl430 as compiler/linker?

I want to extract relocation information from executables (not relocatables using relative addresses).

Therefore I need to prevent the linker to discard the relocation entries (e.g.: .rel.text) from the generated elf file.

For msp430-gcc there is the option —emit-relocs which actually does the job.

For cl430 (version: 4.4.3 ) I couldn't find any valid solution yet:

  • -r option -> works but output file is not an exectuable
  • -ar option -> does not work with elf files as output
  • --retain='*rel*' option -> still no relocation entries 
  • unused_section_elimination=off option -> linking error: #10234-D: unresolved symbols remain

  • Felix Kubicek said:
    For msp430-gcc there is the option —emit-relocs which actually does the job.

    Unfortunately, there is no equivalent option with the TI compiler.

    Felix Kubicek said:
    I want to extract relocation information from executables

    Please describe the overarching problem you want to solve.  There may be a way to solve it with the Object File Display utility ofd430.

    Thanks and regards,

    -George

  • Thank you for the answer!
    I want to gain several information from the metadata of ELF executables, e.g all calls of a specific function.
    For example, if I want to relocate a specific function (after linking) then I need to know where the calls of that specific functions are (to correct the address of all call instructions subsequently).
    Therefore I need the relocation entries (including relocation types).
    Is there any possibility to get such information from the metadata?

    Many thanks in advance,

    Felix
  • Doing this ...

    Felix Kubicek said:
    if I want to relocate a specific function (after linking) then I need to know where the calls of that specific functions are (to correct the address of all call instructions subsequently)

    requires the relocation entries.  Information supplied by ofd430 is not sufficient.  Unfortunately, there is no method for solving this problem with the TI compiler.

    Thanks and regards,

    -George