Disable -fpie

- Fix HiPE by disabling -fpie
- Fix dialyzer generation

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
This commit is contained in:
Peter Lemenkov 2016-11-23 21:09:08 +03:00
parent 52fefe46a4
commit d8d49b5b3e
3 changed files with 91 additions and 1 deletions

View File

@ -66,7 +66,7 @@
Name: erlang
Version: 19.1.6
Release: 1%{?dist}
Release: 2%{?dist}
Summary: General-purpose programming language and runtime environment
Group: Development/Languages
@ -116,6 +116,12 @@ Patch5: otp-0005-Do-not-install-nteventlog-and-related-doc-files-on-n.patch
# Fedora specific patch
# Do not install erlang sources
Patch6: otp-0006-Do-not-install-erlang-sources.patch
# Fedora specific patch
# erts: Fix correct link flags for hipe_mkliterals
Patch7: otp-0007-erts-Fix-correct-link-flags-for-hipe_mkliterals.patch
# Fedora specific patch
# erts: Disable -fPIE for HiPE on x86_64
Patch8: otp-0008-erts-Disable-fPIE-for-HiPE-on-x86_64.patch
# end of autogenerated patch tag list
BuildRequires: flex
@ -926,6 +932,8 @@ Provides support for XML 1.0.
%patch4 -p1 -b .Do_not_install_Java_sources
%patch5 -p1 -b .Do_not_install_nteventlog_and_related_doc_files_on_n
%patch6 -p1 -b .Do_not_install_erlang_sources
%patch7 -p1 -b .erts_Fix_correct_link_flags_for_hipe_mkliterals
%patch8 -p1 -b .erts_Disable_fPIE_for_HiPE_on_x86_64
# end of autogenerated prep patch list
# FIXME we should come up with a better solution
@ -2310,6 +2318,10 @@ useradd -r -g epmd -d /tmp -s /sbin/nologin \
%changelog
* Wed Nov 23 2016 Peter Lemenkov <lemenkov@gmail.com> - 19.1.6-2
- Fix HiPE by disabling -fpie
- Fix dialyzer generation
* Wed Nov 9 2016 Peter Lemenkov <lemenkov@gmail.com> - 19.1.6-1
- Ver. 19.1.6

View File

@ -0,0 +1,45 @@
From: Sverker Eriksson <sverker@erlang.org>
Date: Wed, 9 Nov 2016 16:52:23 +0100
Subject: [PATCH] erts: Fix correct link flags for hipe_mkliterals
and no need for $(INCLUDED).
diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in
index e026020..8772bef 100644
--- a/erts/emulator/Makefile.in
+++ b/erts/emulator/Makefile.in
@@ -49,6 +49,7 @@ CREATE_DIRS=
LDFLAGS=@LDFLAGS@
ARFLAGS=rc
OMIT_OMIT_FP=no
+TYPE_LIBS=
DIRTY_SCHEDULER_SUPPORT=@DIRTY_SCHEDULER_SUPPORT@
NEW_PURGE_STRATEGY=@NEW_PURGE_STRATEGY@
@@ -90,7 +91,7 @@ PURIFY =
TYPEMARKER = .gcov
TYPE_FLAGS = $(DEBUG_CFLAGS) -DERTS_GCOV -DNO_JUMP_TABLE -fprofile-arcs -ftest-coverage -O0 -DERTS_CAN_INLINE=0 -DERTS_INLINE=
ifneq ($(findstring solaris,$(TARGET)),solaris)
-LIBS += -lgcov
+TYPE_LIBS = -lgcov
endif
ENABLE_ALLOC_TYPE_VARS += debug
else
@@ -146,6 +147,8 @@ endif
endif
endif
+LIBS += $(TYPE_LIBS)
+
comma:=,
space:=
space+=
@@ -931,7 +934,7 @@ $(OBJDIR)/%.o: hipe/%.c
$(V_CC) $(subst O2,O3, $(CFLAGS)) $(INCLUDES) -c $< -o $@
$(BINDIR)/hipe_mkliterals$(TF_MARKER): $(OBJDIR)/hipe_mkliterals.o
- $(ld_verbose)$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
+ $(ld_verbose)$(CC) $(LDFLAGS) -o $@ $< $(TYPE_LIBS)
$(OBJDIR)/hipe_mkliterals.o: $(HIPE_ASM) $(TTF_DIR)/erl_alloc_types.h $(DTRACE_HEADERS) \
$(TTF_DIR)/OPCODES-GENERATED $(TARGET)/TABLES-GENERATED

View File

@ -0,0 +1,33 @@
From: Sverker Eriksson <sverker@erlang.org>
Date: Tue, 8 Nov 2016 16:52:32 +0100
Subject: [PATCH] erts: Disable -fPIE for HiPE on x86_64
diff --git a/erts/configure.in b/erts/configure.in
index 7455516..7489f8a 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -2778,6 +2778,23 @@ if test "$cross_compiling" != "yes" && test X${enable_hipe} != Xno; then
fi
fi
+dnl Check to disable -fPIE and friends for HiPE on amd64
+if test X${enable_hipe} = Xyes && test X$ARCH = Xamd64; then
+ AC_TRY_COMPILE(, [#if defined(__pie__) || defined(__PIE__)
+ #error -fPIE is enabled by default
+ #endif],
+ [AC_MSG_NOTICE([No -fPIE enabled by default])],
+ [AC_MSG_WARN([Security feature -fPIE will be disabled for HiPE])
+ STATIC_CFLAGS="-fno-PIE $STATIC_CFLAGS"
+ saved_LDFLAGS=$LDFLAGS
+ LDFLAGS="-no-pie $LDFLAGS"
+ AC_TRY_LINK(,, [],
+ [AC_MSG_WARN([Linked does not accept option -no-pie])
+ LDFLAGS=$saved_LDFLAGS])])
+
+fi
+
+
if test X${enable_fp_exceptions} = Xauto ; then
case $host_os in
*linux*)