Improving llvm-lib to be more like MSVC lib

Currently llvm-lib is missing a few features that is available in MSVC lib.exe - the one that I am currently thinking of is the ability to output PDB files for static libraries.

The PDB code seems to live in lld while llvm-lib is a alias for llvm-ar.

If we wanted to add this to llvm-lib we could either break out the PDB code generation into a support library or we would have to make llvm-lib a lld driver instead.

I haven’t looked to deep into this yet - I wanted to get an opinion on it before I started to look closer.

Thoughts @mstorsjo @rnk @MaskRay ?

I don’t have a fully thought-out opinion on what we should do, but I do remember that I’ve noticed the same issue too - lib.exe can generate an import library from a def file, but llvm-lib can’t. And in the case of lib.exe, iirc it’s just a thin wrapper over link.exe.

Restructuring llvm-lib to sit on top of lld might make it more feasible to implement these things, but would also inflate the size of a fully static llvm-lib quite a bit I think.

I actually went back and double checked the lib.exe invocation and I was wrong about it being able to output .pdb files. I got fooled by the fact that the compiler outputs a pdb file per object file and my object file and library was named the same thing.

Seems like the only fix for getting debug symbols in static libraries are to use /Z7 for both MSVC and Clang-CL.

So never mind my original post about moving llvm-lib over to lld. It might still be interesting when it comes to the second feature with .def files. But for my original usage it’s not really valid.