From: Pete Batard <pete@akeo.ie>

Subject: [PATCH] Fix MSVC breakage due to GNU align extensions in setjmp

* __attribute__((__aligned__(x))), which is used in setjmp, is GNU only => use a macro instead

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
This commit is contained in:
Nigel Croxon 2015-09-23 10:03:31 -04:00
parent 0b5f181a36
commit 9ce3546d05
6 changed files with 21 additions and 7 deletions

View File

@ -1,6 +1,8 @@
#ifndef GNU_EFI_AARCH64_SETJMP_H
#define GNU_EFI_AARCH64_SETJMP_H
#define JMPBUF_ALIGN 8
typedef struct {
/* GP regs */
UINT64 X19;
@ -26,6 +28,6 @@ typedef struct {
UINT64 D13;
UINT64 D14;
UINT64 D15;
} __attribute__((__aligned__(8))) jmp_buf;
} ALIGN(JMPBUF_ALIGN) jmp_buf;
#endif /* GNU_EFI_AARCH64_SETJMP_H */

View File

@ -1,6 +1,8 @@
#ifndef GNU_EFI_ARM_SETJMP_H
#define GNU_EFI_ARM_SETJMP_H
#define JMPBUF_ALIGN 4
typedef struct {
UINT32 R3; // A copy of R13
UINT32 R4;
@ -14,6 +16,6 @@ typedef struct {
UINT32 R12;
UINT32 R13;
UINT32 R14;
} __attribute__((__aligned__(4))) jmp_buf;
} ALIGN(JMPBUF_ALIGN) jmp_buf;
#endif /* GNU_EFI_ARM_SETJMP_H */

View File

@ -1,6 +1,12 @@
#ifndef GNU_EFI_SETJMP_H
#define GNU_EFI_SETJMP_H
#ifdef _MSC_EXTENSIONS
#define ALIGN(x) __declspec(align(x))
#else
#define ALIGN(x) __attribute__((__aligned__(x)))
#endif
#include "efisetjmp_arch.h"
extern UINTN setjmp(jmp_buf *env);

View File

@ -1,6 +1,8 @@
#ifndef GNU_EFI_IA32_SETJMP_H
#define GNU_EFI_IA32_SETJMP_H
#define JMPBUF_ALIGN 4
typedef struct {
UINT32 Ebx;
UINT32 Esi;
@ -8,8 +10,6 @@ typedef struct {
UINT32 Ebp;
UINT32 Esp;
UINT32 Eip;
} __attribute__((__aligned__(4))) jmp_buf;
#define JMPBUF_ALIGN 4
} ALIGN(JMPBUF_ALIGN) jmp_buf;
#endif /* GNU_EFI_IA32_SETJMP_H */

View File

@ -1,6 +1,8 @@
#ifndef GNU_EFI_IA64_SETJMP_H
#define GNU_EFI_IA64_SETJMP_H
#define JMPBUF_ALIGN 0x10
typedef struct {
UINT64 F2[2];
UINT64 F3[2];
@ -40,6 +42,6 @@ typedef struct {
UINT64 Predicates;
UINT64 LoopCount;
UINT64 FPSR;
} __attribute__((__aligned__(0x10))) jmp_buf;
} ALIGN(JMPBUF_ALIGN) jmp_buf;
#endif /* GNU_EFI_IA64_SETJMP_H */

View File

@ -1,6 +1,8 @@
#ifndef GNU_EFI_X86_64_SETJMP_H
#define GNU_EFI_X86_64_SETJMP_H
#define JMPBUF_ALIGN 8
typedef struct {
UINT64 Rbx;
UINT64 Rsp;
@ -15,6 +17,6 @@ typedef struct {
UINT64 Rip;
UINT64 MxCsr;
UINT8 XmmBuffer[160]; // XMM6 - XMM15
} __attribute__((__aligned__(8))) jmp_buf;
} ALIGN(JMPBUF_ALIGN) jmp_buf;
#endif /* GNU_EFI_X86_64_SETJMP_H */