[llvm] r239110 - [Object, MachO] Fixup for r239075: use union to store mach_header and mach_header_64.
Rafael EspĂndola
rafael.espindola at gmail.com
Thu Jun 4 16:03:59 PDT 2015
Thanks!
On Jun 4, 2015 7:01 PM, "Alexey Samsonov" <vonosmas at gmail.com> wrote:
> Author: samsonov
> Date: Thu Jun 4 17:49:55 2015
> New Revision: 239110
>
> URL: http://llvm.org/viewvc/llvm-project?rev=239110&view=rev
> Log:
> [Object, MachO] Fixup for r239075: use union to store mach_header and
> mach_header_64.
>
> Modified:
> llvm/trunk/include/llvm/Object/MachO.h
> llvm/trunk/lib/Object/MachOObjectFile.cpp
>
> Modified: llvm/trunk/include/llvm/Object/MachO.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=239110&r1=239109&r2=239110&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/MachO.h (original)
> +++ llvm/trunk/include/llvm/Object/MachO.h Thu Jun 4 17:49:55 2015
> @@ -429,7 +429,10 @@ public:
> }
>
> private:
> - MachO::mach_header_64 Header64;
> + union {
> + MachO::mach_header_64 Header64;
> + MachO::mach_header Header;
> + };
> typedef SmallVector<const char*, 1> SectionList;
> SectionList Sections;
> typedef SmallVector<const char*, 1> LibraryList;
>
> Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=239110&r1=239109&r2=239110&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/MachOObjectFile.cpp Thu Jun 4 17:49:55 2015
> @@ -234,10 +234,7 @@ MachOObjectFile::MachOObjectFile(MemoryB
> if (is64Bit())
> parseHeader(this, Header64, EC);
> else
> - // First fields of MachO::mach_header_64 are the same as
> - // in MachO::mach_header.
> - parseHeader(this, *reinterpret_cast<MachO::mach_header
> *>(&this->Header64),
> - EC);
> + parseHeader(this, Header, EC);
> if (EC)
> return;
>
> @@ -1251,7 +1248,6 @@ unsigned MachOObjectFile::getArch() cons
>
> Triple MachOObjectFile::getArch(const char **McpuDefault,
> Triple *ThumbTriple) const {
> - const auto &Header = getHeader();
> *ThumbTriple = getThumbArch(Header.cputype, Header.cpusubtype,
> McpuDefault);
> return getArch(Header.cputype, Header.cpusubtype, McpuDefault);
> }
> @@ -2186,9 +2182,7 @@ MachOObjectFile::getDice(DataRefImpl Rel
> }
>
> const MachO::mach_header &MachOObjectFile::getHeader() const {
> - // First fields of MachO::mach_header_64 are the same as
> - // in MachO::mach_header.
> - return *reinterpret_cast<const MachO::mach_header *>(&this->Header64);
> + return Header;
> }
>
> const MachO::mach_header_64 &MachOObjectFile::getHeader64() const {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150604/a78f454d/attachment.html>
More information about the llvm-commits
mailing list