If the linker chose to store the full section name instead of truncating it, this field doesn't contain a truncated name, but an offset into the string table of the binary. The string table isn't loaded/mapped into memory during runtime though, so it's not possible to read the full section name, unless we try to locate the DLL/EXE on disk that the HMODULE corresponds to and load that manually.
This also has the practical consequence that with the current LLD, we must not enable debug info (i.e. must link with -s with the mingw frontend). If debug info is enabled, the full ".eh_frame" name is written into the string table and the the section name itself is just an offset, e.g. "/4".
Alternatives to fixing this consequence are:
- Making LLD always output a truncated ".eh_fram" (maybe only when -lldmingw is specified?), even if debug info is enabled. (GNU ld doesn't do this, so this approach in libunwind won't work with binaries built with that.)
- Switch to statically registering the .eh_frame sections on startup, instead of dynamically enumerating them when needed. This is what libgcc does. This doesn't match what libunwind does on other platforms though. This only works as long as libunwind is linked dynamically so that all involved DLLs register their sections to the same instance of libunwind. (I haven't succeeded in building a shared libcxx/libcxxabi/libunwind yet for mingw though.)