diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-21 20:52:03 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-21 20:52:03 +0000 |
commit | 97defc37d66d678bbca4a23d522f0942f7431db9 (patch) | |
tree | 56cc56631ccfee5f1ca3132036c8d101b75899d7 | |
parent | fca01b5e2b509f2e9aeeb1cc51aea89c3722cb2e (diff) | |
download | external_llvm-97defc37d66d678bbca4a23d522f0942f7431db9.zip external_llvm-97defc37d66d678bbca4a23d522f0942f7431db9.tar.gz external_llvm-97defc37d66d678bbca4a23d522f0942f7431db9.tar.bz2 |
Fix misaligned access in MachO object file reader: despite containing an
int64_t, Symbol64TableEntry is actually only stored with 4-byte alignment
within the file.
The usage of #pragma pack here is copied from the corresponding code in
Support/Endian.h, so shouldn't introduce any new portability problems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162312 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Object/MachOFormat.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/Object/MachOFormat.h b/include/llvm/Object/MachOFormat.h index f30d431..e4bfcc6 100644 --- a/include/llvm/Object/MachOFormat.h +++ b/include/llvm/Object/MachOFormat.h @@ -273,6 +273,10 @@ namespace macho { uint16_t Flags; uint32_t Value; }; + // Despite containing a uint64_t, this structure is only 4-byte aligned within + // a MachO file. +#pragma pack(push) +#pragma pack(4) struct Symbol64TableEntry { uint32_t StringIndex; uint8_t Type; @@ -280,6 +284,7 @@ namespace macho { uint16_t Flags; uint64_t Value; }; +#pragma pack(pop) /// @} /// @name Data-in-code Table Entry |