Skip to contentSkip to conversation

build fix for clang 3.4

GIT PULL Richard Henderson 2 participants 4 messages Jul 10, 2016 – Jul 11, 2016

lore
Share & tools
lore
#0 lore raw

Our Travis CI system uses clang 3.4, and is currently broken by a patch from me that required clang 3.5.

r~

The following changes since commit 4f4a9ca4a4386c137301b3662faba076455ff15a:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160707' into staging (2016-07-07 14:49:38 +0100)

are available in the git repository at:

git://github.com/rth7680/qemu.git pull-rth-20160710

for you to fetch changes up to cdbd727c20ad7aac7797dc8c95e485e1a4c6901b:

  build: Use $(AS) for optionrom explicitly (2016-07-10 10:05:46 -0700)

----------------------------------------------------------------
build fix for travis

----------------------------------------------------------------
Richard Henderson (2):
linux-user: Fix i386 safe-syscall.S
build: Use $(AS) for optionrom explicitly

 configure                               | 10 +++-------
 linux-user/host/i386/safe-syscall.inc.S | 24 ++++++------------------
 pc-bios/optionrom/Makefile              |  3 +++
 rules.mak                               |  2 +-
 4 files changed, 13 insertions(+), 26 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/2] linux-user: Fix i386 safe-syscall.S

Clang insists that "cmp" is ambiguous with a memory destination, requiring an explicit size suffix.

There was a true error in the use of .cfi_def_cfa_offset in the epilogue, but changing to use the proper .cfi_adjust_cfa_offset runs afoul of a clang bug wrt .cfi_restore_state. Better to fold the two epilogues so that we don't trigger the bug.

---
 linux-user/host/i386/safe-syscall.inc.S | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)
linux-user/host/i386/safe-syscall.inc.S +6 -18
index 766d0de..9e58fc6 100644
@@ -69,7 +69,7 @@ safe_syscall_base:
 safe_syscall_start:
 	/* if signal_pending is non-zero, don't do the call */
 	mov	4+16(%esp), %eax	/* signal_pending */
-	cmp	$0, (%eax)
+	cmpl	$0, (%eax)
 	jnz	1f
 	mov	8+16(%esp), %eax	/* syscall number */
 	int	$0x80
@@ -77,16 +77,16 @@ safe_syscall_end:
 	/* code path for having successfully executed the syscall */
 	pop	%ebx
 	.cfi_remember_state
-	.cfi_def_cfa_offset -4
+	.cfi_adjust_cfa_offset -4
 	.cfi_restore ebx
 	pop	%edi
-	.cfi_def_cfa_offset -4
+	.cfi_adjust_cfa_offset -4
 	.cfi_restore edi
 	pop	%esi
-	.cfi_def_cfa_offset -4
+	.cfi_adjust_cfa_offset -4
 	.cfi_restore esi
 	pop	%ebp
-	.cfi_def_cfa_offset -4
+	.cfi_adjust_cfa_offset -4
 	.cfi_restore ebp
 	ret
 
@@ -94,19 +94,7 @@ safe_syscall_end:
 	/* code path when we didn't execute the syscall */
 	.cfi_restore_state
 	mov	$-TARGET_ERESTARTSYS, %eax
-	pop	%ebx
-	.cfi_def_cfa_offset -4
-	.cfi_restore ebx
-	pop	%edi
-	.cfi_def_cfa_offset -4
-	.cfi_restore edi
-	pop	%esi
-	.cfi_def_cfa_offset -4
-	.cfi_restore esi
-	pop	%ebp
-	.cfi_def_cfa_offset -4
-	.cfi_restore ebp
-	ret
+	jmp	safe_syscall_end
 	.cfi_endproc
 
 	.size	safe_syscall_base, .-safe_syscall_base
Signature · 1 line
2.7.4
#2 lore raw

[Qemu-devel] [PULL 2/2] build: Use $(AS) for optionrom explicitly

In reply to Richard Henderson

For clang before 3.5, -fno-integrated-as does not exist, so the workaround in 5f6f0e27fb24 fails to build.

Use clang's default assembler for linux-user/safe-syscall.S, and explicitly change to use the system assembler for the option roms.

---
 configure                  | 10 +++-------
 pc-bios/optionrom/Makefile |  3 +++
 rules.mak                  |  2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)
configure +3 -7
index e9090a0..5ada56d 100755
@@ -368,6 +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}"
@@ -4490,13 +4491,6 @@ 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
 
@@ -5515,6 +5509,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
@@ -5988,6 +5983,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
pc-bios/optionrom/Makefile +3 -0
index ce4852a..2cdda87 100644
@@ -20,6 +20,9 @@ build-all: multiboot.bin linuxboot.bin kvmvapic.bin
 # suppress auto-removal of intermediate files
 .SECONDARY:
 
+%.o: %.S
+	$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"  AS    $(TARGET_DIR)$@")
+
 %.img: %.o
 	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -Ttext 0 -e _start -s -o $@ $<,"  Building $(TARGET_DIR)$@")
 
rules.mak +1 -1
index 7d7d83b..ed8e482 100644
@@ -69,7 +69,7 @@ LINK = $(call quiet-command, $(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o
        $(version-obj-y) $(call extract-libs,$1) $(LIBS),"  LINK  $(TARGET_DIR)$@")
 
 %.o: %.S
-	$(call quiet-command,$(CCAS) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
+	$(call quiet-command,$(CCAS) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CCAS  $(TARGET_DIR)$@")
 
 %.o: %.cc
 	$(call quiet-command,$(CXX) $(QEMU_INCLUDES) $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) -c -o $@ $<,"  CXX   $(TARGET_DIR)$@")
Signature · 1 line
2.7.4
#3 lore raw
In reply to Richard Henderson
Quoted 8 lines · Richard Henderson

Our Travis CI system uses clang 3.4, and is currently broken by a patch from me that required clang 3.5.

r~

Quoted 7 lines

The following changes since commit 4f4a9ca4a4386c137301b3662faba076455ff15a:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160707' into staging (2016-07-07 14:49:38 +0100)

are available in the git repository at:

git://github.com/rth7680/qemu.git pull-rth-20160710

Something odd with your pullreq scripts? This didn't work, and I had to use

    git://github.com/rth7680/qemu.git tags/pull-rth-20160710

In any case, applied to master; thanks.

-- PMM