dangerous relocation: generic linker can't handle R_PPC_VLE_HA16A

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

dangerous relocation: generic linker can't handle R_PPC_VLE_HA16A

Jump to solution
2,944 Views
snafu
Contributor III

Hello

I moved to powerpc-eabivle-4_9 toolchain of S32DS from other vendor gnu toolchain which was able to compile only BookE. I wanted to use CodeBlocks as in the previous project so I updated library and linker path and when compilation an linking are started following commands are issued:

(majority of switches are taken from S32DS vle project created for cpu mpc5633m)

compiler:

powerpc-eabivle-gcc.exe -Wall -g -fmessage-length=0 -mcpu=e200z3 -specs=nosys.specs -mbig --sysroot="C:\NXP\S32DS_Power_v2017.R1\Cross_Tools\powerpc-eabivle-4_9\powerpc-eabivle\newlib"  -DSTART_FROM_FLASH -DMPC563xM -DE200Z3    -Ic:/NXP/S32DS_Power_v2017.R1/Cross_Tools/powerpc-eabivle-4_9/include/ -Ic:/NXP/S32DS_Power_v2017.R1/Cross_Tools/powerpc-eabivle-4_9/lib/gcc/powerpc-eabivle/4.9.4/include/ -c {file-to-compile.c}  {file-to-compile.o}

linker:

powerpc-eabivle-gcc.exe  {a lof of *.o files...} -T "mpc5633-bldr-vle.ld" -nostartfiles -nostdlib -Wl,-Map=map.txt -Xlinker --gc-sections -mcpu=e200z3 -specs=nosys.specs --sysroot="C:\NXP\S32DS_Power_v2017.R1\Cross_Tools\powerpc-eabivle-4_9\powerpc-eabivle\newlib"  -lm -lc -lgcc

When linking stage starts I get a lot of following errors

etpu2/etpu/_utils/etpu_util.c:117:(.text+0x18): dangerous relocation: generic linker can't handle R_PPC_VLE_HA16A
etpu2/etpu/_utils/etpu_util.c:123:(.text+0x52): dangerous relocation: generic linker can't handle R_PPC_VLE_HA16A
etpu2/etpu/_utils/etpu_util.c:124:(.text+0x64): dangerous relocation: generic linker can't handle R_PPC_VLE_HA16A

I suppose linker is able to link vle code including vle relocation. So I don't understand why the problem arises.

Could anybody help to fix the problem?

Thank you

Labels (1)
0 Kudos
Reply
1 Solution
2,517 Views
snafu
Contributor III

The problem was this command in linker script

OUTPUT_FORMAT(srec)

When removed no relocation errors were generated

View solution in original post

0 Kudos
Reply
5 Replies
2,518 Views
snafu
Contributor III

The problem was this command in linker script

OUTPUT_FORMAT(srec)

When removed no relocation errors were generated

0 Kudos
Reply
2,517 Views
stanish
NXP Employee
NXP Employee

Hi,

please make sure you also recompiled file etpu_utils/etpu_util.c by S32DS GCC VLE compiler

I suspect you may be linking an object file compiled by a different compiler.

Stan

0 Kudos
Reply
2,517 Views
snafu
Contributor III

Hi Stan

thank you for the help. Unfortunately it doesn't seem to be the solution,

because this is the actually the first file

that is compiled.

powerpc-eabivle-gcc.exe -Wall -g -fmessage-length=0 -mcpu=e200z3 -specs=

nosys.specs -mbig -mvle --sysroot="C:\NXP\S32DS_Power_v2017.R1\Cross_Tools\

powerpc-eabivle-4_9\powerpc-eabivle\newlib" -DGCC_MPC5633  -DSTART_FROM_

FLASH -DMPC563xM -DE200Z3    -Ic:/NXP/S32DS_Power_v2017.R1/Cross_Tools/

powerpc-eabivle-4_9/include/ -Ic:/NXP/S32DS_Power_v2017.R1/Cross_Tools/

powerpc-eabivle-4_9/lib/gcc/powerpc-eabivle/4.9.4/include/ {more -I...}  -c

C:/system/3rdparty/etpu2/etpu/_utils/etpu_util.c -o ../bin/debug-vle/o/

system/3rdparty/etpu2/etpu/_utils/etpu_util.o

and the file is compiled properly without any warning.

Would you have another idea?

thanks

0 Kudos
Reply
2,517 Views
alexanderfedoto
NXP Employee
NXP Employee

Hello Pavel

Seems like your "etpu_util" comes from 3rd party folder as precompiled object. If this object have been produced using old version of binutils ( version earlier than 2.28) - it my contain an relocation error. Since binutils 2.28 this was fixed but unforunately backward compatibility with old objects is lost. You can try to use --vle-reloc-fixup option for linker in order to fixup this.

Could you please copy here entire error from command line.

0 Kudos
Reply
2,517 Views
snafu
Contributor III

Hello Alexander

thank you for your help. I compiled all the etpu_util files, so that's not the problem. Finally I solved it by removing OUTPUT_FORMAT(srec) from linker script, but I have no idea why it didn't work. It used to work with other gcc toolchain. Now I do srec by invoking powerpc-eabivle-objcopy -O {input} {outpu} and everything is fine.

regards

Pavel

0 Kudos
Reply