[PATCH 2/9] libc: add rule to generate ucontext_i.{c, h, s} files and clean them

Florian Fainelli florian at openwrt.org
Mon Dec 31 14:38:25 UTC 2012


This patch adds the required rules to generate the ucontext_i.{c,h,s}
files from the architecture specific ucontext_i.sym file. Such files are
required to properly support user-space context functions
({get,set,swap,make}context), and as such is made conditional on
UCLIBC_HAS_CONTEXT_FUNCS.

Signed-off-by: Florian Fainelli <florian at openwrt.org>
---
 libc/sysdeps/linux/Makefile.commonarch |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch
index c1bc5df..36f2eb0 100644
--- a/libc/sysdeps/linux/Makefile.commonarch
+++ b/libc/sysdeps/linux/Makefile.commonarch
@@ -39,3 +39,21 @@ HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)):
 	$(do_rm) $(ARCH_HEADERS_OUT)
 
 endif
+
+ifeq ($(UCLIBC_HAS_CONTEXT_FUNCS),y)
+CFLAGS-ucontext_i.c = -S
+
+$(ARCH_OUT)/ucontext_i.c: $(ARCH_DIR)/ucontext_i.sym
+	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
+
+$(ARCH_OUT)/ucontext_i.s: $(ARCH_OUT)/ucontext_i.c
+	$(compile.c)
+
+$(ARCH_OUT)/ucontext_i.h: $(ARCH_OUT)/ucontext_i.s
+	$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
+
+libc_arch_headers: $(ARCH_OUT)/ucontext_i.h
+
+libc_arch_headers_clean:
+	$(do_rm) $(addprefix $(ARCH_OUT)/ucontext_i., c h s)
+endif
-- 
1.7.10.4



More information about the uClibc mailing list