-
Bug
-
Resolution: Fixed
-
Medium
-
Code Generation Tools
-
CODEGEN-10691
-
-
-
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.