[PATCH] Recognize 0x0000 as a COFF file magic.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Nov 13 20:02:15 PST 2013


Same comment. coff_object is not being used and you can probably add a
more complete test with llvm-readobj.

On 13 November 2013 17:03, Rui Ueyama <ruiu at google.com> wrote:
>   - added a test
>
> Hi Bigcheese,
>
> http://llvm-reviews.chandlerc.com/D2164
>
> CHANGE SINCE LAST DIFF
>   http://llvm-reviews.chandlerc.com/D2164?vs=5495&id=5519#toc
>
> Files:
>   lib/Support/Path.cpp
>   unittests/Support/Path.cpp
>
> Index: lib/Support/Path.cpp
> ===================================================================
> --- lib/Support/Path.cpp
> +++ lib/Support/Path.cpp
> @@ -853,6 +853,9 @@
>        if (Magic.size() >= sizeof(Expected) &&
>            memcmp(Magic.data(), Expected, sizeof(Expected)) == 0)
>          return file_magic::windows_resource;
> +      // 0x0000 = COFF unknown machine type
> +      if (Magic[1] == 0)
> +        return file_magic::coff_object;
>        break;
>      }
>      case 0xDE:  // 0x0B17C0DE = BC wraper
> Index: unittests/Support/Path.cpp
> ===================================================================
> --- unittests/Support/Path.cpp
> +++ unittests/Support/Path.cpp
> @@ -418,6 +418,7 @@
>
>  const char archive[] = "!<arch>\x0A";
>  const char bitcode[] = "\xde\xc0\x17\x0b";
> +const char coff_object[] = "\x00\x00";
>  const char elf_relocatable[] = { 0x7f, 'E', 'L', 'F', 1, 2, 1, 0, 0,
>                                   0,    0,   0,   0,   0, 0, 0, 0, 1 };
>  const char macho_universal_binary[] = "\xca\xfe\xba\xbe...\0x00";



More information about the llvm-commits mailing list