diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-09 05:14:23 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-09 05:14:23 +0000 |
commit | 6fa6a32e4e2fdbb77c82fd7f64a7232cdcac994e (patch) | |
tree | 914c16b89dfc2af72fe4eb3a213c4db392be03c2 /lib/System | |
parent | b02b8af3780e4e7942cb6e5d25260a608076fe6d (diff) | |
download | external_llvm-6fa6a32e4e2fdbb77c82fd7f64a7232cdcac994e.zip external_llvm-6fa6a32e4e2fdbb77c82fd7f64a7232cdcac994e.tar.gz external_llvm-6fa6a32e4e2fdbb77c82fd7f64a7232cdcac994e.tar.bz2 |
Add a little wrapper header that is put around bc files when emitting
bc files for modules with a target triple that indicates they are for
darwin. The reader unconditionally handles this, and the writer could
turn this on for more targets if we care.
This change has two benefits for darwin:
1) it allows us to encode the cpu type of the file in an easy to read
place that doesn't require decoding the bc file.
2) it works around a bug (IMO) in darwin's AR where it is incapable of
handling files that are not a multiple of 8 bytes long. BC files
are only guaranteed to be multiples of 4 bytes long.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53275 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r-- | lib/System/Path.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp index fbb6b66..88479fe 100644 --- a/lib/System/Path.cpp +++ b/lib/System/Path.cpp @@ -52,10 +52,15 @@ Path::GetLLVMConfigDir() { } LLVMFileType -sys::IdentifyFileType(const char*magic, unsigned length) { +sys::IdentifyFileType(const char *magic, unsigned length) { assert(magic && "Invalid magic number string"); assert(length >=4 && "Invalid magic number length"); switch (magic[0]) { + case 0xDE: // 0x0B17C0DE = BC wraper + if (magic[1] == (char)0xC0 && magic[2] == (char)0x17 && + magic[3] == (char)0x0B) + return Bitcode_FileType; + break; case 'B': if (magic[1] == 'C' && magic[2] == (char)0xC0 && magic[3] == (char)0xDE) return Bitcode_FileType; |