mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
check_expr2: fix cross-compile/hardening issues
When building check_expr2 with ASLR PIE hardening enabled the linker fails. This is resolved by adding the regular compiler flags when building the object files from ast_expr2f.c and ast_expr2.c. Note: The STANDALONE define is removed because it is already defined in _ASTCFLAGS. YY_NO_INPUT is defined so that the compile survives '--enable-dev-mode'. Also, a Makefile variable "CROSS_COMPILING" is added so that the build system doesn't try to run check_expr2 when cross-compiling, because that will fail the build as will. ASTERISK-28685 #close Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net> Change-Id: If435b7db9f9ad8266245bda51c81c220f9658915
This commit is contained in:
@@ -180,14 +180,16 @@ conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o hashtab.o lock.o aelbison.o aelpar
|
||||
|
||||
check_expr2: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h astmm.o
|
||||
$(ECHO_PREFIX) echo " [CC] ast_expr2f.c -> ast_expr2fz.o"
|
||||
$(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2fz.o
|
||||
$(CC) -g -c -I$(ASTTOPDIR)/include $(_ASTCFLAGS) -DYY_NO_INPUT $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2fz.o
|
||||
$(ECHO_PREFIX) echo " [CC] ast_expr2.c -> ast_expr2z.o"
|
||||
$(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE2 $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2z.o
|
||||
$(CC) -g -c -I$(ASTTOPDIR)/include $(_ASTCFLAGS) -DSTANDALONE2 $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2z.o
|
||||
$(ECHO_PREFIX) echo " [LD] ast_expr2fz.o ast_expr2z.o -> check_expr2"
|
||||
$(CC) -g -o check_expr2 ast_expr2fz.o ast_expr2z.o astmm.o -lm $(_ASTLDFLAGS)
|
||||
$(ECHO_PREFIX) echo " [RM] ast_expr2fz.o ast_expr2z.o"
|
||||
rm ast_expr2z.o ast_expr2fz.o
|
||||
ifneq ($(CROSS_COMPILING),1)
|
||||
./check_expr2 expr2.testinput
|
||||
endif
|
||||
|
||||
smsq: smsq.o strcompat.o
|
||||
smsq: LIBS+=$(POPT_LIB)
|
||||
|
Reference in New Issue
Block a user