[llvm-bugs] [Bug 42180] New: llvm-lib does something different from lib.exe for res inputs

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 7 08:13:19 PDT 2019


            Bug ID: 42180
           Summary: llvm-lib does something different from lib.exe for res
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvm-ar
          Assignee: unassignedbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvm-bugs at lists.llvm.org

When doing `lib /out:foo.lib test.res`, lib.exe silently converts the res file
to an obj file using cvtres and adds that to the lib file (still under the name

This is on one hand less weird than putting the .res file into the lib, since
that way all files in a .lib file are coff objects. It also means the res file
has a machine type in the coff object header (lib.exe either looks at obj files
passed earlier than the .res file to infer machine type, or else at the
/machine: flag, and if neither is present, issues a warning and picks the
default belonging to the current vcvars invocation.)

So we should change llvm-lib to match.

On the other hand, cvtres-converted object files have no symbols, so they don't
get loaded. Even more weird is that even /wholearchive doesn't load them -- it
seems as if /wholearchive is implemented by marking all entries in the lib's
symbol table as referenced, instead of acting as documented and loading all
files in the .lib as if they were passed directly.

lld-link has /wholearchive handling that matches link.exe's behavior, not its
documentation (which seems a good thing), so if we do change llvm-lib to cvtres
res files before archiving, then with lld-link /wholearchive they'd now get
loaded, different form link.exe. That isn't a problem yet, but only a single
obj file containing resources must be passed, else the resource section of the
output program is broken. link.exe has LNK1241 to error out when multiple
resource obj files are passed in, but lld-link doesn't -- it silently produces
broken output. And if we do the llvm-lib change, this will become more common.

So we should first give lld-link something like LNK1241, and then change

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190607/92c10375/attachment-0001.html>

More information about the llvm-bugs mailing list