ESP8266 compilation/linking fails with build_type debug

This project compiles (and runs) OK with Arduino IDE 1.8.12 as well as PIO core 4.3.5a1 (development) and 4.3.4 (stable) when using build_type = release
However, when using build_type = debug for both dev/stable, it fails with:

PackageManager: Installing framework-arduinoespressif8266 @ *
Downloading [####################################] 100%
Unpacking [####################################] 100%
framework-arduinoespressif8266 @ 3.20701.0 has been successfully installed!
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https:/docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 2.5.1 > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:

  • framework-arduinoespressif8266 3.20701.0 (2.7.1)
  • tool-esptool 1.413.0 (4.13)
  • tool-esptoolpy 1.20800.0 (2.8.0)
  • toolchain-xtensa 2.40802.200502 (4.8.2)
    LDF: Library Dependency Finder → /bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 32 compatible libraries
    Scanning dependencies…
    Dependency Graph
    |-- 6.15.2
    |-- 1.0
    |-- 1.0
    | |-- 1.0
    |-- 1.2
    | |-- 1.0
    |-- <Ethernet(esp8266)> 1.0.4
    | |-- 1.0
    |-- 1.0
    Building in debug mode
    Linking .pio\build\nodemcuv2\firmware.elf
    c:/users/ewald/.platformio/packages/toolchain-xtensa/bin/…/lib/gcc/xtensa-lx106-elf/4.8.2/…/…/…/…/xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\firmware.elf section .text1' will not fit in region iram1_0_seg’
    c:/users/ewald/.platformio/packages/toolchain-xtensa/bin/…/lib/gcc/xtensa-lx106-elf/4.8.2/…/…/…/…/xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib027\libESP8266mDNS.a(LEAmDNS.cpp.o):(.text._ZN7esp826618MDNSImplementation13MDNSResponder5beginEPKcRK9IPAddressj+0x0): undefined reference to `addrList’
    collect2.exe: error: ld returned 1 exit status
    *** [.pio\build\nodemcuv2\firmware.elf] Error 1

If I add -Wl,-Map,output.map to understand why text will not fit, it results in a different error:

xtensa-lx106-elf-g++: error: app_entry: No such file or directory
xtensa-lx106-elf-g++: error: _printf_float: No such file or directory
xtensa-lx106-elf-g++: error: _scanf_float: No such file or directory
xtensa-lx106-elf-g++: error: _DebugExceptionVector: No such file or directory
xtensa-lx106-elf-g++: error: _DoubleExceptionVector: No such file or directory
xtensa-lx106-elf-g++: error: _KernelExceptionVector: No such file or directory
xtensa-lx106-elf-g++: error: _NMIExceptionVector: No such file or directory
*** [.pio\build\nodemcuv2\firmware.elf] Error 1

Build with -v here (albeit not 100% complete, need to find a way to capture the whole terminal output)

The latest (stable) version of Expressif 8266 (2.5.1) is being used. No problem when the same code is build in debug mode on Arduino IDE (gcc options -Os -g).

Thanks in advance for any tips,
Ewald