<p>Sebastian Kemper has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13591">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">check_expr2: fix cross-compile/hardening issues<br><br>When building check_expr2 with ASLR PIE hardening enabled the linker<br>fails. This is resolved by adding the regular compiler flags when<br>building the object files from ast_expr2f.c and ast_expr2.c.<br><br>Note: The STANDALONE define is removed because it is already defined in<br>_ASTCFLAGS.<br><br>Also, a Makefile variable "CROSS_COMPILING" is added so that the<br>build system doesn't try to run check_expr2 when cross-compiling,<br>because that will fail the build as will.<br><br>ASTERISK-28685 #close<br><br>Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net><br>Change-Id: If435b7db9f9ad8266245bda51c81c220f9658915<br>---<br>M configure.ac<br>M makeopts.in<br>M utils/Makefile<br>3 files changed, 8 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/91/13591/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configure.ac b/configure.ac</span><br><span>index ed26d69..d6fd795 100644</span><br><span>--- a/configure.ac</span><br><span>+++ b/configure.ac</span><br><span>@@ -230,6 +230,8 @@</span><br><span>    AC_CHECK_TOOL(CXX, g++, :)</span><br><span>    AC_CHECK_TOOL(LD, ld, :)</span><br><span>    AC_CHECK_TOOL(RANLIB, ranlib, :)</span><br><span style="color: hsl(120, 100%, 40%);">+   CROSS_COMPILING=1</span><br><span style="color: hsl(120, 100%, 40%);">+   AC_SUBST(CROSS_COMPILING)</span><br><span> fi</span><br><span> </span><br><span> # Checks for programs.</span><br><span>diff --git a/makeopts.in b/makeopts.in</span><br><span>index cb98726..3580feb 100644</span><br><span>--- a/makeopts.in</span><br><span>+++ b/makeopts.in</span><br><span>@@ -66,6 +66,8 @@</span><br><span> </span><br><span> BIND8_CFLAGS=@BIND8_CFLAGS@</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+CROSS_COMPILING=@CROSS_COMPILING@</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> PTHREAD_CFLAGS=@PTHREAD_CFLAGS@</span><br><span> PTHREAD_LIBS=@PTHREAD_LIBS@</span><br><span> </span><br><span>diff --git a/utils/Makefile b/utils/Makefile</span><br><span>index 738d1e4..a64916b 100644</span><br><span>--- a/utils/Makefile</span><br><span>+++ b/utils/Makefile</span><br><span>@@ -180,14 +180,16 @@</span><br><span> </span><br><span> check_expr2: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h astmm.o</span><br><span>   $(ECHO_PREFIX) echo "   [CC] ast_expr2f.c -> ast_expr2fz.o"</span><br><span style="color: hsl(0, 100%, 40%);">-        $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2fz.o</span><br><span style="color: hsl(120, 100%, 40%);">+       $(CC) -g -c -I$(ASTTOPDIR)/include $(_ASTCFLAGS) $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2fz.o</span><br><span>     $(ECHO_PREFIX) echo "   [CC] ast_expr2.c -> ast_expr2z.o"</span><br><span style="color: hsl(0, 100%, 40%);">-  $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE2 $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2z.o</span><br><span style="color: hsl(120, 100%, 40%);">+        $(CC) -g -c -I$(ASTTOPDIR)/include $(_ASTCFLAGS) -DSTANDALONE2 $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2z.o</span><br><span>         $(ECHO_PREFIX) echo "   [LD] ast_expr2fz.o ast_expr2z.o  -> check_expr2"</span><br><span>        $(CC) -g -o check_expr2 ast_expr2fz.o ast_expr2z.o astmm.o -lm $(_ASTLDFLAGS)</span><br><span>        $(ECHO_PREFIX) echo "   [RM] ast_expr2fz.o ast_expr2z.o"</span><br><span>   rm ast_expr2z.o ast_expr2fz.o</span><br><span style="color: hsl(120, 100%, 40%);">+ifneq ($(CROSS_COMPILING),1)</span><br><span>  ./check_expr2 expr2.testinput</span><br><span style="color: hsl(120, 100%, 40%);">+endif</span><br><span> </span><br><span> smsq: smsq.o strcompat.o</span><br><span> smsq: LIBS+=$(POPT_LIB)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13591">change 13591</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/13591"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If435b7db9f9ad8266245bda51c81c220f9658915 </div>
<div style="display:none"> Gerrit-Change-Number: 13591 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sebastian Kemper <sebastian_ml@gmx.net> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>