From patchwork Wed Jan 1 12:30:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 239045 List-Id: U-Boot discussion From: xypron.glpk at gmx.de (Heinrich Schuchardt) Date: Wed, 1 Jan 2020 13:30:43 +0100 Subject: [PATCH 1/1] efi_loader: __cyg_profile_func_enter/_exit Message-ID: <20200101123043.26199-1-xypron.glpk@gmx.de> U-Boot can be compiled with function tracing enabled. When compiling with FTRACE __cyg_profile_func_enter() is called when a function is entered and __cyg_profile_func_exit() when a function is left. To avoid a crash we have to define these function for the free-standing UEFI binaries. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/Makefile | 2 ++ lib/efi_loader/efi_freestanding.c | 32 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) -- 2.24.1 diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 04dc864851..f1de2158c3 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -9,6 +9,8 @@ asflags-y += -DHOST_ARCH="$(HOST_ARCH)" ccflags-y += -DHOST_ARCH="$(HOST_ARCH)" +ccflags-y += -finstrument-functions + CFLAGS_efi_boottime.o += \ -DFW_VERSION="0x$(VERSION)" \ -DFW_PATCHLEVEL="0x$(PATCHLEVEL)" diff --git a/lib/efi_loader/efi_freestanding.c b/lib/efi_loader/efi_freestanding.c index bd9da5bbc8..dcf5d1c49a 100644 --- a/lib/efi_loader/efi_freestanding.c +++ b/lib/efi_loader/efi_freestanding.c @@ -88,3 +88,35 @@ void *memset(void *s, int c, size_t n) *d++ = c; return s; } + +/** + * __cyg_profile_func_enter() - record function entry + * + * This is called on every function entry when compiling with + * -finstrument-functions. + * + * We do nothing here. + * + * @param func_ptr Pointer to function being entered + * @param caller Pointer to function which called this function + */ +void __attribute__((no_instrument_function)) +__cyg_profile_func_enter(void *func_ptr, void *caller) +{ +} + +/** + * __cyg_profile_func_exit() - record function exit + * + * This is called on every function exit when compiling with + * -finstrument-functions. + * + * We do nothing here. + * + * @param func_ptr Pointer to function being entered + * @param caller Pointer to function which called this function + */ +void __attribute__((no_instrument_function)) +__cyg_profile_func_exit(void *func_ptr, void *caller) +{ +}