[openssh-commits] [openssh] 01/01: (yet) another x-platform fix for sk-dummy.so

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Nov 29 12:33:05 AEDT 2019


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit b218055e59a7c1a1816f7a55ca18e3f3c05d63a4
Author: Damien Miller <djm at mindrot.org>
Date:   Fri Nov 29 12:32:23 2019 +1100

    (yet) another x-platform fix for sk-dummy.so
    
    Check for -fPIC support from compiler
    
    Compile libopenbsd-compat -fPIC
    
    Don't mix -fPIE and -fPIC when compiling
---
 Makefile.in                |  4 +++-
 configure.ac               | 16 ++++++++++++++++
 openbsd-compat/Makefile.in |  4 +++-
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 692b0073..a3760562 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -43,7 +43,9 @@ PATHS= -DSSHDIR=\"$(sysconfdir)\" \
 CC=@CC@
 LD=@LD@
 CFLAGS=@CFLAGS@
+CFLAGS_NOPIE=@CFLAGS_NOPIE@
 CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
+PICFLAG=@PICFLAG@
 LIBS=@LIBS@
 K5LIBS=@K5LIBS@
 GSSLIBS=@GSSLIBS@
@@ -601,7 +603,7 @@ SK_DUMMY_OBJS=\
 	ed25519.lo hash.lo ge25519.lo fe25519.lo sc25519.lo verify.lo
 
 .c.lo: Makefile.in config.h
-	$(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c $< -o $@
+	$(CC) $(CFLAGS_NOPIE) $(PICFLAG) $(CPPFLAGS) -c $< -o $@
 
 regress/misc/sk-dummy/sk-dummy.so: $(SK_DUMMY_OBJS)
 	$(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -shared -o $@ $(SK_DUMMY_OBJS) \
diff --git a/configure.ac b/configure.ac
index 1749b290..c57b2401 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1725,6 +1725,18 @@ if test "x$use_pie" != "xno"; then
 	fi
 fi
 
+AC_MSG_CHECKING([whether -fPIC is accepted])
+SAVED_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fPIC"
+AC_COMPILE_IFELSE(
+	[AC_LANG_PROGRAM( [[ #include <stdlib.h> ]], [[ exit(0); ]] )],
+   [AC_MSG_RESULT([yes])
+    PICFLAG="-fPIC"; ],
+   [AC_MSG_RESULT([no])
+    PICFLAG=""; ])
+CFLAGS="$SAVED_CFLAGS"
+AC_SUBST([PICFLAG])
+
 dnl    Checks for library functions. Please keep in alphabetical order
 AC_CHECK_FUNCS([ \
 	Blowfish_initstate \
@@ -5301,6 +5313,10 @@ AC_SUBST([DEPEND], [$(cat $srcdir/.depend)])
 CFLAGS="${CFLAGS} ${CFLAGS_AFTER}"
 LDFLAGS="${LDFLAGS} ${LDFLAGS_AFTER}"
 
+# Make a copy of CFLAGS without -fpie
+CFLAGS_NOPIE=`echo "$CFLAGS" | sed 's/ -fPIE//'`
+AC_SUBST([CFLAGS_NOPIE])
+
 AC_EXEEXT
 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
 	openbsd-compat/Makefile openbsd-compat/regress/Makefile \
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index 94fb0a55..c2423324 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -7,7 +7,9 @@ VPATH=@srcdir@
 CC=@CC@
 LD=@LD@
 CFLAGS=@CFLAGS@
+CFLAGS_NOPIE=@CFLAGS_NOPIE@
 CPPFLAGS=-I. -I.. -I$(srcdir) -I$(srcdir)/.. @CPPFLAGS@ @DEFS@
+PICFLAG=@PICFLAG@
 LIBS=@LIBS@
 AR=@AR@
 RANLIB=@RANLIB@
@@ -97,7 +99,7 @@ PORTS=	port-aix.o \
 	port-uw.o
 
 .c.o:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+	$(CC) $(CFLAGS_NOPIE) $(PICFLAG) $(CPPFLAGS) -c $<
 
 all: libopenbsd-compat.a
 

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list