All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL for-5.0 00/10] tcg patch queue
@ 2020-03-31  3:54 Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 01/10] configure: Drop adjustment of textseg Richard Henderson
                   ` (11 more replies)
  0 siblings, 12 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

My tcg patch queue, plus one mips patch on request of Aleksander.


r~


The following changes since commit 5acad5bf480321f178866dc28e38eeda5a3f19bb:

  Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2020-03-28 00:27:04 +0000)

are available in the Git repository at:

  https://github.com/rth7680/qemu.git tags/pull-tcg-20200330

for you to fetch changes up to b412378785c1bd95e3461c1373dd8938bc54fb4e:

  decodetree: Use Python3 floor division operator (2020-03-30 11:44:04 -0700)

----------------------------------------------------------------
Improve PIE and other linkage
Fix for decodetree vs Python3 floor division operator
Fix i386 INDEX_op_dup2_vec expansion
Fix loongson multimedia condition instructions

----------------------------------------------------------------
Jiaxun Yang (1):
      target/mips: Fix loongson multimedia condition instructions

Philippe Mathieu-Daudé (1):
      decodetree: Use Python3 floor division operator

Richard Henderson (8):
      configure: Drop adjustment of textseg
      tcg: Remove softmmu code_gen_buffer fixed address
      configure: Do not force pie=no for non-x86
      configure: Always detect -no-pie toolchain support
      configure: Unnest detection of -z,relro and -z,now
      configure: Override the os default with --disable-pie
      configure: Support -static-pie if requested
      tcg/i386: Fix INDEX_op_dup2_vec

 configure                 | 116 +++++++++++++---------------------------------
 Makefile                  |   2 +-
 accel/tcg/translate-all.c |  37 ++-------------
 target/mips/translate.c   |  35 ++++++++++++--
 tcg/i386/tcg-target.inc.c |  10 ++--
 scripts/decodetree.py     |   4 +-
 6 files changed, 78 insertions(+), 126 deletions(-)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL for-5.0 01/10] configure: Drop adjustment of textseg
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31  3:54 ` [PATCH for-5.0] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Thomas Huth, Alex Bennée

This adjustment was random and unnecessary.  The user mode
startup code in probe_guest_base() will choose a value for
guest_base that allows the host qemu binary to not conflict
with the guest binary.

With modern distributions, this isn't even used, as the default
is PIE, which does the same job in a more portable way.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
v2: Remove mention of config-host.ld from make distclean
---
 configure | 47 -----------------------------------------------
 Makefile  |  2 +-
 2 files changed, 1 insertion(+), 48 deletions(-)

diff --git a/configure b/configure
index e225a1e3ff..e3ccb8daf0 100755
--- a/configure
+++ b/configure
@@ -6498,49 +6498,6 @@ if test "$cpu" = "s390x" ; then
   fi
 fi
 
-# Probe for the need for relocating the user-only binary.
-if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
-  textseg_addr=
-  case "$cpu" in
-    arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
-      # ??? Rationale for choosing this address
-      textseg_addr=0x60000000
-      ;;
-    mips)
-      # A 256M aligned address, high in the address space, with enough
-      # room for the code_gen_buffer above it before the stack.
-      textseg_addr=0x60000000
-      ;;
-  esac
-  if [ -n "$textseg_addr" ]; then
-    cat > $TMPC <<EOF
-    int main(void) { return 0; }
-EOF
-    textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
-    if ! compile_prog "" "$textseg_ldflags"; then
-      # In case ld does not support -Ttext-segment, edit the default linker
-      # script via sed to set the .text start addr.  This is needed on FreeBSD
-      # at least.
-      if ! $ld --verbose >/dev/null 2>&1; then
-        error_exit \
-            "We need to link the QEMU user mode binaries at a" \
-            "specific text address. Unfortunately your linker" \
-            "doesn't support either the -Ttext-segment option or" \
-            "printing the default linker script with --verbose." \
-            "If you don't want the user mode binaries, pass the" \
-            "--disable-user option to configure."
-      fi
-
-      $ld --verbose | sed \
-        -e '1,/==================================================/d' \
-        -e '/==================================================/,$d' \
-        -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
-        -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
-      textseg_ldflags="-Wl,-T../config-host.ld"
-    fi
-  fi
-fi
-
 # Check that the C++ compiler exists and works with the C compiler.
 # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
 if has $cxx; then
@@ -8175,10 +8132,6 @@ if test "$gprof" = "yes" ; then
   fi
 fi
 
-if test "$target_linux_user" = "yes" || test "$target_bsd_user" = "yes" ; then
-  ldflags="$ldflags $textseg_ldflags"
-fi
-
 # Newer kernels on s390 check for an S390_PGSTE program header and
 # enable the pgste page table extensions in that case. This makes
 # the vm.allocate_pgste sysctl unnecessary. We enable this program
diff --git a/Makefile b/Makefile
index fc2808fb4b..84ef881600 100644
--- a/Makefile
+++ b/Makefile
@@ -795,7 +795,7 @@ rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(M
 endef
 
 distclean: clean
-	rm -f config-host.mak config-host.h* config-host.ld $(DOCS)
+	rm -f config-host.mak config-host.h* $(DOCS)
 	rm -f tests/tcg/config-*.mak
 	rm -f config-all-devices.mak config-all-disas.mak config.status
 	rm -f $(SUBDIR_DEVICES_MAK)
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH for-5.0] tcg/i386: Fix INDEX_op_dup2_vec
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 01/10] configure: Drop adjustment of textseg Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31  8:14   ` no-reply
  2020-03-31  3:54 ` [PULL for-5.0 02/10] tcg: Remove softmmu code_gen_buffer fixed address Richard Henderson
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, qemu-stable

We were only constructing the 64-bit element, and not
replicating the 64-bit element across the rest of the vector.

Cc: qemu-stable@nongnu.org
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---

This bug is visible running RISU for aarch64 on x86_32.


r~

---
 tcg/i386/tcg-target.inc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c
index 223dba9c8c..7f61eeedd0 100644
--- a/tcg/i386/tcg-target.inc.c
+++ b/tcg/i386/tcg-target.inc.c
@@ -2855,9 +2855,13 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
         goto gen_simd;
 #if TCG_TARGET_REG_BITS == 32
     case INDEX_op_dup2_vec:
-        /* Constraints have already placed both 32-bit inputs in xmm regs.  */
-        insn = OPC_PUNPCKLDQ;
-        goto gen_simd;
+        /* First merge the two 32-bit inputs to a single 64-bit element. */
+        tcg_out_vex_modrm(s, OPC_PUNPCKLDQ, a0, a1, a2);
+        /* Then replicate the 64-bit elements across the rest of the vector. */
+        if (type != TCG_TYPE_V64) {
+            tcg_out_dup_vec(s, type, MO_64, a0, a0);
+        }
+        break;
 #endif
     case INDEX_op_abs_vec:
         insn = abs_insn[vece];
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL for-5.0 02/10] tcg: Remove softmmu code_gen_buffer fixed address
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 01/10] configure: Drop adjustment of textseg Richard Henderson
  2020-03-31  3:54 ` [PATCH for-5.0] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 03/10] configure: Do not force pie=no for non-x86 Richard Henderson
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Thomas Huth, Alex Bennée

The commentary talks about "in concert with the addresses
assigned in the relevant linker script", except there is no
linker script for softmmu, nor has there been for some time.

(Do not confuse the user-only linker script editing that was
removed in the previous patch, because user-only does not
use this code_gen_buffer allocation method.)

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/translate-all.c | 37 +++++--------------------------------
 1 file changed, 5 insertions(+), 32 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 78914154bf..9924e66d1f 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1043,47 +1043,20 @@ static inline void *alloc_code_gen_buffer(void)
 {
     int prot = PROT_WRITE | PROT_READ | PROT_EXEC;
     int flags = MAP_PRIVATE | MAP_ANONYMOUS;
-    uintptr_t start = 0;
     size_t size = tcg_ctx->code_gen_buffer_size;
     void *buf;
 
-    /* Constrain the position of the buffer based on the host cpu.
-       Note that these addresses are chosen in concert with the
-       addresses assigned in the relevant linker script file.  */
-# if defined(__PIE__) || defined(__PIC__)
-    /* Don't bother setting a preferred location if we're building
-       a position-independent executable.  We're more likely to get
-       an address near the main executable if we let the kernel
-       choose the address.  */
-# elif defined(__x86_64__) && defined(MAP_32BIT)
-    /* Force the memory down into low memory with the executable.
-       Leave the choice of exact location with the kernel.  */
-    flags |= MAP_32BIT;
-    /* Cannot expect to map more than 800MB in low memory.  */
-    if (size > 800u * 1024 * 1024) {
-        tcg_ctx->code_gen_buffer_size = size = 800u * 1024 * 1024;
-    }
-# elif defined(__sparc__)
-    start = 0x40000000ul;
-# elif defined(__s390x__)
-    start = 0x90000000ul;
-# elif defined(__mips__)
-#  if _MIPS_SIM == _ABI64
-    start = 0x128000000ul;
-#  else
-    start = 0x08000000ul;
-#  endif
-# endif
-
-    buf = mmap((void *)start, size, prot, flags, -1, 0);
+    buf = mmap(NULL, size, prot, flags, -1, 0);
     if (buf == MAP_FAILED) {
         return NULL;
     }
 
 #ifdef __mips__
     if (cross_256mb(buf, size)) {
-        /* Try again, with the original still mapped, to avoid re-acquiring
-           that 256mb crossing.  This time don't specify an address.  */
+        /*
+         * Try again, with the original still mapped, to avoid re-acquiring
+         * the same 256mb crossing.
+         */
         size_t size2;
         void *buf2 = mmap(NULL, size, prot, flags, -1, 0);
         switch ((int)(buf2 != MAP_FAILED)) {
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL for-5.0 03/10] configure: Do not force pie=no for non-x86
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
                   ` (2 preceding siblings ...)
  2020-03-31  3:54 ` [PULL for-5.0 02/10] tcg: Remove softmmu code_gen_buffer fixed address Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 04/10] configure: Always detect -no-pie toolchain support Richard Henderson
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Alex Bennée, Philippe Mathieu-Daudé

PIE is supported on many other hosts besides x86.

The default for non-x86 is now the same as x86: pie is used
if supported, and may be forced via --enable/--disable-pie.

The original commit (40d6444e91c) said:

  "Non-x86 are not changed, as they require TCG changes"

but I think that's wrong -- there's nothing about PIE that
affects TCG one way or another.

Tested on aarch64 (bionic) and ppc64le (centos 7) hosts.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 configure | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/configure b/configure
index e3ccb8daf0..d4c2c7a563 100755
--- a/configure
+++ b/configure
@@ -2107,16 +2107,6 @@ if ! compile_prog "-Werror" "" ; then
 	"Thread-Local Storage (TLS). Please upgrade to a version that does."
 fi
 
-if test "$pie" = ""; then
-  case "$cpu-$targetos" in
-    i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
-      ;;
-    *)
-      pie="no"
-      ;;
-  esac
-fi
-
 if test "$pie" != "no" ; then
   cat > $TMPC << EOF
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL for-5.0 04/10] configure: Always detect -no-pie toolchain support
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
                   ` (3 preceding siblings ...)
  2020-03-31  3:54 ` [PULL for-5.0 03/10] configure: Do not force pie=no for non-x86 Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 05/10] configure: Unnest detection of -z, relro and -z, now Richard Henderson
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Thomas Huth, Philippe Mathieu-Daudé

The CFLAGS_NOPIE and LDFLAGS_NOPIE variables are used
in pc-bios/optionrom/Makefile, which has nothing to do
with the PIE setting of the main qemu executables.

This overrides any operating system default to build
all executables as PIE, which is important for ROMs.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 configure | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index d4c2c7a563..1cdc439a57 100755
--- a/configure
+++ b/configure
@@ -2107,26 +2107,24 @@ if ! compile_prog "-Werror" "" ; then
 	"Thread-Local Storage (TLS). Please upgrade to a version that does."
 fi
 
-if test "$pie" != "no" ; then
-  cat > $TMPC << EOF
+cat > $TMPC << EOF
 
 #ifdef __linux__
 #  define THREAD __thread
 #else
 #  define THREAD
 #endif
-
 static THREAD int tls_var;
-
 int main(void) { return tls_var; }
-
 EOF
-  # check we support --no-pie first...
-  if compile_prog "-Werror -fno-pie" "-no-pie"; then
-    CFLAGS_NOPIE="-fno-pie"
-    LDFLAGS_NOPIE="-nopie"
-  fi
 
+# Check we support --no-pie first; we will need this for building ROMs.
+if compile_prog "-Werror -fno-pie" "-no-pie"; then
+  CFLAGS_NOPIE="-fno-pie"
+  LDFLAGS_NOPIE="-no-pie"
+fi
+
+if test "$pie" != "no" ; then
   if compile_prog "-fPIE -DPIE" "-pie"; then
     QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
     QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL for-5.0 05/10] configure: Unnest detection of -z, relro and -z, now
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
                   ` (4 preceding siblings ...)
  2020-03-31  3:54 ` [PULL for-5.0 04/10] configure: Always detect -no-pie toolchain support Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 06/10] configure: Override the os default with --disable-pie Richard Henderson
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Fangrui Song, Alex Bennée,
	Philippe Mathieu-Daudé

There is nothing about these options that is related to PIE.
Use them unconditionally.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Fangrui Song <i@maskray.me>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
v2: Do not split into two tests.
v3: Update to QEMU_LDFLAGS.
---
 configure | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 1cdc439a57..1e622f5acb 100755
--- a/configure
+++ b/configure
@@ -2129,9 +2129,6 @@ if test "$pie" != "no" ; then
     QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
     QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
     pie="yes"
-    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
-      QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS"
-    fi
   else
     if test "$pie" = "yes"; then
       error_exit "PIE not available due to missing toolchain support"
@@ -2142,6 +2139,12 @@ if test "$pie" != "no" ; then
   fi
 fi
 
+# Detect support for PT_GNU_RELRO + DT_BIND_NOW.
+# The combination is known as "full relro", because .got.plt is read-only too.
+if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
+  QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS"
+fi
+
 ##########################################
 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
 # use i686 as default anyway, but for those that don't, an explicit
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL for-5.0 06/10] configure: Override the os default with --disable-pie
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
                   ` (5 preceding siblings ...)
  2020-03-31  3:54 ` [PULL for-5.0 05/10] configure: Unnest detection of -z, relro and -z, now Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 07/10] configure: Support -static-pie if requested Richard Henderson
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Thomas Huth, Alex Bennée,
	Philippe Mathieu-Daudé

Some distributions, e.g. Ubuntu 19.10, enable PIE by default.
If for some reason one wishes to build a non-pie binary, we
must provide additional options to override.

At the same time, reorg the code to an elif chain.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
v3: Update for QEMU_LDFLAGS.
---
 configure | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index 1e622f5acb..481d5077f7 100755
--- a/configure
+++ b/configure
@@ -2124,19 +2124,18 @@ if compile_prog "-Werror -fno-pie" "-no-pie"; then
   LDFLAGS_NOPIE="-no-pie"
 fi
 
-if test "$pie" != "no" ; then
-  if compile_prog "-fPIE -DPIE" "-pie"; then
-    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
-    QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
-    pie="yes"
-  else
-    if test "$pie" = "yes"; then
-      error_exit "PIE not available due to missing toolchain support"
-    else
-      echo "Disabling PIE due to missing toolchain support"
-      pie="no"
-    fi
-  fi
+if test "$pie" = "no"; then
+  QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
+  QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
+elif compile_prog "-fPIE -DPIE" "-pie"; then
+  QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
+  QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
+  pie="yes"
+elif test "$pie" = "yes"; then
+  error_exit "PIE not available due to missing toolchain support"
+else
+  echo "Disabling PIE due to missing toolchain support"
+  pie="no"
 fi
 
 # Detect support for PT_GNU_RELRO + DT_BIND_NOW.
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL for-5.0 07/10] configure: Support -static-pie if requested
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
                   ` (6 preceding siblings ...)
  2020-03-31  3:54 ` [PULL for-5.0 06/10] configure: Override the os default with --disable-pie Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31 13:34   ` Laurent Vivier
  2020-03-31  3:54 ` [PULL for-5.0 08/10] target/mips: Fix loongson multimedia condition instructions Richard Henderson
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Alex Bennée

Recent toolchains support static and pie at the same time.

As with normal dynamic builds, allow --static to default to PIE
if supported by the toolchain.  Allow --enable/--disable-pie to
override the default.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
v2: Fix --disable-pie --static
v3: Update for QEMU_LDFLAGS.
---
 configure | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 481d5077f7..22870f3867 100755
--- a/configure
+++ b/configure
@@ -1067,7 +1067,6 @@ for opt do
   ;;
   --static)
     static="yes"
-    QEMU_LDFLAGS="-static $QEMU_LDFLAGS"
     QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
   ;;
   --mandir=*) mandir="$optarg"
@@ -2089,11 +2088,6 @@ if test "$static" = "yes" ; then
   if test "$modules" = "yes" ; then
     error_exit "static and modules are mutually incompatible"
   fi
-  if test "$pie" = "yes" ; then
-    error_exit "static and pie are mutually incompatible"
-  else
-    pie="no"
-  fi
 fi
 
 # Unconditional check for compiler __thread support
@@ -2124,7 +2118,18 @@ if compile_prog "-Werror -fno-pie" "-no-pie"; then
   LDFLAGS_NOPIE="-no-pie"
 fi
 
-if test "$pie" = "no"; then
+if test "$static" = "yes"; then
+  if test "$pie" != "no" && compile_prog "-fPIE -DPIE" "-static-pie"; then
+    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
+    QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
+    pie="yes"
+  elif test "$pie" = "yes"; then
+    error_exit "-static-pie not available due to missing toolchain support"
+  else
+    QEMU_LDFLAGS="-static $QEMU_LDFLAGS"
+    pie="no"
+  fi
+elif test "$pie" = "no"; then
   QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
   QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
 elif compile_prog "-fPIE -DPIE" "-pie"; then
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL for-5.0 08/10] target/mips: Fix loongson multimedia condition instructions
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
                   ` (7 preceding siblings ...)
  2020-03-31  3:54 ` [PULL for-5.0 07/10] configure: Support -static-pie if requested Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 09/10] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Aleksandar Markovic, Jiaxun Yang, Huacai Chen

From: Jiaxun Yang <jiaxun.yang@flygoat.com>

Loongson multimedia condition instructions were previously implemented as
write 0 to rd due to lack of documentation. So I just confirmed with Loongson
about their encoding and implemented them correctly.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Acked-by: Huacai Chen <chenhc@lemote.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Message-Id: <20200324122212.11156-1-jiaxun.yang@flygoat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/mips/translate.c | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/target/mips/translate.c b/target/mips/translate.c
index d745bd2803..25b595a17d 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -5529,6 +5529,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
 {
     uint32_t opc, shift_max;
     TCGv_i64 t0, t1;
+    TCGCond cond;
 
     opc = MASK_LMI(ctx->opcode);
     switch (opc) {
@@ -5862,14 +5863,39 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
 
     case OPC_SEQU_CP2:
     case OPC_SEQ_CP2:
+        cond = TCG_COND_EQ;
+        goto do_cc_cond;
+        break;
     case OPC_SLTU_CP2:
+        cond = TCG_COND_LTU;
+        goto do_cc_cond;
+        break;
     case OPC_SLT_CP2:
+        cond = TCG_COND_LT;
+        goto do_cc_cond;
+        break;
     case OPC_SLEU_CP2:
+        cond = TCG_COND_LEU;
+        goto do_cc_cond;
+        break;
     case OPC_SLE_CP2:
-        /*
-         * ??? Document is unclear: Set FCC[CC].  Does that mean the
-         * FD field is the CC field?
-         */
+        cond = TCG_COND_LE;
+    do_cc_cond:
+        {
+            int cc = (ctx->opcode >> 8) & 0x7;
+            TCGv_i64 t64 = tcg_temp_new_i64();
+            TCGv_i32 t32 = tcg_temp_new_i32();
+
+            tcg_gen_setcond_i64(cond, t64, t0, t1);
+            tcg_gen_extrl_i64_i32(t32, t64);
+            tcg_gen_deposit_i32(fpu_fcr31, fpu_fcr31, t32,
+                                get_fp_bit(cc), 1);
+
+            tcg_temp_free_i32(t32);
+            tcg_temp_free_i64(t64);
+        }
+        goto no_rd;
+        break;
     default:
         MIPS_INVAL("loongson_cp2");
         generate_exception_end(ctx, EXCP_RI);
@@ -5878,6 +5904,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
 
     gen_store_fpr64(ctx, t0, rd);
 
+no_rd:
     tcg_temp_free_i64(t0);
     tcg_temp_free_i64(t1);
 }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL for-5.0 09/10] tcg/i386: Fix INDEX_op_dup2_vec
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
                   ` (8 preceding siblings ...)
  2020-03-31  3:54 ` [PULL for-5.0 08/10] target/mips: Fix loongson multimedia condition instructions Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31  3:54 ` [PULL for-5.0 10/10] decodetree: Use Python3 floor division operator Richard Henderson
  2020-03-31 12:20 ` [PULL for-5.0 00/10] tcg patch queue Peter Maydell
  11 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, qemu-stable

We were only constructing the 64-bit element, and not
replicating the 64-bit element across the rest of the vector.

Cc: qemu-stable@nongnu.org
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/i386/tcg-target.inc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c
index 223dba9c8c..7f61eeedd0 100644
--- a/tcg/i386/tcg-target.inc.c
+++ b/tcg/i386/tcg-target.inc.c
@@ -2855,9 +2855,13 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
         goto gen_simd;
 #if TCG_TARGET_REG_BITS == 32
     case INDEX_op_dup2_vec:
-        /* Constraints have already placed both 32-bit inputs in xmm regs.  */
-        insn = OPC_PUNPCKLDQ;
-        goto gen_simd;
+        /* First merge the two 32-bit inputs to a single 64-bit element. */
+        tcg_out_vex_modrm(s, OPC_PUNPCKLDQ, a0, a1, a2);
+        /* Then replicate the 64-bit elements across the rest of the vector. */
+        if (type != TCG_TYPE_V64) {
+            tcg_out_dup_vec(s, type, MO_64, a0, a0);
+        }
+        break;
 #endif
     case INDEX_op_abs_vec:
         insn = abs_insn[vece];
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL for-5.0 10/10] decodetree: Use Python3 floor division operator
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
                   ` (9 preceding siblings ...)
  2020-03-31  3:54 ` [PULL for-5.0 09/10] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson
@ 2020-03-31  3:54 ` Richard Henderson
  2020-03-31 12:20 ` [PULL for-5.0 00/10] tcg patch queue Peter Maydell
  11 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31  3:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

This script started using Python2, where the 'classic' division
operator returns the floor result. In commit 3d004a371 we started
to use Python3, where the division operator returns the float
result ('true division').
To keep the same behavior, use the 'floor division' operator "//"
which returns the floor result.

Fixes: 3d004a371
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200330121345.14665-1-f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 scripts/decodetree.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 2a8f2b6e06..46ab917807 100755
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -1025,7 +1025,7 @@ class SizeTree:
         if extracted < self.width:
             output(ind, 'insn = ', decode_function,
                    '_load_bytes(ctx, insn, {0}, {1});\n'
-                   .format(extracted / 8, self.width / 8));
+                   .format(extracted // 8, self.width // 8));
             extracted = self.width
 
         # Attempt to aid the compiler in producing compact switch statements.
@@ -1079,7 +1079,7 @@ class SizeLeaf:
         if extracted < self.width:
             output(ind, 'insn = ', decode_function,
                    '_load_bytes(ctx, insn, {0}, {1});\n'
-                   .format(extracted / 8, self.width / 8));
+                   .format(extracted // 8, self.width // 8));
             extracted = self.width
         output(ind, 'return insn;\n')
 # end SizeLeaf
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH for-5.0] tcg/i386: Fix INDEX_op_dup2_vec
  2020-03-31  3:54 ` [PATCH for-5.0] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson
@ 2020-03-31  8:14   ` no-reply
  0 siblings, 0 replies; 20+ messages in thread
From: no-reply @ 2020-03-31  8:14 UTC (permalink / raw)
  To: richard.henderson; +Cc: peter.maydell, qemu-devel, qemu-stable

Patchew URL: https://patchew.org/QEMU/20200331035456.6494-3-richard.henderson@linaro.org/



Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

-..............................................................................................
+.....................................E........................................................
+======================================================================
+ERROR: test_pause (__main__.TestSingleBlockdev)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "041", line 108, in test_pause
---
 Ran 94 tests
 
-OK
+FAILED (errors=1)
  TEST    iotest-qcow2: 042
qemu-system-aarch64: -accel kvm: invalid accelerator kvm
qemu-system-aarch64: falling back to tcg
---
Not run: 259
Failures: 041
Failed 1 of 116 iotests
make: *** [check-tests/check-block.sh] Error 1
make: *** Waiting for unfinished jobs....
  TEST    check-qtest-aarch64: tests/qtest/qos-test
Traceback (most recent call last):
---
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=d04f9fbd6d784122a1e96e92f2c9f226', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-7gje6x7k/src/docker-src.2020-03-31-04.00.31.473:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=d04f9fbd6d784122a1e96e92f2c9f226
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-7gje6x7k/src'
make: *** [docker-run-test-quick@centos7] Error 2

real    14m27.100s
user    0m9.065s


The full log is available at
http://patchew.org/logs/20200331035456.6494-3-richard.henderson@linaro.org/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL for-5.0 00/10] tcg patch queue
  2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
                   ` (10 preceding siblings ...)
  2020-03-31  3:54 ` [PULL for-5.0 10/10] decodetree: Use Python3 floor division operator Richard Henderson
@ 2020-03-31 12:20 ` Peter Maydell
  2020-03-31 12:53   ` Alex Bennée
  11 siblings, 1 reply; 20+ messages in thread
From: Peter Maydell @ 2020-03-31 12:20 UTC (permalink / raw)
  To: Richard Henderson; +Cc: QEMU Developers

On Tue, 31 Mar 2020 at 04:54, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> My tcg patch queue, plus one mips patch on request of Aleksander.
>
>
> r~
>
>
> The following changes since commit 5acad5bf480321f178866dc28e38eeda5a3f19bb:
>
>   Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2020-03-28 00:27:04 +0000)
>
> are available in the Git repository at:
>
>   https://github.com/rth7680/qemu.git tags/pull-tcg-20200330
>
> for you to fetch changes up to b412378785c1bd95e3461c1373dd8938bc54fb4e:
>
>   decodetree: Use Python3 floor division operator (2020-03-30 11:44:04 -0700)
>
> ----------------------------------------------------------------
> Improve PIE and other linkage
> Fix for decodetree vs Python3 floor division operator
> Fix i386 INDEX_op_dup2_vec expansion
> Fix loongson multimedia condition instructions

NB: something in your workflow is leaving the '---' and the following
v1/v2 changes info in the commit messages in pull requests. We usually
prefer to strip those out.

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL for-5.0 00/10] tcg patch queue
  2020-03-31 12:20 ` [PULL for-5.0 00/10] tcg patch queue Peter Maydell
@ 2020-03-31 12:53   ` Alex Bennée
  2020-03-31 15:02     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 20+ messages in thread
From: Alex Bennée @ 2020-03-31 12:53 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Richard Henderson, qemu-devel


Peter Maydell <peter.maydell@linaro.org> writes:

> On Tue, 31 Mar 2020 at 04:54, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> My tcg patch queue, plus one mips patch on request of Aleksander.
>>
>>
>> r~
>>
>>
>> The following changes since commit 5acad5bf480321f178866dc28e38eeda5a3f19bb:
>>
>>   Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2020-03-28 00:27:04 +0000)
>>
>> are available in the Git repository at:
>>
>>   https://github.com/rth7680/qemu.git tags/pull-tcg-20200330
>>
>> for you to fetch changes up to b412378785c1bd95e3461c1373dd8938bc54fb4e:
>>
>>   decodetree: Use Python3 floor division operator (2020-03-30 11:44:04 -0700)
>>
>> ----------------------------------------------------------------
>> Improve PIE and other linkage
>> Fix for decodetree vs Python3 floor division operator
>> Fix i386 INDEX_op_dup2_vec expansion
>> Fix loongson multimedia condition instructions
>
> NB: something in your workflow is leaving the '---' and the following
> v1/v2 changes info in the commit messages in pull requests. We usually
> prefer to strip those out.

FWIW I used to have a script that reminded me if they were in and
triggered a clean-up re-base. As people on list have mentioned the
usefulness of maintaining a Message-Id I have now changed my process to
always build a PR by applying messages from the list which

  a) applies a Message-Id
  b) strips version history

The one thing I have to watch out for is if I've started applying tags
to a branch - so now I only do that once I've made the decision to
either rev a branch or create a PR. 

>
> Applied, thanks.
>
> Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
> for any user-visible changes.
>
> -- PMM


-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL for-5.0 07/10] configure: Support -static-pie if requested
  2020-03-31  3:54 ` [PULL for-5.0 07/10] configure: Support -static-pie if requested Richard Henderson
@ 2020-03-31 13:34   ` Laurent Vivier
  2020-03-31 13:44     ` Laurent Vivier
  0 siblings, 1 reply; 20+ messages in thread
From: Laurent Vivier @ 2020-03-31 13:34 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: peter.maydell, Alex Bennée

On 31/03/2020 05:54, Richard Henderson wrote:
> Recent toolchains support static and pie at the same time.
> 
> As with normal dynamic builds, allow --static to default to PIE
> if supported by the toolchain.  Allow --enable/--disable-pie to
> override the default.
> 
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> v2: Fix --disable-pie --static
> v3: Update for QEMU_LDFLAGS.
> ---
>  configure | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)

'configure --static" always produces a dynamically linked binary for me

.../configure' '--disable-system' '--enable-user' '--disable-tools'
'--static'
...
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g
QEMU_CFLAGS         -Werror  -pthread -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include  -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes
-Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes
-fno-strict-aliasing -fno-common -fwrapv -std=gnu99
-Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value
-Wno-missing-include-dirs -Wempty-body -Wnested-externs
-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers
-Wold-style-declaration -Wold-style-definition -Wtype-limits
-fstack-protector-strong  -I/usr/include/libdrm
-I$(SRC_PATH)/capstone/include
QEMU_LDFLAGS       -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -static-pie
-m64  -fstack-protector-strong
...
static build      yes
...
PIE               yes

make -j 8 m68k-linux-user/clean
make -j 8 m68k-linux-user/all

$ file m68k-linux-user/qemu-m68k
m68k-linux-user/qemu-m68k: ELF 64-bit LSB pie executable, x86-64,
version 1 (GNU/Linux), dynamically linked,
BuildID[sha1]=363ee31697e874085ec53c2af454a070c62647e1, for GNU/Linux
3.2.0, with debug_info, not stripped, too many notes (256)

$ gdb --version
GNU gdb (GDB) Fedora 8.3.50.20190824-30.fc31
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
 ld --version
GNU ld version 2.32-31.fc31
Copyright (C) 2019 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later
version.
This program has absolutely no warranty.

Any idea of what happens?

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL for-5.0 07/10] configure: Support -static-pie if requested
  2020-03-31 13:34   ` Laurent Vivier
@ 2020-03-31 13:44     ` Laurent Vivier
  2020-03-31 14:29       ` Richard Henderson
  0 siblings, 1 reply; 20+ messages in thread
From: Laurent Vivier @ 2020-03-31 13:44 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: peter.maydell, Alex Bennée

On 31/03/2020 15:34, Laurent Vivier wrote:
> On 31/03/2020 05:54, Richard Henderson wrote:
>> Recent toolchains support static and pie at the same time.
>>
>> As with normal dynamic builds, allow --static to default to PIE
>> if supported by the toolchain.  Allow --enable/--disable-pie to
>> override the default.
>>
>> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>> v2: Fix --disable-pie --static
>> v3: Update for QEMU_LDFLAGS.
>> ---
>>  configure | 19 ++++++++++++-------
>>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> 'configure --static" always produces a dynamically linked binary for me
> 
> .../configure' '--disable-system' '--enable-user' '--disable-tools'
> '--static'
> ...
> CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g
> QEMU_CFLAGS         -Werror  -pthread -I/usr/include/glib-2.0
> -I/usr/lib64/glib-2.0/include  -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes
> -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes
> -fno-strict-aliasing -fno-common -fwrapv -std=gnu99
> -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value
> -Wno-missing-include-dirs -Wempty-body -Wnested-externs
> -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers
> -Wold-style-declaration -Wold-style-definition -Wtype-limits
> -fstack-protector-strong  -I/usr/include/libdrm
> -I$(SRC_PATH)/capstone/include
> QEMU_LDFLAGS       -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -static-pie
> -m64  -fstack-protector-strong
> ...
> static build      yes
> ...
> PIE               yes
> 
> make -j 8 m68k-linux-user/clean
> make -j 8 m68k-linux-user/all
> 
> $ file m68k-linux-user/qemu-m68k
> m68k-linux-user/qemu-m68k: ELF 64-bit LSB pie executable, x86-64,
> version 1 (GNU/Linux), dynamically linked,
> BuildID[sha1]=363ee31697e874085ec53c2af454a070c62647e1, for GNU/Linux
> 3.2.0, with debug_info, not stripped, too many notes (256)
> 
> $ gdb --version
> GNU gdb (GDB) Fedora 8.3.50.20190824-30.fc31
> Copyright (C) 2019 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>  ld --version
> GNU ld version 2.32-31.fc31
> Copyright (C) 2019 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under the terms of
> the GNU General Public License version 3 or (at your option) a later
> version.
> This program has absolutely no warranty.
> 
> Any idea of what happens?

In fact, the binary works well in a chroot, so it should be  a bug in
"file" command.

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL for-5.0 07/10] configure: Support -static-pie if requested
  2020-03-31 13:44     ` Laurent Vivier
@ 2020-03-31 14:29       ` Richard Henderson
  0 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-31 14:29 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel; +Cc: peter.maydell, Alex Bennée

On 3/31/20 6:44 AM, Laurent Vivier wrote:
>> QEMU_LDFLAGS       -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -static-pie
>> -m64  -fstack-protector-strong
...
>> $ file m68k-linux-user/qemu-m68k
>> m68k-linux-user/qemu-m68k: ELF 64-bit LSB pie executable, x86-64,
>> version 1 (GNU/Linux), dynamically linked,
>> BuildID[sha1]=363ee31697e874085ec53c2af454a070c62647e1, for GNU/Linux
>> 3.2.0, with debug_info, not stripped, too many notes (256)
...
> In fact, the binary works well in a chroot, so it should be  a bug in
> "file" command.

I hadn't noticed that before, but yes, it appears that file needs an update for
-static-pie.


r~


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL for-5.0 00/10] tcg patch queue
  2020-03-31 12:53   ` Alex Bennée
@ 2020-03-31 15:02     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 20+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-31 15:02 UTC (permalink / raw)
  To: Alex Bennée, Peter Maydell; +Cc: Richard Henderson, qemu-devel

On 3/31/20 2:53 PM, Alex Bennée wrote:
> 
> Peter Maydell <peter.maydell@linaro.org> writes:
> 
>> On Tue, 31 Mar 2020 at 04:54, Richard Henderson
>> <richard.henderson@linaro.org> wrote:
>>>
>>> My tcg patch queue, plus one mips patch on request of Aleksander.
>>>
>>>
>>> r~
>>>
>>>
>>> The following changes since commit 5acad5bf480321f178866dc28e38eeda5a3f19bb:
>>>
>>>    Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2020-03-28 00:27:04 +0000)
>>>
>>> are available in the Git repository at:
>>>
>>>    https://github.com/rth7680/qemu.git tags/pull-tcg-20200330
>>>
>>> for you to fetch changes up to b412378785c1bd95e3461c1373dd8938bc54fb4e:
>>>
>>>    decodetree: Use Python3 floor division operator (2020-03-30 11:44:04 -0700)
>>>
>>> ----------------------------------------------------------------
>>> Improve PIE and other linkage
>>> Fix for decodetree vs Python3 floor division operator
>>> Fix i386 INDEX_op_dup2_vec expansion
>>> Fix loongson multimedia condition instructions
>>
>> NB: something in your workflow is leaving the '---' and the following
>> v1/v2 changes info in the commit messages in pull requests. We usually
>> prefer to strip those out.

Same happened to me because I was not applying my own patches (since I 
have them locally) but they would then miss the Message-ID tag.

> 
> FWIW I used to have a script that reminded me if they were in and
> triggered a clean-up re-base. As people on list have mentioned the
> usefulness of maintaining a Message-Id I have now changed my process to
> always build a PR by applying messages from the list which
> 
>    a) applies a Message-Id
>    b) strips version history

I'm doing that with my own patches now.

> 
> The one thing I have to watch out for is if I've started applying tags
> to a branch - so now I only do that once I've made the decision to
> either rev a branch or create a PR.
> 
>>
>> Applied, thanks.
>>
>> Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
>> for any user-visible changes.
>>
>> -- PMM
> 
> 



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH for-5.0] tcg/i386: Fix INDEX_op_dup2_vec
@ 2020-03-30 18:43 Richard Henderson
  0 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2020-03-30 18:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

We were only constructing the 64-bit element, and not
replicating the 64-bit element across the rest of the vector.

Cc: qemu-stable@nongnu.org
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---

This bug is visible running RISU for aarch64 on x86_32.


r~

---
 tcg/i386/tcg-target.inc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c
index 223dba9c8c..7f61eeedd0 100644
--- a/tcg/i386/tcg-target.inc.c
+++ b/tcg/i386/tcg-target.inc.c
@@ -2855,9 +2855,13 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
         goto gen_simd;
 #if TCG_TARGET_REG_BITS == 32
     case INDEX_op_dup2_vec:
-        /* Constraints have already placed both 32-bit inputs in xmm regs.  */
-        insn = OPC_PUNPCKLDQ;
-        goto gen_simd;
+        /* First merge the two 32-bit inputs to a single 64-bit element. */
+        tcg_out_vex_modrm(s, OPC_PUNPCKLDQ, a0, a1, a2);
+        /* Then replicate the 64-bit elements across the rest of the vector. */
+        if (type != TCG_TYPE_V64) {
+            tcg_out_dup_vec(s, type, MO_64, a0, a0);
+        }
+        break;
 #endif
     case INDEX_op_abs_vec:
         insn = abs_insn[vece];
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-03-31 15:05 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 01/10] configure: Drop adjustment of textseg Richard Henderson
2020-03-31  3:54 ` [PATCH for-5.0] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson
2020-03-31  8:14   ` no-reply
2020-03-31  3:54 ` [PULL for-5.0 02/10] tcg: Remove softmmu code_gen_buffer fixed address Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 03/10] configure: Do not force pie=no for non-x86 Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 04/10] configure: Always detect -no-pie toolchain support Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 05/10] configure: Unnest detection of -z, relro and -z, now Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 06/10] configure: Override the os default with --disable-pie Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 07/10] configure: Support -static-pie if requested Richard Henderson
2020-03-31 13:34   ` Laurent Vivier
2020-03-31 13:44     ` Laurent Vivier
2020-03-31 14:29       ` Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 08/10] target/mips: Fix loongson multimedia condition instructions Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 09/10] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 10/10] decodetree: Use Python3 floor division operator Richard Henderson
2020-03-31 12:20 ` [PULL for-5.0 00/10] tcg patch queue Peter Maydell
2020-03-31 12:53   ` Alex Bennée
2020-03-31 15:02     ` Philippe Mathieu-Daudé
  -- strict thread matches above, loose matches on Subject: below --
2020-03-30 18:43 [PATCH for-5.0] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.