From fe19127c66884a9ad0d48989bccef8f496af5557 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 6 Dec 2020 02:54:01 -0600 Subject: [PATCH] build: add support for EXPORT_UNPREFIXED=no In an EXPORT_UNPREFIXED=no build, getcontext/makecontext/setcontext/swapcontext symbols are not provided. --- Makefile | 5 +++++ arch/common/common-defs.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 3277990..9f0c134 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,11 @@ endif LIBDIR := /lib CFLAGS := -ggdb3 -O2 -Wall CPPFLAGS := -Iarch/${ARCH} -Iarch/common +EXPORT_UNPREFIXED := yes + +ifeq ($(EXPORT_UNPREFIXED),yes) + CFLAGS += -DEXPORT_UNPREFIXED +endif LIBUCONTEXT_C_SRC = $(wildcard arch/${ARCH}/*.c) LIBUCONTEXT_S_SRC = $(wildcard arch/${ARCH}/*.S) diff --git a/arch/common/common-defs.h b/arch/common/common-defs.h index 618116b..e32d47f 100644 --- a/arch/common/common-defs.h +++ b/arch/common/common-defs.h @@ -36,9 +36,13 @@ __proc: \ .size __proc,.-__proc; #endif +#ifdef EXPORT_UNPREFIXED #define ALIAS(__alias, __real) \ .weak __alias; \ __alias = __real; +#else +#define ALIAS(...) +#endif #define REG_OFFSET(__reg) (MCONTEXT_GREGS + ((__reg) * REG_SZ))