diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-03-23 03:38:05 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-03-23 03:38:05 +0000 |
| commit | 96cf6c3892f08452273a9f3a2be495771bfa4edc (patch) | |
| tree | 87cb40e55fbf0101e19bf4948b43172c30c1bc86 | |
| parent | a6e3a599d150361abc655122258ee21331ef4618 (diff) | |
| download | bcm5719-llvm-96cf6c3892f08452273a9f3a2be495771bfa4edc.tar.gz bcm5719-llvm-96cf6c3892f08452273a9f3a2be495771bfa4edc.zip | |
InstrProf: Indicate pointer size in raw profile
Since the profile can come from 32-bit machines, the reader needs to
check the pointer size. Change the magic number to facilitate this.
<rdar://problem/16400648>
llvm-svn: 204556
| -rw-r--r-- | compiler-rt/lib/profile/InstrProfiling.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler-rt/lib/profile/InstrProfiling.c b/compiler-rt/lib/profile/InstrProfiling.c index 970907c405b..123dd0d3b35 100644 --- a/compiler-rt/lib/profile/InstrProfiling.c +++ b/compiler-rt/lib/profile/InstrProfiling.c @@ -14,11 +14,13 @@ uint64_t __llvm_profile_get_magic(void) { /* Magic number to detect file format and endianness. * * Use 255 at one end, since no UTF-8 file can use that character. Avoid 0, - * so that utilities like strings doesn't grab it as a string. 129 is high - * enough to be interesting. + * so that utilities, like strings, don't grab it as a string. 129 is also + * invalid UTF-8, and high enough to be interesting. * - * Use "lprofr" in the centre to stand for "LLVM Profile Raw". + * Use "lprofr" in the centre to stand for "LLVM Profile Raw", or "lprofR" + * for 32-bit platforms. */ + unsigned char R = sizeof(void *) == sizeof(uint64_t) ? 'r' : 'R'; return (uint64_t)255 << 56 | (uint64_t)'l' << 48 | @@ -26,7 +28,7 @@ uint64_t __llvm_profile_get_magic(void) { (uint64_t)'r' << 32 | (uint64_t)'o' << 24 | (uint64_t)'f' << 16 | - (uint64_t)'r' << 8 | + (uint64_t) R << 8 | (uint64_t)129; } |

