Patchwork link seccomp only with softmmu targets

login
register
mail settings
Submitter Michael Tokarev
Date Jan. 19, 2013, 2:58 p.m.
Message ID <1358607489-12478-1-git-send-email-mjt@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/213864/
State New
Headers show

Comments

Michael Tokarev - Jan. 19, 2013, 2:58 p.m.
Now, if seccomp is detected, it is linked into every executable,
but is used only by softmmu targets (from vl.c).  So link it
only where it is actually needed.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 configure |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Michael Tokarev - Jan. 19, 2013, 3:04 p.m.
19.01.2013 18:58, Michael Tokarev wrote:
> Now, if seccomp is detected, it is linked into every executable,
> but is used only by softmmu targets (from vl.c).  So link it
> only where it is actually needed.

Note this is not just a cleanup.  For some reason, at least
debian package of seccomp lacks static library (this needs
separate investigation and maybe a fix), so when building
linux-user-static targets the build fails, since libseccomp
is linked into static linux-user executables.

So consider it is a bugfix.

Note that Makefile.objs adds qemu-seccomp.o to common-objs-y, --
maybe this whole variable (common-objs) should be renamed
to softmmu-objs, to match other softmmu-* stuff?  But I'm
not sure I understand this makefile machinery.

/mjt
Paolo Bonzini - Jan. 19, 2013, 3:31 p.m.
Il 19/01/2013 16:04, Michael Tokarev ha scritto:
> 
>> Now, if seccomp is detected, it is linked into every executable,
>> but is used only by softmmu targets (from vl.c).  So link it
>> only where it is actually needed.
> 
> Note this is not just a cleanup.  For some reason, at least
> debian package of seccomp lacks static library (this needs
> separate investigation and maybe a fix), so when building
> linux-user-static targets the build fails, since libseccomp
> is linked into static linux-user executables.
> 
> So consider it is a bugfix.

Ack.

> Note that Makefile.objs adds qemu-seccomp.o to common-objs-y, --
> maybe this whole variable (common-objs) should be renamed
> to softmmu-objs, to match other softmmu-* stuff?  But I'm
> not sure I understand this makefile machinery.

I'm going to unify common-obj-y/universal-obj-y/user-obj-y (see patches
from today) so that common-obj-y just means "built in the toplevel
directory for the target directories".

All of libs_softmmu etc. should probably be moved to the Makefiles as well.

Paolo
Doug Goldstein - Jan. 19, 2013, 10:33 p.m.
On Sat, Jan 19, 2013 at 8:58 AM, Michael Tokarev <mjt@tls.msk.ru> wrote:
> Now, if seccomp is detected, it is linked into every executable,
> but is used only by softmmu targets (from vl.c).  So link it
> only where it is actually needed.
>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  configure |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 4ebb60d..509b3f1 100755
> --- a/configure
> +++ b/configure
> @@ -1427,7 +1427,7 @@ fi
>
>  if test "$seccomp" != "no" ; then
>      if $pkg_config --atleast-version=1.0.0 libseccomp --modversion >/dev/null 2>&1; then
> -        LIBS=`$pkg_config --libs libseccomp`
> +        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
>         seccomp="yes"
>      else
>         if test "$seccomp" = "yes"; then
> --
> 1.7.10.4
>
>

This should likely be considered for QEMU 1.3.1 as well. I've added it
to my QEMU 1.2.x queue as well.
Blue Swirl - Jan. 26, 2013, 3:05 p.m.
Thanks, applied.

On Sat, Jan 19, 2013 at 2:58 PM, Michael Tokarev <mjt@tls.msk.ru> wrote:
> Now, if seccomp is detected, it is linked into every executable,
> but is used only by softmmu targets (from vl.c).  So link it
> only where it is actually needed.
>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  configure |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 4ebb60d..509b3f1 100755
> --- a/configure
> +++ b/configure
> @@ -1427,7 +1427,7 @@ fi
>
>  if test "$seccomp" != "no" ; then
>      if $pkg_config --atleast-version=1.0.0 libseccomp --modversion >/dev/null 2>&1; then
> -        LIBS=`$pkg_config --libs libseccomp`
> +        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
>         seccomp="yes"
>      else
>         if test "$seccomp" = "yes"; then
> --
> 1.7.10.4
>
>

Patch

diff --git a/configure b/configure
index 4ebb60d..509b3f1 100755
--- a/configure
+++ b/configure
@@ -1427,7 +1427,7 @@  fi
 
 if test "$seccomp" != "no" ; then
     if $pkg_config --atleast-version=1.0.0 libseccomp --modversion >/dev/null 2>&1; then
-        LIBS=`$pkg_config --libs libseccomp`
+        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
 	seccomp="yes"
     else
 	if test "$seccomp" = "yes"; then