I'm trying to update a complex project to use newer toolchain.
Previous toolchain: GCC 4.9.2; C++11; CMake 3.10.1; Binutils 2.23.52; GDB 8.0.1
Newer toolchain: GCC 13.1; C++20; CMake 3.26.3; Binutils 2.41; GDB 12.1
There are no issues with the old set of tools but when I'm using the new toolchain I'm getting plenty of DWARF errors like this:
BFD: Dwarf Error: found dwarf version '54929', this reader only handles version 2, 3 and 4 information.
dwarf version number was different on every error print.
After setting dwarf compilation flag to 4 (in project's cMakeLists.txt):
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -lm -w -std=c++20 -gdwarf-4")
I'm only getting a single error:
BFD: Dwarf Error: found dwarf version '5', this reader only handles version 2, 3 and 4 information.
It happens after calling bfd_map_over_sections() (declared in bfd.h) procedure.
Any ideas how to solve this? What I'm missing here?
I tried to use different GCC version, every GCC newer than 10.2 I'm seeing this issue.