summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile39
-rw-r--r--lib/configtable.c3
-rw-r--r--lib/console.c21
-rw-r--r--lib/execute.c4
-rw-r--r--lib/print_crypto.c5
-rw-r--r--lib/security_policy.c4
-rw-r--r--lib/shell.c3
-rw-r--r--lib/simple_file.c4
-rw-r--r--lib/variables.c3
9 files changed, 45 insertions, 41 deletions
diff --git a/lib/Makefile b/lib/Makefile
index d9188c74..63893c3e 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,9 +2,44 @@ TARGET = lib.a
LIBFILES = $(foreach x,$(wildcard *.c),$(patsubst %.c,%.o,$(x)))
+CRYPTDIR = $(TOPDIR)/Cryptlib
+
INCLUDES = $(EFI_INCLUDES) \
- -I$(TOPDIR)/../include \
- -I$(TOPDIR)/CryptLib/Include/openssl/
+ -I$(TOPDIR)/include \
+ -I$(CRYPTDIR)/Include/openssl/ \
+ -I$(CRYPTDIR)/Include/ \
+ -I$(CRYPTDIR) \
+ -I$(TOPDIR) \
+ -isystem $(TOPDIR)/include/system \
+ -isystem $(shell $(CC) -print-file-name=include)
+
+CLANG_BUGS = $(if $(findstring gcc,$(CC)),-maccumulate-outgoing-args,)
+
+ifeq ($(ARCH),x86_64)
+FEATUREFLAGS += -m64 -mno-mmx -mno-sse -mno-red-zone -nostdinc $(CLANG_BUGS)
+DEFINES += -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI \
+ -UNO_BUILTIN_VA_FUNCS -DMDE_CPU_X64
+endif
+ifeq ($(ARCH),ia32)
+FEATUREFLAGS += -m32 -mno-mmx -mno-sse -mno-red-zone -nostdinc $(CLANG_BUGS)
+DEFINES += -DMDE_CPU_IA32
+endif
+ifeq ($(ARCH),aarch64)
+DEFINES += -DMDE_CPU_AARCH64
+endif
+ifeq ($(ARCH),arm)
+DEFINES += -DMDE_CPU_ARM
+endif
+
+LDFLAGS = -nostdlib -znocombreloc
+
+
+CFLAGS = $(FEATUREFLAGS) \
+ $(OPTIMIZATIONS) \
+ $(WARNFLAGS) \
+ $(WERRFLAGS) \
+ $(INCLUDES) \
+ $(DEFINES)
lib.a: $(LIBFILES)
$(AR) rcs lib.a $(LIBFILES)
diff --git a/lib/configtable.c b/lib/configtable.c
index 8675fad1..66e97f63 100644
--- a/lib/configtable.c
+++ b/lib/configtable.c
@@ -4,9 +4,6 @@
*
* read some platform configuration tables
*/
-#include <efi.h>
-#include <efilib.h>
-
#include "shim.h"
void *
diff --git a/lib/console.c b/lib/console.c
index ffa8ea5c..32c6d55d 100644
--- a/lib/console.c
+++ b/lib/console.c
@@ -3,11 +3,6 @@
* Copyright 2012 <James.Bottomley@HansenPartnership.com>
* Copyright 2013 Red Hat Inc. <pjones@redhat.com>
*/
-#include <efi.h>
-#include <efilib.h>
-#include <stdarg.h>
-#include <stdbool.h>
-
#include "shim.h"
static UINT8 console_text_mode = 0;
@@ -88,27 +83,27 @@ VOID console_fini(VOID)
setup_console(0);
}
-UINTN
+UINTN EFIAPI
console_print(const CHAR16 *fmt, ...)
{
- va_list args;
+ elf_va_list args;
UINTN ret;
if (!console_text_mode)
setup_console(1);
- va_start(args, fmt);
+ elf_va_start(args, fmt);
ret = VPrint(fmt, args);
- va_end(args);
+ elf_va_end(args);
return ret;
}
-UINTN
+UINTN EFIAPI
console_print_at(UINTN col, UINTN row, const CHAR16 *fmt, ...)
{
SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
- va_list args;
+ elf_va_list args;
UINTN ret;
if (!console_text_mode)
@@ -116,9 +111,9 @@ console_print_at(UINTN col, UINTN row, const CHAR16 *fmt, ...)
co->SetCursorPosition(co, col, row);
- va_start(args, fmt);
+ elf_va_start(args, fmt);
ret = VPrint(fmt, args);
- va_end(args);
+ elf_va_end(args);
return ret;
}
diff --git a/lib/execute.c b/lib/execute.c
index f57a6321..642f94a3 100644
--- a/lib/execute.c
+++ b/lib/execute.c
@@ -3,10 +3,6 @@
* Copyright 2012 <James.Bottomley@HansenPartnership.com>
* Code Copyright 2012 Red Hat, Inc <mjg@redhat.com>
*/
-
-#include <efi.h>
-#include <efilib.h>
-
#include "shim.h"
EFI_STATUS
diff --git a/lib/print_crypto.c b/lib/print_crypto.c
index 39dfd2c0..ccdb65b1 100644
--- a/lib/print_crypto.c
+++ b/lib/print_crypto.c
@@ -2,11 +2,6 @@
/*
* Copyright 2019 SUSE LLC <glin@suse.com>
*/
-
-#include <efi.h>
-#include <efilib.h>
-#include <stdarg.h>
-
#include "shim.h"
#include <Library/BaseCryptLib.h>
diff --git a/lib/security_policy.c b/lib/security_policy.c
index 6a9b13ed..6c42cc14 100644
--- a/lib/security_policy.c
+++ b/lib/security_policy.c
@@ -4,10 +4,6 @@
*
* Install and remove a platform security2 override policy
*/
-
-#include <efi.h>
-#include <efilib.h>
-
#include "shim.h"
#if defined(OVERRIDE_SECURITY_POLICY)
diff --git a/lib/shell.c b/lib/shell.c
index 87f279d6..146d9a21 100644
--- a/lib/shell.c
+++ b/lib/shell.c
@@ -4,9 +4,6 @@
*
* misc shell helper functions
*/
-#include <efi.h>
-#include <efilib.h>
-
#include "shim.h"
EFI_STATUS
diff --git a/lib/simple_file.c b/lib/simple_file.c
index e6544709..5fd3e1a6 100644
--- a/lib/simple_file.c
+++ b/lib/simple_file.c
@@ -2,10 +2,6 @@
/*
* Copyright 2012 <James.Bottomley@HansenPartnership.com>
*/
-
-#include <efi.h>
-#include <efilib.h>
-
#include "shim.h"
EFI_STATUS
diff --git a/lib/variables.c b/lib/variables.c
index 6db069ef..57875e26 100644
--- a/lib/variables.c
+++ b/lib/variables.c
@@ -10,9 +10,6 @@
* Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
*
*/
-#include <efi.h>
-#include <efilib.h>
-
#include "shim.h"
EFI_STATUS