diff mbox series

[v2,01/14] crypto: Merge crypto-obj-y into libqemuutil.a

Message ID 20190314045526.13342-2-richard.henderson@linaro.org
State Superseded
Headers show
Series Add qemu_getrandom and ARMv8.5-RNG | expand

Commit Message

Richard Henderson March 14, 2019, 4:55 a.m. UTC
We will shortly need this in the user-only binaries, so drop the split
into system and tools binaries.  This also means that crypto-aes-obj-y
can be merged back into crypto-obj-y.

Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 Makefile             | 12 +++++-------
 Makefile.objs        |  8 ++------
 Makefile.target      |  4 ----
 configure            |  9 +++------
 crypto/Makefile.objs |  5 +----
 5 files changed, 11 insertions(+), 27 deletions(-)

-- 
2.17.1

Comments

Daniel P. Berrangé March 14, 2019, 3:43 p.m. UTC | #1
On Wed, Mar 13, 2019 at 09:55:13PM -0700, Richard Henderson wrote:
> We will shortly need this in the user-only binaries, so drop the split

> into system and tools binaries.  This also means that crypto-aes-obj-y

> can be merged back into crypto-obj-y.

> 

> Cc: Daniel P. Berrangé <berrange@redhat.com>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  Makefile             | 12 +++++-------

>  Makefile.objs        |  8 ++------

>  Makefile.target      |  4 ----

>  configure            |  9 +++------

>  crypto/Makefile.objs |  5 +----

>  5 files changed, 11 insertions(+), 27 deletions(-)


I think this needs to replace  test-crypto-obj-y with test-util-obj-y
in tests/Makefile.include too

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Richard Henderson March 14, 2019, 5:54 p.m. UTC | #2
On 3/14/19 8:43 AM, Daniel P. Berrangé wrote:
> I think this needs to replace  test-crypto-obj-y with test-util-obj-y

> in tests/Makefile.include too


test-crypto-obj-y = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)

While I could replace crypto-obj-y with test-util-obj-y:

  test-util-obj-y = libqemuutil.a

the full variable still contains extra stuff.


r~
Daniel P. Berrangé March 14, 2019, 6:02 p.m. UTC | #3
On Thu, Mar 14, 2019 at 10:54:49AM -0700, Richard Henderson wrote:
> On 3/14/19 8:43 AM, Daniel P. Berrangé wrote:

> > I think this needs to replace  test-crypto-obj-y with test-util-obj-y

> > in tests/Makefile.include too

> 

> test-crypto-obj-y = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)


Hmm, the crypto stuff depends on the authz and qom code, and
authz-obj-y is only added to the softmmu impls. I guess the
linux-user still links ok because the linker drops any .o
members from libqemuutil.a that aren't referenced in the final
binary. qom-obj-y is added to linux-user explicitly so that.

Overall it feels like libqemuutil.a probably ought to have
all of authz-obj-y, crypto-obj-y and qom-obj-y included by
default so we can just remove the repetition in the make
rules.

Don't feel obliged to tackle that bigger cleanup though.
I'm fine if that's left for another day.

> 

> While I could replace crypto-obj-y with test-util-obj-y:

> 

>   test-util-obj-y = libqemuutil.a

> 

> the full variable still contains extra stuff.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index abd78a9826..a85f33f47e 100644
--- a/Makefile
+++ b/Makefile
@@ -405,7 +405,6 @@  dummy := $(call unnest-vars,, \
                 block-obj-y \
                 block-obj-m \
                 crypto-obj-y \
-                crypto-aes-obj-y \
                 qom-obj-y \
                 io-obj-y \
                 common-obj-y \
@@ -441,7 +440,6 @@  SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
 
 $(SOFTMMU_SUBDIR_RULES): $(authz-obj-y)
 $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
-$(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
 $(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
 $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
 
@@ -496,7 +494,7 @@  Makefile: $(version-obj-y)
 ######################################################################
 # Build libraries
 
-libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
+libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y) $(crypto-obj-y)
 libvhost-user.a: $(libvhost-user-obj-y) $(util-obj-y) $(stub-obj-y)
 
 ######################################################################
@@ -505,9 +503,9 @@  COMMON_LDADDS = libqemuutil.a
 
 qemu-img.o: qemu-img-cmds.h
 
-qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
-qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
-qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
+qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
+qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
+qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 
 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
 
@@ -518,7 +516,7 @@  qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
 
-scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(authz-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
+scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(authz-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 ifdef CONFIG_MPATH
 scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
 endif
diff --git a/Makefile.objs b/Makefile.objs
index 72debbf5c5..23950a37af 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -3,6 +3,8 @@ 
 stub-obj-y = stubs/ util/ crypto/
 util-obj-y = util/ qobject/ qapi/
 
+crypto-obj-y = crypto/
+
 chardev-obj-y = chardev/
 
 #######################################################################
@@ -21,12 +23,6 @@  block-obj-$(CONFIG_REPLICATION) += replication.o
 
 block-obj-m = block/
 
-#######################################################################
-# crypto-obj-y is code used by both qemu system emulation and qemu-img
-
-crypto-obj-y = crypto/
-crypto-aes-obj-y = crypto/
-
 #######################################################################
 # qom-obj-y is code used by both qemu system emulation and qemu-img
 
diff --git a/Makefile.target b/Makefile.target
index d8048aab8f..8840d70b57 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -181,8 +181,6 @@  dummy := $(call unnest-vars,.., \
                block-obj-y \
                block-obj-m \
                chardev-obj-y \
-               crypto-obj-y \
-               crypto-aes-obj-y \
                qom-obj-y \
                io-obj-y \
                common-obj-y \
@@ -191,8 +189,6 @@  all-obj-y += $(common-obj-y)
 all-obj-y += $(qom-obj-y)
 all-obj-$(CONFIG_SOFTMMU) += $(authz-obj-y)
 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y)
-all-obj-$(CONFIG_USER_ONLY) += $(crypto-aes-obj-y)
-all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y)
 all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
 
 ifdef CONFIG_SOFTMMU
diff --git a/configure b/configure
index abe453f8fd..8992b3aade 100755
--- a/configure
+++ b/configure
@@ -2771,8 +2771,7 @@  if test "$gnutls" != "no"; then
     if $pkg_config --exists "gnutls >= 3.1.18"; then
         gnutls_cflags=$($pkg_config --cflags gnutls)
         gnutls_libs=$($pkg_config --libs gnutls)
-        libs_softmmu="$gnutls_libs $libs_softmmu"
-        libs_tools="$gnutls_libs $libs_tools"
+        LIBS="$gnutls_libs $LIBS"
 	QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
         gnutls="yes"
     elif test "$gnutls" = "yes"; then
@@ -2837,8 +2836,7 @@  if test "$nettle" != "no"; then
         nettle_cflags=$($pkg_config --cflags nettle)
         nettle_libs=$($pkg_config --libs nettle)
         nettle_version=$($pkg_config --modversion nettle)
-        libs_softmmu="$nettle_libs $libs_softmmu"
-        libs_tools="$nettle_libs $libs_tools"
+        LIBS="$nettle_libs $LIBS"
         QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
         nettle="yes"
 
@@ -2865,8 +2863,7 @@  if test "$gcrypt" != "no"; then
         then
             gcrypt_libs="$gcrypt_libs -lgpg-error"
         fi
-        libs_softmmu="$gcrypt_libs $libs_softmmu"
-        libs_tools="$gcrypt_libs $libs_tools"
+        LIBS="$gcrypt_libs $LIBS"
         QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
         gcrypt="yes"
 
diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs
index 256c9aca1f..a291bc5b9a 100644
--- a/crypto/Makefile.objs
+++ b/crypto/Makefile.objs
@@ -34,8 +34,5 @@  crypto-obj-y += xts.o
 crypto-obj-y += block.o
 crypto-obj-y += block-qcow.o
 crypto-obj-y += block-luks.o
-
-# Let the userspace emulators avoid linking gnutls/etc
-crypto-aes-obj-y = aes.o
-
+crypto-obj-y += aes.o
 stub-obj-y += pbkdf-stub.o