[1/4] Support ASFLAGS in configure and Makefile

Submitted by Joao Moreira on Oct. 19, 2020, 10:43 p.m.

Details

Message ID 20201019224342.53303-2-joao.moreira@intel.com
State New
Series "Add CET IBT Support to MUSL"
Headers show

Commit Message

Joao Moreira Oct. 19, 2020, 10:43 p.m.
Currently MUSL does not support setting ASFLAGS (assembler flags) through
configure. Thus, add support to ASFLAGS, which are passed similarly as CFLAGS.

Signed-off-by: Joao Moreira <joao.moreira@intel.com>
---
 Makefile  | 4 ++--
 configure | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index e8cc4436..f75a946d 100644
--- a/Makefile
+++ b/Makefile
@@ -135,9 +135,9 @@  CC_CMD = $(CC) $(CFLAGS_ALL) -c -o $@ $<
 
 # Choose invocation of assembler to be used
 ifeq ($(ADD_CFI),yes)
-	AS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) -x assembler -c -o $@ -
+	AS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) $(ASFLAGS) -x assembler -c -o $@ -
 else
-	AS_CMD = $(CC_CMD)
+	AS_CMD = $(CC_CMD) $(ASFLAGS)
 endif
 
 obj/%.o: $(srcdir)/%.s
diff --git a/configure b/configure
index 947adf41..4ad78b27 100755
--- a/configure
+++ b/configure
@@ -41,6 +41,7 @@  Optional packages:
 Some influential environment variables:
   CC                      C compiler command [detected]
   CFLAGS                  C compiler flags [-Os -pipe ...]
+  ASFLAGS                 Assembler flags [none]
   CROSS_COMPILE           prefix for cross compiler and tools [none]
   LIBCC                   compiler runtime library [detected]
 
@@ -181,6 +182,7 @@  AR=*) AR=${arg#*=} ;;
 RANLIB=*) RANLIB=${arg#*=} ;;
 CC=*) CC=${arg#*=} ;;
 CFLAGS=*) CFLAGS=${arg#*=} ;;
+ASFLAGS=*) ASFLAGS=${arg#*=} ;;
 CPPFLAGS=*) CPPFLAGS=${arg#*=} ;;
 LDFLAGS=*) LDFLAGS=${arg#*=} ;;
 CROSS_COMPILE=*) CROSS_COMPILE=${arg#*=} ;;
@@ -787,6 +789,7 @@  includedir = $includedir
 syslibdir = $syslibdir
 CC = $CC
 CFLAGS = $CFLAGS
+ASFLAGS = $ASFLAGS
 CFLAGS_AUTO = $CFLAGS_AUTO
 CFLAGS_C99FSE = $CFLAGS_C99FSE
 CFLAGS_MEMOPS = $CFLAGS_MEMOPS