Check for gcc in Makefile
authorJagger <robert@swiecki.net>
Tue, 8 Mar 2016 23:56:20 +0000 (00:56 +0100)
committerJagger <robert@swiecki.net>
Tue, 8 Mar 2016 23:56:20 +0000 (00:56 +0100)
Makefile
cmdline.c

index 7d9acb8242b647c3aec740c6367652e7b8264f88..2c9ed8f374fc476503d323965d730170acbcfdf6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #
 #   nsjail - Makefile
-#      -----------------------------------------
+#   -----------------------------------------
 #
 #   Copyright 2014 Google Inc. All Rights Reserved.
 #
@@ -24,16 +24,20 @@ CFLAGS += -O2 -g -ggdb -c -std=gnu11 \
        -fstack-protector-all -Wformat -Wformat=2 -Wformat-security -fPIE \
        -Wall -Wextra -Werror
 
-LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie -Wa,--noexecstack
+LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
 
 COMPILER_CLANG = $(shell $(CC) -v 2>&1 | grep "clang version" | grep -o "clang")
+COMPILER_GCC = $(shell $(CC) -v 2>&1 | grep "gcc version" | grep -o "gcc")
 
 ifeq ($(COMPILER_CLANG),clang)
        CFLAGS += -fblocks
        LDFLAGS += -lBlocksRuntime
 endif
+ifeq ($(COMPILER_CLANG),gcc)
+       LDFLAGS += -Wa,--noexecstack
+endif
 
-SRCS = nsjail.c cmdline.c contain.c log.c net.c mount.c user.c subproc.c sandbox.c util.c uts.c seccomp/bpf-helper.c
+SRCS = nsjail.c cmdline.c contain.c log.c mount.c net.c sandbox.c subproc.c user.c util.c uts.c seccomp/bpf-helper.c
 OBJS = $(SRCS:.c=.o)
 BIN = nsjail
 
index b2d7e18d62e64abfccbd71174a3b434200961e41..21c9aabfaedd87796162c21a44a0875a8ee09e78 100644 (file)
--- a/cmdline.c
+++ b/cmdline.c
@@ -350,7 +350,7 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
                {{"tmpfs_size", required_argument, NULL, 0x0602}, "Number of bytes to allocate for tmpfsmounts (default: 4194304)"},
                {{"disable_proc", no_argument, NULL, 0x0603}, "Disable mounting /proc in the jail"},
                {{"iface_no_lo", no_argument, NULL, 0x700}, "Don't bring up the 'lo' interface"},
-               {{"iface", required_argument, NULL, 'I'}, "Interface which will be cloned (MACVTAP) and put inside the subprocess' namespace as 'vs'"},
+               {{"iface", required_argument, NULL, 'I'}, "Interface which will be cloned (MACVLAN) and put inside the subprocess' namespace as 'vs'"},
                {{"iface_vs_ip", required_argument, NULL, 0x701}, "IP of the 'vs' interface"},
                {{"iface_vs_nm", required_argument, NULL, 0x702}, "Netmask of the 'vs' interface"},
                {{"iface_vs_gw", required_argument, NULL, 0x703}, "Default GW for the 'vs' interface"},