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.

Compiler CL6x Link ".Obj" to ".Out"

Is there any information about Cl6x Link Object?
I would like to know how CALLP.S2 in the "OBJ" file is calculated compared to CALLP.S2 in the "Out" file.
THE LOCATION OF CALLP.S2 IS MARKED IN THE FOLLOWING TWO FIGURES.

.OBJ File:

.Out File


How does CL6x Link calculate 0x1ffffc13 and get 0x1fff5A93?

  • Please search the C6000 assembly tools manual for the sub-chapter titled Symbolic Relocations.

    Thanks and regards,

    -George

  • Thank you very much for your reply, after viewing the PDF, I still don't quite understand, how is the data converted?
    Can you explain it a little clearer?

    Like what:
    1. How does 0x00000012 convert to 0x0fffe012?
    2. How does 0x0180082A convert to 0x01B9082A?
    3. How does 0x0180006A convert to 0x1860006A?

    What is the specific calculation method?


  • This post introduces the documentation of the details regarding relocation.

    Consider this simple C code ...

    /* file.c */
    void function_call();
    
    void example()
    {
        function_call();
    }

    Build it ...

    $ cl6x --symdebug:none --asm_listing file.c

    cl6x is the C6000 compiler.  The option --symdebug:none disables the generation of debug information.  Never do this in actual practice.  This example is much easier to understand because the debug information is not present.  The option --asm_listing says to create an assembler listing file.  It has the same name as the source file, with the extension changed to .lst.  

    To see the relocations generated for this code, run this command ...

    $ ofd6x --obj_display=none,relocs file.obj
    
    OBJECT FILE:  file.obj
    
     Relocation Table 1/1 for Section 1 (".text")
    
        id type            offset     sym name
        -- ----            ------     --- ----
         0 R_C6000_PCR_S21 0x00000004   5 function_call

    To see the documentation for the ofd6x utility, please search for it in the C6000 assembly tools manual.  This output says relocation type R_C6000_PCR_S21 is applied at offset 4 of the section .text.  Here are a few lines from the listing file.lst ...

          48 00000000 01bc54f6             STW     .D2T2   B3,*SP++(-8)      ; [B_D64P] |5|
          49 00000004 10000012!            CALLP   .S2     function_call,B3  ; [B_Sb64P] |6|

    The second column gives the offset of each instruction.  In this case, offset 4 is for the second instruction.  Thus, the relocation applies to that CALLP instruction.  

    To see the documentation of all the relocations, including R_C6000_PCR_S21, please search the C6000 Embedded Application Binary Interface manual for the sub-chapter titled Relocation.

    Thanks and regards,

    -George