Skip to content

ld fails with The gap between .flash.rodata and .eh_frame_hdr must not exist to produce the final bin image. (IDFGH-13388) #14296

Closed
@Equidamoid

Description

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.3

Operating System used.

Linux

How did you build your project?

Command line with CMake

If you are using Windows, please specify command line type.

None

What is the expected behavior?

The project compiles.

What is the actual behavior?

When building the project for esp32-c3 the linker fails with:

/home/build/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: The gap between .flash.rodata and .eh_frame_hdr must not exist to produce the final bin image.
/home/build/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: warning: blink.elf has a LOAD segment with RWX permissions

The same project builds just fine for the esp32 and esp32-s2 targets.

Steps to reproduce.

  1. Having an existing project that uses cmake (idf_build_process / idf_build_executable)
  2. run cmake with -DCMAKE_TOOLCHAIN_FILE=/path-to-esp-idf-v5/tools/cmake/toolchain-esp32c3.cmake
  3. ninja flash

Unfortunately, I don't have a minimal shareable reproduction scenario.

Build or installation Logs.

[5/8] Linking CXX executable blink.elf                                                                                                                         
FAILED: blink.elf                                                                                                                                              
: && /home/build/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/riscv32-esp-elf-g++ -march=rv32imc_zicsr_zifencei -nostartfiles -march=rv32imc_zicsr_zifencei --specs=nosys.specs -Wl,--eh-frame-hdr -fno-lto -Wl,--gc-sections -Wl,--warn-common -T esp32c3.peripherals.ld -T esp32c3.rom.ld -T esp32c3.rom.api.ld -T esp32c3.rom.libgcc.ld -T esp32c3.rom.version.ld -T esp32c3.rom.eco3.ld -T esp32c3.rom.newlib.ld -T memory.ld -T sections.ld -T rom.api.ld 
<a bunch of .obj and .a files> 
-Wl,--undefined=FreeRTOS_openocd_params  -u app_main  -u start_app  -u __ubsan_include  -u esp_system_include_startup_funcs  -u __cxa_guard_dummy  -u __cxx_init_dummy  -lstdc++  esp-idf/pthread/libpthread.a  esp-idf/cxx/libcxx.a  -lc  -lm  -lgcc  esp-idf/newlib/libnewlib.a  -u newlib_include_heap_impl  -u newlib_include_syscalls_impl  -u newlib_include_pthread_impl  -u newlib_include_assert_impl  -u newlib_include_init_funcs  -u __assert_func  -u esp_app_desc  -u esp_efuse_startup_include_func  -u esp_timer_init_include_func  -u uart_vfs_include_dev_init  -u usb_serial_jtag_vfs_include_dev_init  -u usb_serial_jtag_connection_monitor_include  -u esp_system_include_coredump_init  -u vfs_include_syscalls_impl  -u include_esp_phy_override  -lphy  -lbtbb  esp-idf/esp_phy/libesp_phy.a  -lphy  -lbtbb  esp-idf/esp_phy/libesp_phy.a  -lphy  -lbtbb  -u pthread_include_pthread_impl  -u pthread_include_pthread_cond_var_impl  -u pthread_include_pthread_local_storage_impl  -u pthread_include_pthread_rwlock_impl  -u pthread_include_pthread_semaphore_impl  -u esp_vfs_include_console_register && :
/home/build/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: The gap between .flash.rodata and .eh_frame_hdr must not exist to produce the final bin image.
/home/build/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: warning: blink.elf has a LOAD segment with RWX permissions
collect2: error: ld returned 1 exit status


### More Information.

"SDKCONFIG_DEFAULTS" contents:

CONFIG_BOOTLOADER_WDT_TIME_MS=60000
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_COMPILER_CXX_EXCEPTIONS=y
CONFIG_COMPILER_CXX_RTTI=y
CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP=y
CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=10
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
CONFIG_ESP_INT_WDT_TIMEOUT_MS=3000
CONFIG_ESP_TASK_WDT_PANIC=y
# CONFIG_ESP_WIFI_NVS_ENABLED is not set
# CONFIG_ESP_WIFI_ENABLE_WPA3_SAE is not set
CONFIG_ESP_COREDUMP_ENABLE_TO_UART=y
# CONFIG_MQTT_TRANSPORT_SSL is not set
# CONFIG_MQTT_TRANSPORT_WEBSOCKET is not set

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions