briansmith / ring

Safe, fast, small crypto using Rust
Other
3.77k stars 708 forks source link

Error: dangerous relocation: call8: call target out of range:(xtensa-esp32s3-espidf) #1989

Closed blue-freedom-technologies closed 8 months ago

blue-freedom-technologies commented 8 months ago
= note: [ldproxy] Running ldproxy
          Error: Linker /esp32-s3/prototype/mcu-app/.embuild/espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc failed: exit status: 1
STDERR OUTPUT:
         /esp32-s3/prototype/mcu-app/target/xtensa-esp32s3-espidf/release/deps/libring-bdfba0d49cd2e9ff.rlib(d1a56b8165ef788f-curve25519.o): in function `fe_mul_impl':
         /.cargo/git/checkouts/ring-f7e9d4c00c5a74cb/a266f11/crypto/curve25519/curve25519.c:235:(.text.ge_madd+0xf6): dangerous relocation: call8: call target out of range: .text.fiat_25519_carry_mul
         /.cargo/git/checkouts/ring-f7e9d4c00c5a74cb/a266f11/crypto/curve25519/curve25519.c:235:(.text.ge_madd+0x102): dangerous relocation: call8: call target out of range: .text.fiat_25519_carry_mul
         /.cargo/git/checkouts/ring-f7e9d4c00c5a74cb/a266f11/crypto/curve25519/curve25519.c:235:(.text.ge_madd+0x10d): dangerous relocation: call8: call target out of range: .text.fiat_25519_carry_mul
         /.cargo/git/checkouts/ring-f7e9d4c00c5a74cb/a266f11/crypto/curve25519/curve25519.c:235:(.text.x25519_ge_scalarmult_small_precomp$constprop$0+0x956): dangerous relocation: call8: call target out of range: .text.fiat_25519_carry_mul
(...)

.cargo.toml

[build]
target = "xtensa-esp32s3-espidf"

[target.xtensa-esp32s3-espidf]
linker = "ldproxy"
runner = "espflash flash --monitor"
rustflags = ["--cfg", "espidf_time64","--cfg", "mio_unsupported_force_poll_poll","-C", "default-linker-libraries"]

[unstable]
build-std = ["std", "panic_abort"]

[env]
MCU="esp32s3"
ESP_IDF_VERSION = "v5.1.2"
TARGET_CC = "/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-cc"

Interesting new issue, any suggestion would be welcome.

Cheers,

blue-freedom-technologies commented 8 months ago

After a little debugging if we add the TARGET_CFLAGS = "-mlongcalls" to the .cargo.toml this will solve the issue.

Cheers,