[Solved] How to solve ld.lld error ‘relocation R_RL78_DIR16U_RAM out of RAM range’
How to solve ld.lld error ‘relocation R_RL78_DIR16U_RAM out of RAM range’
Hello support team,
I get the following errors. The project can be built by GNRL78 but cannot be built by LLVM-RL78. What can I do to solve the errors?
ld.lld: error: C:/Renesas/GitHubDesktop/work/FreeRTOS/FreeRTOS/Demo/Common/Minimal\TimerDemo.c:1144:(.text._prvOneShotTimerCallback+0x59): relocation R_RL78_DIR16U_RAM out of RAM range: 1000910 is not in [1044224, 1048319]
ld.lld: error: C:/Renesas/GitHubDesktop/work/FreeRTOS/FreeRTOS/Demo/Common/Minimal\TimerDemo.c:1154:(.text._prvISRAutoReloadTimerCallback+0x9): relocation R_RL78_DIR16U_RAM out of RAM range: 1000900 is not in [1044224, 1048319]
ld.lld: error: C:/Renesas/GitHubDesktop/work/FreeRTOS/FreeRTOS/Demo/Common/Minimal\TimerDemo.c:1164:(.text._prvISROneShotTimerCallback+0x9): relocation R_RL78_DIR16U_RAM out of RAM range: 1000901 is not in [1044224, 1048319]
ld.lld: error: ../src\UART3.c:206:(.text._u_uart3_get_blk+0xD0): relocation R_RL78_DIR16U_RAM out of RAM range: 1023895 is not in [1044224, 1048319]
ld.lld: error: ../src\UART3.c:207:(.text._u_uart3_get_blk+0xD8): relocation R_RL78_DIR16U_RAM out of RAM range: 1023895 is not in [1044224, 1048319]
ld.lld: error: ../src\UART3.c:208:(.text._u_uart3_get_blk+0xDF): relocation R_RL78_DIR16U_RAM out of RAM range: 1023894 is not in [1044224, 1048319]
ld.lld: error: ../src\UART3.c:239:(.text._u_uart3_callback_receivedata+0x38): relocation R_RL78_DIR16U_RAM out of RAM range: 1023894 is not in [1044224, 1048319]
ld.lld: error: ../src\UART3.c:243:(.text._u_uart3_callback_receivedata+0x3D): relocation R_RL78_DIR16U_RAM out of RAM range: 1023896 is not in [1044224, 1048319]
ld.lld: error: ../src\r_cg_serial_user.c:220:(.text._r_uart3_callback_error+0x9): relocation R_RL78_DIR16U_RAM out of RAM range: 1023900 is not in [1044224, 1048319]
Best regards,
NoMaY
Best answer
Dear NoMaY-san, The ld.lld linker is looking for the __data symbol to get the start of RAM. If it does not find this symbol, it will consider that the start of RAM is at 0xfef00. We have changed the start files and the default linker scripts to use double underscored prefixed symbols to avoid any conflicts with user defined symbols. In order to solve these errors, you need to make the following changes in the linker script: If your linker script is originally from GCC and it contains symbols _data and _end in the linker script. You can either: Option 1:Replace all instances of _data with __data and _end with __end inside the linker script and start files. Option 2:Add __data = .; at the start of the .data output section (or equivalent first section in RAM) and __end = .; at the end of the .bss output section (or equivalent last section in RAM) If _data and _end are not present, please add them according to the above explanation. Best Regards, The Open Source Tools Team