[llvm-bugs] [Bug 44683] New: file_magic identifies file with two leading null bytes as a COFF object

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 27 12:13:07 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44683

            Bug ID: 44683
           Summary: file_magic identifies file with two leading null bytes
                    as a COFF object
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Object
          Assignee: unassignedbugs at nondot.org
          Reporter: sbc at chromium.org
                CC: llvm-bugs at lists.llvm.org

This is because the first two bytes of COFF is the machine type and machine
type 0 is IMAGE_FILE_MACHINE_UNKNOWN.

See:
https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types

Is is a minor annoyance when dealing with rust archives because rust archives
because they seem to include a rust metadata file .. which means running
llvm-nm on them always generates a strange error such as:

`llvm-nm: error: libtest.a(rust.metadata.bin) The end of the file was
unexpectedly encountered
`

llvm-nm ignores non-object files but it thinks this file is a COFF object
becasue the file starts with bunch of leading zeros.

I think we can perhaps modify file_magic to be a little less eager when
identifying COFF objects.

-- 
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/20200127/79bab46d/attachment.html>


More information about the llvm-bugs mailing list