Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-10948

assembler/linker incorrectly handles REL relocations if user specifies a CODE_SECTION that starts with 'a'

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-10691
    • Hide
      ARMCLANG_2.1.0.LTS
      C2000_22.6.0.LTS
      C6000_8.3.0
      MSP430_20.2.0.LTS
      C7000_2.1.0.LTS
      MSP430_21.6.0.LTS
      ARMCLANG_1.3.0.LTS
      C2000_21.6.0.LTS
      PRU_2.3.0
      C7000_3.1.0.LTS
      ARM_20.2.0.LTS
      Show
      ARMCLANG_2.1.0.LTS C2000_22.6.0.LTS C6000_8.3.0 MSP430_20.2.0.LTS C7000_2.1.0.LTS MSP430_21.6.0.LTS ARMCLANG_1.3.0.LTS C2000_21.6.0.LTS PRU_2.3.0 C7000_3.1.0.LTS ARM_20.2.0.LTS
    • Hide
      MSP430_20.2.8.LTS*
      C7000_2.1.3.LTS*
      MSP430_21.6.2.LTS*
      ARMCLANG_1.3.2.LTS*
      ARMCLANG_2.1.4.LTS*
      C7000_3.1.1.LTS
      C2000_22.6.1.LTS
      C6000_8.3.13
      ARM_20.2.8.LTS*
      PRU_2.3.4*
      C2000_21.6.2.LTS*
      Show
      MSP430_20.2.8.LTS* C7000_2.1.3.LTS* MSP430_21.6.2.LTS* ARMCLANG_1.3.2.LTS* ARMCLANG_2.1.4.LTS* C7000_3.1.1.LTS C2000_22.6.1.LTS C6000_8.3.13 ARM_20.2.8.LTS* PRU_2.3.4* C2000_21.6.2.LTS*
    • default
    • Change the section name used in pragma CODE_SECTION, pragma SET_CODE_SECTION or section attribute from a name starting with "a" to instead start with any other letter or . or :

      Using CODE_SECTION pragma, SET_CODE_SECTION pragma, or section attribute with a section name that begins with the letter 'a' will cause the linker to generate an incorrect address for accessing variables in that code section.

      The linker incorrectly assumes the relocation type is RELA instead of REL.

      More details:
      ----------------
      The attached C file has this line ...

      #pragma CODE_SECTION(GetA2DAnalogMux, "a2d_funcs")
      void GetA2DAnalogMux(void)
      {
          ...
          gpioDataReg = (volatile Uint32 *)&GpioDataRegs + (104/32)*(0x8/2); 
      

      Build it.

      % cl2000 -@options.txt file.c -z -o file.out link2000.cmd
      

      Inspect the generated assembly file.asm to see ...

              MOVL      XAR4,#||GpioDataRegs||+24 ; [CPU_ARAU] |22245| 
      

      The symbol GpioDataRegs resolves to the address 0x7f00. So, the final encoding of this address, in hex, is 0x7f18. Disassemble ...

      % dis2000 file.out > disassembly.txt
      

      Inspect the disassembly to see ...

      00000003   8f00   MOVL         XAR4, #0x007f00
      00000004   7f00
      

      0x7f00 is encoded where 0x7f18 is expected.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: