I would like to add a start and end symbol around each debug info section so that I can access them from my program. I tried the following scheme:
.debug.info ALIGN(4K) : {
DEBUG_INFO_START = .;
*(.debug.info)
DEBUG_INFO_END = .;
}
.debug.abbrev ALIGN(4K) : {
DEBUG_ABBREV_START = .;
*(.debug.abbrev)
DEBUG_ABBREV_END = .;
}
/* etc. */
But that causes each section (including .text, .rodata etc.) and the resulting binary to triple in size. What could be causing this? As you can see from the dumps below, the debug info is included in both cases so that isn't what's causing the increase in size.
I'm using Zig and the LLVM toolchain.
Link to the whole link script. Link to a dump of the binary without the link script modifications, link to a dump with the modifications.