This assumes that the library is an import library for a system dll (named e.g. libkernel32.a) or a static library; it won't work for import libraries for normal user dlls named e.g. libfoo.dll.a). Since ld.bfd doesn't support embedded defaultlibrary directives, this feature probably shouldn't see much use in the wider mingw ecosystem anyway.
This is an alternative to the MinGW specific logic in D53012. This supersedes everything of D52990. If this logic is placed elsewhere, half of D52990 still is required.