mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "LeMay, Michael" <michael.lemay@intel.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: [RFC PATCH 7/7] add compiler flags to enable SafeStack
Date: Tue, 27 Sep 2016 15:39:17 -0700	[thread overview]
Message-ID: <61ee0149-88a1-0e3f-06f2-93c999177777@intel.com> (raw)

This adds the necessary compiler flags to build a
segmentation-hardened SafeStack runtime for 32-bit x86 Linux programs
with LLVM Clang.

Signed-off-by: Michael LeMay <michael.lemay@intel.com>
---
  Makefile | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/Makefile b/Makefile
index ec54880..b4203bb 100644
--- a/Makefile
+++ b/Makefile
@@ -128,6 +128,14 @@ NOSSP_SRCS = $(wildcard crt/*.c) \
      ldso/dlstart.c ldso/dynlink.c
  $(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += 
$(CFLAGS_NOSSP)

+ifeq ($(SAFE_STACK),yes)
+
+CFLAGS_SAFE_STACK = -DSAFE_STACK=1 -fsanitize=safe-stack -fruntime-init 
-mseparate-stack-seg
+NON_CRT_OBJS = $(filter-out $(CRT_OBJS),$(ALL_OBJS))
+$(NON_CRT_OBJS) $(NON_CRT_OBJS:%.o=%.lo): CFLAGS_ALL += 
$(CFLAGS_SAFE_STACK)
+
+endif
+
  $(CRT_OBJS): CFLAGS_ALL += -DCRT

  $(LOBJS) $(LDSO_OBJS): CFLAGS_ALL += -fPIC
-- 
2.7.4



                 reply	other threads:[~2016-09-27 22:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61ee0149-88a1-0e3f-06f2-93c999177777@intel.com \
    --to=michael.lemay@intel.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).