build: add support for EXPORT_UNPREFIXED=no

In an EXPORT_UNPREFIXED=no build, getcontext/makecontext/setcontext/swapcontext
symbols are not provided.
master
Ariadne Conill 2020-12-06 02:54:01 -06:00
parent 8b7cefd98d
commit fe19127c66
2 changed files with 9 additions and 0 deletions

View File

@ -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)

View File

@ -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))