* [Qemu-devel] [PATCH v2] build: Use $(CCAS) for compiling .S files
@ 2016-06-23 17:39 Richard Henderson
2016-06-30 18:07 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2016-06-23 17:39 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
We fail to pass to $(AS) all of the different flags that may be required
for a given set of CFLAGS. Rather than figuring out the host-specific
mapping, it's better to allow the compiler driver to do that.
However, simply using $(CC) runs afoul of clang trying to build the
option roms. C.f. 3dd46c78525a30e98c68, wherein we changed from
using $(CC) to using $(AS) in the first place.
Work around this by passing -fno-integrated-as to clang, so that we use
the external assembler, and the clang driver still passes along all of
the options that the assembler might require.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
configure | 13 ++++++++++---
rules.mak | 7 ++-----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/configure b/configure
index 5929aba..29ad43e 100755
--- a/configure
+++ b/configure
@@ -368,7 +368,7 @@ else
fi
ar="${AR-${cross_prefix}ar}"
-as="${AS-${cross_prefix}as}"
+ccas="${CCAS-$cc}"
cpp="${CPP-$cc -E}"
objcopy="${OBJCOPY-${cross_prefix}objcopy}"
ld="${LD-${cross_prefix}ld}"
@@ -4488,6 +4488,13 @@ if test "$fortify_source" != "no"; then
fi
fi
+#################################################
+# clang does not support the 16-bit assembly for roms
+
+if echo | $ccas -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
+ ccas="$ccas -fno-integrated-as"
+fi
+
##########################################
# check if struct fsxattr is available via linux/fs.h
@@ -5498,7 +5505,7 @@ echo "CXX=$cxx" >> $config_host_mak
echo "OBJCC=$objcc" >> $config_host_mak
echo "AR=$ar" >> $config_host_mak
echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
-echo "AS=$as" >> $config_host_mak
+echo "CCAS=$ccas" >> $config_host_mak
echo "CPP=$cpp" >> $config_host_mak
echo "OBJCOPY=$objcopy" >> $config_host_mak
echo "LD=$ld" >> $config_host_mak
@@ -5971,7 +5978,7 @@ for rom in seabios vgabios ; do
config_mak=roms/$rom/config.mak
echo "# Automatically generated by configure - do not modify" > $config_mak
echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
- echo "AS=$as" >> $config_mak
+ echo "CCAS=$ccas" >> $config_mak
echo "CC=$cc" >> $config_mak
echo "BCC=bcc" >> $config_mak
echo "CPP=$cpp" >> $config_mak
diff --git a/rules.mak b/rules.mak
index 72c5955..7d7d83b 100644
--- a/rules.mak
+++ b/rules.mak
@@ -68,11 +68,8 @@ LINK = $(call quiet-command, $(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o
$(call process-archive-undefs, $1) \
$(version-obj-y) $(call extract-libs,$1) $(LIBS)," LINK $(TARGET_DIR)$@")
-%.asm: %.S
- $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -o $@ $<," CPP $(TARGET_DIR)$@")
-
-%.o: %.asm
- $(call quiet-command,$(AS) $(ASFLAGS) -o $@ $<," AS $(TARGET_DIR)$@")
+%.o: %.S
+ $(call quiet-command,$(CCAS) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@")
%.o: %.cc
$(call quiet-command,$(CXX) $(QEMU_INCLUDES) $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) -c -o $@ $<," CXX $(TARGET_DIR)$@")
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v2] build: Use $(CCAS) for compiling .S files
2016-06-23 17:39 [Qemu-devel] [PATCH v2] build: Use $(CCAS) for compiling .S files Richard Henderson
@ 2016-06-30 18:07 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2016-06-30 18:07 UTC (permalink / raw)
To: Richard Henderson; +Cc: QEMU Developers
On 23 June 2016 at 18:39, Richard Henderson <rth@twiddle.net> wrote:
> We fail to pass to $(AS) all of the different flags that may be required
> for a given set of CFLAGS. Rather than figuring out the host-specific
> mapping, it's better to allow the compiler driver to do that.
>
> However, simply using $(CC) runs afoul of clang trying to build the
> option roms. C.f. 3dd46c78525a30e98c68, wherein we changed from
> using $(CC) to using $(AS) in the first place.
>
> Work around this by passing -fno-integrated-as to clang, so that we use
> the external assembler, and the clang driver still passes along all of
> the options that the assembler might require.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> +#################################################
> +# clang does not support the 16-bit assembly for roms
> +
> +if echo | $ccas -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
> + ccas="$ccas -fno-integrated-as"
> +fi
It would be neater to directly check whether assembling
the relevant constructs worked rather than just looking
for __clang__, but this works I guess.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-30 18:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-23 17:39 [Qemu-devel] [PATCH v2] build: Use $(CCAS) for compiling .S files Richard Henderson
2016-06-30 18:07 ` Peter Maydell
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).