Hi,
I am working on changing our linker from ld to lld. The aim is to keep our gcc compiler for the Cortex-A9 processor XIlinx Zynq-7000 platform.
I get the following linker error:
[87/105] Linking CXX executable sw\cc\datatypes\test\run_cc_datatypes_Unittest.elf
FAILED: sw/cc/datatypes/test/run_cc_datatypes_Unittest.elf
C:\WINDOWS\system32\cmd.exe /C “cd . && C:\tools\arm-eabi\13.2.1.231204\bin\arm-eabi-g++.exe -Wall -Wno-overloaded-virtual -Werror -std=gnu++20 -Wno-psabi -fuse-ld=lld -mfloat-abi=hard -mthumb -g -Og -g3 -TC:/code/viking3/lib/scripts/cmakemodules/…/cmakemodules/platform/UCOS_cortex-a9_0.ld -mlittle-endian -Wl,-stats,–warn-common -Wl,–gc-sections -BC:/tools/llvm-project/build/32bit/bin/ -Wl,-Map=run_cc_datatypes_Unittest.map sw/cc/datatypes/test/CMakeFiles/cc_datatypes_Unittest.dir/case/TestBitTypes.cpp.obj -o sw\cc\datatypes\test\run_cc_datatypes_Unittest.elf -LC:/code/viking3/lib/cc/build/lld/ext/generated/bsp/out/bsp-ucos/ps7_cortexa9_0/lib ext/generated/bsp/out/bsp-ucos/ps7_cortexa9_0/lib/libucos.a ext/generated/bsp/out/bsp-ucos/ps7_cortexa9_0/lib/libxil.a lib/libgtest.a lib/libgmock.a ext/googletest_dd/build/stubs/ucos/libgmock_main_ucos_stubs.a && cd .”
ld.lld: error: ext/generated/bsp/out/bsp-ucos/ps7_cortexa9_0/lib/libucos.a(asm_vectors.o):(.vectors+0x368): has non-ABS relocation R_ARM_CALL against symbol ‘SCUC_SpeculativeLineFillsEn’
collect2.exe: error: ld returned 1 exit status
libucos.a contains asm_vectors.o as seen above.
asm_vectors.S (abbreviated) looks like:
.org 0
.text
.globl Reset_Handler
Reset_Handler:
...
#if (UCOS_AMP_MASTER == DEF_ENABLED) /* SCU initialized by the master core only */
.extern SCUC_En
.extern SCUC_SpeculativeLineFillsEn
#if (UCOS_ZYNQ_ENABLE_OPTIMS == DEF_ENABLED)
BL SCUC_SpeculativeLineFillsEn
#endif
BL SCUC_En @ Enable the SCU
.extern SCUC_InvalidateAll
BL SCUC_InvalidateAll @ Invalidate SCU data
#endif /* #if (UCOS_AMP_MASTER == DEF_ENABLED) */
libucos.a also contains ucos_scoc.c.
ucos_scoc.c (abbreviated) looks like:
void SCUC_SpeculativeLineFillsEn (void)
{
SCUCREG->CTRL |= SCUC_BIT_CTRL_SPECLFEN;
}
As it can be seen SCUC_SpeculativeLineFillsEn is a c function definition and it is part of the same library as asm_vectors.S who calls it.
Above links with ld but not with lld and I am having a hard time figuring out why?
The error seems to tell that lld cannot assign an absolute address to SCUC_SpeculativeLineFillsEn, but I don’t get why it can’t since the function is defined in a C file.
Does anyone have some clues to what I can check or do to resolve this error?