From fb334919d8119d40fc5602d604ae80117aaf0da0 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 25 Aug 2019 20:27:53 +0000 Subject: [PATCH] Use paxctl on NetBSD to allow PROT_WRITE|PROT_EXEC. --- src/microcode/configure.ac | 10 ++++++++++ src/microcode/makegen/Makefile.in.in | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/microcode/configure.ac b/src/microcode/configure.ac index 6f6ce125f..4664ad85b 100644 --- a/src/microcode/configure.ac +++ b/src/microcode/configure.ac @@ -204,6 +204,16 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +case $host_os in +netbsd*) + AC_CHECK_TOOL([PAXCTL], [paxctl], [:]) + ;; +*) + PAXCTL=: + AC_SUBST([PAXCTL]) + ;; +esac + : ${HOST_CC:=${CC}} if test x"${GCC}" = xyes; then diff --git a/src/microcode/makegen/Makefile.in.in b/src/microcode/makegen/Makefile.in.in index 0b19ba0e3..5e19bb008 100644 --- a/src/microcode/makegen/Makefile.in.in +++ b/src/microcode/makegen/Makefile.in.in @@ -75,6 +75,7 @@ M4 = $(srcdir)/makegen/m4.sh @M4@ AS = @AS@ TAR = tar GZIP_ENV = --best +PAXCTL = @PAXCTL@ DEFS = @DEFS@ @SCHEME_DEFS@ -DDEFAULT_LIBRARY_PATH=\"$(AUXDIR)\" CFLAGS = @CFLAGS@ @@ -86,6 +87,7 @@ AS_FLAGS = @AS_FLAGS@ COMPILE = $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) LINK = $(CCLD) $(LDFLAGS) -o $@ +LINKTMP = $(CCLD) $(LDFLAGS) -o $@.tmp EXPAND = $(M4) $(M4_FLAGS) ASSEMBLE = $(AS) $(AS_FLAGS) @@ -165,7 +167,9 @@ all: $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA) scheme: $(scheme_OBJECTS) $(scheme_DEPENDENCIES) -rm -f $@ - $(LINK) $(scheme_LDFLAGS) $(scheme_OBJECTS) $(scheme_LIBS) + $(LINKTMP) $(scheme_LDFLAGS) $(scheme_OBJECTS) $(scheme_LIBS) + $(PAXCTL) +m $@.tmp + mv -f $@.tmp $@ usrdef.c: $(STD_SOURCES) findprim Makefile -rm -f $@.tmp -- 2.25.1