AR# 51605

|

13.x the linker does not link the executable when using standalone makefile

Description

The following error occurs because, as far asIunderstand, the linker cannot rellocate some parts of the code:

mb-gcc -o fw_image1.elf new_test.o profinet.o ethernetip.o ethercat.o modbus.o webserver.o smtp.o -mlittle-endian -Wl,-EL -Wl,--gc-sections -Wl,-static -Wl,--oformat,elf32-microblazele -nostartfiles -nodefaultlibs -nostdlib -Wl,-L,../xilinx_iek_switch_install/lib -Wl,--start-group,-lSdaiPnOnly,-lextras,-ltarget,-lPROFINETStack,-lgcc,--end-group -Wl,-T,target.ld -Wl,-Map=ieksingle.map
../xilinx_iek_switch_install/lib\libSdaiPnOnly.a(pn_common.o): In function `set_device_mode_offline':
c:\cworkspace\CASE_929382_Dirk_linker_error\xilinx_lib\xilinx\SimpleDeviceAPI\all_fpga_eCos_gcc\mak\release/../../../sdai/protocol/user.c:2256: relocation truncated to fit: R_MICROBLAZE_32_PCREL_LO against symbol `user_sm_if_appl_get_alarm_ack_can_send' defined in .text section in ../xilinx_iek_switch_install/lib\libSdaiPnOnly.a(pn_common.o)
../xilinx_iek_switch_install/lib\libSdaiPnOnly.a(pn_common.o): In function `alarm_con':
c:\cworkspace\CASE_929382_Dirk_linker_error\xilinx_lib\xilinx\SimpleDeviceAPI\all_fpga_eCos_gcc\mak\release/../../../sdai/protocol/user.c:2113: relocation truncated to fit: R_MICROBLAZE_32_PCREL_LO against symbol `user_sm_switch_1_4_auto_read_res' defined in .text section in ../xilinx_iek_switch_install/lib\libSdaiPnOnly.a(pn_common.o)
../xilinx_iek_switch_install/lib\libSdaiPnOnly.a(pn_common.o): In function `user_connect_append_slot_diff':
c:\cworkspace\CASE_929382_Dirk_linker_error\xilinx_lib\xilinx\SimpleDeviceAPI\all_fpga_eCos_gcc\mak\release/../../../sdai/protocol/user_connect.c:1000: relocation truncated to fit: R_MICROBLAZE_32_PCREL_LO against symbol `user_util_find_module_list_element' defined in .text section in ../xilinx_iek_switch_install/lib\libSdaiPnOnly.a(pn_common.o)
collect2: ld returned 1 exit status
make: *** [fw_image1.elf] Error 1

After a search on Google, I came across a suggestion:

one can use "-mlong-calls"

However, this does not appear as an option for the MicroBlaze / mb-gcc.

What can I do?

Solution

To work around this issue, you need to recompile everything using the latest compiler from 14.2, this way, you will not receive the "relocation truncated to fit: R_MICROBLAZE_32_PCREL_LO against symbol" message and you will be able to produce the executable.

Running the linker only without recompiling the libs does not work.

AR# 51605
Date 09/04/2012
Status Active
Type General Article
Tools
People Also Viewed