mirror of https://github.com/ncroxon/gnu-efi
fix clang support.
Tested: make all apps + tests apps/ on x86_64 make CC=clang all apps + tests apps/ on x86_64 Signed-off-by: David Decotigny <ddecotig@gmail.com> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
This commit is contained in:
parent
bdb6182f0a
commit
787cb7fcd8
|
@ -101,6 +101,7 @@ endif
|
||||||
ifeq ($(ARCH),x86_64)
|
ifeq ($(ARCH),x86_64)
|
||||||
GCCVERSION := $(shell $(CC) -dumpversion | cut -f1 -d.)
|
GCCVERSION := $(shell $(CC) -dumpversion | cut -f1 -d.)
|
||||||
GCCMINOR := $(shell $(CC) -dumpversion | cut -f2 -d.)
|
GCCMINOR := $(shell $(CC) -dumpversion | cut -f2 -d.)
|
||||||
|
USING_CLANG := $(shell $(CC) -v 2>&1 | grep -q 'clang version' && echo clang)
|
||||||
|
|
||||||
# Rely on GCC MS ABI support?
|
# Rely on GCC MS ABI support?
|
||||||
GCCNEWENOUGH := $(shell ( [ $(GCCVERSION) -gt "4" ] \
|
GCCNEWENOUGH := $(shell ( [ $(GCCVERSION) -gt "4" ] \
|
||||||
|
@ -109,6 +110,8 @@ ifeq ($(ARCH),x86_64)
|
||||||
&& echo 1)
|
&& echo 1)
|
||||||
ifeq ($(GCCNEWENOUGH),1)
|
ifeq ($(GCCNEWENOUGH),1)
|
||||||
CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
|
CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
|
||||||
|
else ifeq ($(USING_CLANG),clang)
|
||||||
|
CPPFLAGS += -DGNU_EFI_USE_MS_ABI --std=c11
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -mno-red-zone
|
CFLAGS += -mno-red-zone
|
||||||
|
@ -159,7 +162,7 @@ CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \
|
||||||
else
|
else
|
||||||
CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \
|
CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \
|
||||||
-fshort-wchar -fno-strict-aliasing \
|
-fshort-wchar -fno-strict-aliasing \
|
||||||
-fno-merge-constants -ffreestanding -fno-stack-protector \
|
-fno-merge-all-constants -ffreestanding -fno-stack-protector \
|
||||||
-fno-stack-check
|
-fno-stack-check
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,13 @@ GetVariable(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner)
|
||||||
EFI_GUID DUMMY_GUID =
|
EFI_GUID DUMMY_GUID =
|
||||||
{0x55aad538, 0x8f82, 0x4e2a, {0xa4,0xf0,0xbe, 0x59, 0x13, 0xb6, 0x5f, 0x1e}};
|
{0x55aad538, 0x8f82, 0x4e2a, {0xa4,0xf0,0xbe, 0x59, 0x13, 0xb6, 0x5f, 0x1e}};
|
||||||
|
|
||||||
static void
|
#if defined(__clang__)
|
||||||
__attribute__((__optimize__("0")))
|
# define _OPTNONE __attribute__((optnone))
|
||||||
|
#else
|
||||||
|
# define _OPTNONE __attribute__((__optimize__("0")))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static _OPTNONE void
|
||||||
DebugHook(void)
|
DebugHook(void)
|
||||||
{
|
{
|
||||||
EFI_GUID guid = DUMMY_GUID;
|
EFI_GUID guid = DUMMY_GUID;
|
||||||
|
|
|
@ -25,6 +25,8 @@ Revision History
|
||||||
#if defined(GNU_EFI_USE_MS_ABI)
|
#if defined(GNU_EFI_USE_MS_ABI)
|
||||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
|
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
|
||||||
#define HAVE_USE_MS_ABI 1
|
#define HAVE_USE_MS_ABI 1
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#define HAVE_USE_MS_ABI 1
|
||||||
#else
|
#else
|
||||||
#error Compiler is too old for GNU_EFI_USE_MS_ABI
|
#error Compiler is too old for GNU_EFI_USE_MS_ABI
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -97,7 +97,7 @@ static struct {
|
||||||
{ &SMapId, L"ShellDevPathMap" },
|
{ &SMapId, L"ShellDevPathMap" },
|
||||||
{ &SAliasId, L"ShellAlias" },
|
{ &SAliasId, L"ShellAlias" },
|
||||||
|
|
||||||
{ NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue