-->
Page 1 of 2

dangerous relocation: call0: call target out of range:

PostPosted: Thu Oct 02, 2014 4:35 pm
by cnlohr
I'm sure this is an easy answer and I'm just doing something dumb, but I'm trying to get my code to compile and it seems any user code doesn't work, I keep getting these "dangerous relocation: call0: call target out of range: ..." errors. Any idea what I'm doing wrong?

P.S. I did have to modify eagle.app.v6.ld to include __stack.

Any help would be appreciated greatly.

Charles

Code: Select all~/esp8266/xtensa-toolchain-build/build-lx106/root/bin/xtensa-lx106-elf-gcc driver/uart.c user/dumbcraft.c user/dumbutils.c user/user_main.c user/dumbgame.c user/mystuff.c user/util10.c -I../../esp8266/esp8266_sdk_v0.9.1/include -Imyclib -Iinclude -Iuser -Os -I../../esp8266/esp8266_sdk_v0.9.1/lib_from_xt/lx106/xtensa-elf/include/ -flto ../../esp8266/esp8266_sdk_v0.9.1/lib/libmain.a ../../esp8266/esp8266_sdk_v0.9.1/lib/liblwip.a ../../esp8266/esp8266_sdk_v0.9.1/lib/libphy.a ../../esp8266/esp8266_sdk_v0.9.1/lib/libssl.a ../../esp8266/esp8266_sdk_v0.9.1/lib/libupgrade.a ../../esp8266/esp8266_sdk_v0.9.1/lib/libupgrade_ssl.a ../../esp8266/esp8266_sdk_v0.9.1/lib/libnet80211.a ../../esp8266/esp8266_sdk_v0.9.1/lib/libwpa.a ../../esp8266/esp8266_sdk_v0.9.1/lib/libnet80211.a -L../../esp8266/esp8266_sdk_v0.9.1/lib_from_xt/lx106/xtensa-elf/arch/lib -L../../esp8266/esp8266_sdk_v0.9.1/lib_from_xt/lx106/xtensa-elf/lib -T deps/eagle.app.v6.ld -B../../esp8266/esp8266_sdk_v0.9.1/lib_from_xt/lx106/xtensa-elf/lib -B../../esp8266/esp8266_sdk_v0.9.1/lib_from_xt/lx106/xtensa-elf/lib/../arch/lib -o image.elf
/tmp/ccmc8JQn.ltrans0.ltrans.o: In function `at_tcpserver_recon_cb$1730$1549':
ccmc8JQn.ltrans0.o:(.text+0x69d): dangerous relocation: call0: call target out of range: ets_sprintf
/tmp/ccmc8JQn.ltrans0.ltrans.o: In function `at_tcpserver_discon_cb$1727$1554':
ccmc8JQn.ltrans0.o:(.text+0x6c5): dangerous relocation: call0: call target out of range: ets_sprintf
/tmp/ccmc8JQn.ltrans0.ltrans.o: In function `SetServerName$1563':
ccmc8JQn.ltrans0.o:(.text+0x6e3): dangerous relocation: call0: call target out of range: ets_sprintf
/tmp/ccmc8JQn.ltrans0.ltrans.o: In function `at_tcpserver_listen$1742$1341':
ccmc8JQn.ltrans0.o:(.text+0x705): dangerous relocation: call0: call target out of range: ets_sprintf
ccmc8JQn.ltrans0.o:(.text+0x741): dangerous relocation: call0: call target out of range: espconn_regist_recvcb
ccmc8JQn.ltrans0.o:(.text+0x749): dangerous relocation: call0: call target out of range: espconn_regist_reconcb
ccmc8JQn.ltrans0.o:(.text+0x751): dangerous relocation: call0: call target out of range: espconn_regist_disconcb
ccmc8JQn.ltrans0.o:(.text+0x759): dangerous relocation: call0: call target out of range: espconn_regist_sentcb
/tmp/ccmc8JQn.ltrans0.ltrans.o: In function `at_procTask$1739$1344':
ccmc8JQn.ltrans0.o:(.text+0x885): dangerous relocation: call0: call target out of range: system_os_post
ccmc8JQn.ltrans0.o:(.text+0x89e): dangerous relocation: call0: call target out of range: ets_sprintf
ccmc8JQn.ltrans0.o:(.text+0xdca): dangerous relocation: call0: call target out of range: espconn_sent
ccmc8JQn.ltrans0.o:(.text+0x10c9): dangerous relocation: call0: call target out of range: gpio_output_set
/tmp/ccmc8JQn.ltrans0.ltrans.o: In function `uart_config$1387$1620':
ccmc8JQn.ltrans0.o:(.text+0x1539): dangerous relocation: call0: call target out of range: ets_isr_attach
ccmc8JQn.ltrans0.o:(.text+0x157b): dangerous relocation: call0: call target out of range: uart_div_modify
/tmp/ccmc8JQn.ltrans0.ltrans.o: In function `user_init':
ccmc8JQn.ltrans0.o:(.text+0x162f): dangerous relocation: call0: call target out of range: ets_isr_unmask
ccmc8JQn.ltrans0.o:(.text+0x1637): dangerous relocation: call0: call target out of range: ets_install_putc1
ccmc8JQn.ltrans0.o:(.text+0x163a): dangerous relocation: call0: call target out of range: wifi_get_opmode
ccmc8JQn.ltrans0.o:(.text+0x1649): dangerous relocation: call0: call target out of range: wifi_set_opmode
ccmc8JQn.ltrans0.o:(.text+0x1672): dangerous relocation: call0: call target out of range: espconn_regist_connectcb
ccmc8JQn.ltrans0.o:(.text+0x1677): dangerous relocation: call0: call target out of range: espconn_accept
ccmc8JQn.ltrans0.o:(.text+0x1682): dangerous relocation: call0: call target out of range: espconn_regist_time
ccmc8JQn.ltrans0.o:(.text+0x168d): dangerous relocation: call0: call target out of range: ets_sprintf
ccmc8JQn.ltrans0.o:(.text+0x16a6): dangerous relocation: call0: call target out of range: ets_sprintf
ccmc8JQn.ltrans0.o:(.text+0x16b5): dangerous relocation: call0: call target out of range: system_os_task
ccmc8JQn.ltrans0.o:(.text+0x16c3): dangerous relocation: call0: call target out of range: system_os_post
collect2: error: ld returned 1 exit status

Re: dangerous relocation: call0: call target out of range:

PostPosted: Thu Oct 02, 2014 4:48 pm
by jcmvbkbc
cnlohr wrote:"dangerous relocation: call0: call target out of range: ..." errors. Any idea what I'm doing wrong?

Try adding -mlongcalls to your compiler options.
xtensa ISA cannot encode direct calls longer than 512K from the call site. When -mlongcalls is passed to compiler (to assembler, actually) it will replace direct calls with a sequence of 'load target address into a register and call by address in register'. At linking step such expanded calls may be collapsed back to one instruction if linker sees that callee is in the range of a direct call.
EDIT:
Though it seems that there's not that much memory to overflow direct call range. Must be something in your linker script.

Re: dangerous relocation: call0: call target out of range:

PostPosted: Fri Oct 03, 2014 12:19 am
by cnlohr
YAY! I have a .elf... of my Minecraft server. Hopefully I'll test it tomorrow. Thank you! Now, when someone else googles that error, they will have a solution!

Re: dangerous relocation: call0: call target out of range:

PostPosted: Fri Oct 03, 2014 12:24 am
by cnlohr
Oops, forgot to post the first part to my linker script.

Code: Select allMEMORY
{
  dport0_0_seg :                         org = 0x3FF00000, len = 0x10
  dram0_0_seg :                          org = 0x3FFE8000, len = 0x14000
  iram1_0_seg :                          org = 0x40100000, len = 0x8000
  irom0_0_seg :                          org = 0x40240000, len = 0x32000
}