From 415a189c09210ee5bc5d2d40556e69b5230bfc6a Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 6 Sep 2016 21:52:14 +0000 Subject: [PATCH] Make LLDB compile on Windows after the reformat. Most of these issues arose as a result of header re-ordering, but it turned up a real bug, which is that MSVC doesn't support __attribute__((packed)) or __attribute__((aligned)). This was working before because there's a Windows header that #defines __attribute__(x) to nothing. We should fix this by removing that #define entirely, and dealing with the fallout separately which may turn up even more bugs. I fixed this by replacing them with the corresponding LLVM macros which understand how to do these operations on all the different compilers. llvm-svn: 280757 --- lldb/include/lldb/Host/windows/AutoHandle.h | 2 ++ lldb/source/Plugins/Process/Utility/RegisterContext_x86.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lldb/include/lldb/Host/windows/AutoHandle.h b/lldb/include/lldb/Host/windows/AutoHandle.h index f8ca1ad..8c8c897 100644 --- a/lldb/include/lldb/Host/windows/AutoHandle.h +++ b/lldb/include/lldb/Host/windows/AutoHandle.h @@ -10,6 +10,8 @@ #ifndef LLDB_lldb_Host_windows_AutoHandle_h_ #define LLDB_lldb_Host_windows_AutoHandle_h_ +#include "lldb/Host/windows/windows.h" + namespace lldb_private { class AutoHandle { diff --git a/lldb/source/Plugins/Process/Utility/RegisterContext_x86.h b/lldb/source/Plugins/Process/Utility/RegisterContext_x86.h index 32e2a7f..0f241d5 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContext_x86.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContext_x86.h @@ -13,6 +13,8 @@ #include #include +#include "llvm/Support/Compiler.h" + //--------------------------------------------------------------------------- // i386 ehframe, dwarf regnums //--------------------------------------------------------------------------- @@ -285,14 +287,17 @@ struct YMM { YMMReg ymm[16]; // assembled from ymmh and xmm registers }; +LLVM_PACKED_START struct XSAVE_HDR { uint64_t xstate_bv; // OS enabled xstate mask to determine the extended states // supported by the processor uint64_t reserved1[2]; uint64_t reserved2[5]; -} __attribute__((packed)); +}; +LLVM_PACKED_END // x86 extensions to FXSAVE (i.e. for AVX processors) +LLVM_PACKED_START struct XSAVE { FXSAVE i387; // floating point registers typical in i387_fxsave_struct XSAVE_HDR header; // The xsave_hdr_struct can be used to determine if the @@ -300,7 +305,8 @@ struct XSAVE { YMMHReg ymmh[16]; // High 16 bytes of each of 16 YMM registers (the low bytes // are in FXSAVE.xmm for compatibility with SSE) // Slot any extensions to the register file here -} __attribute__((packed, aligned(64))); +} LLVM_ALIGNAS(64); +LLVM_PACKED_END // Floating-point registers struct FPR { -- 2.7.4