qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4] buildsys: Move crypto cflags/libs to per object variables
Date: Fri, 8 Sep 2017 18:27:01 +0800	[thread overview]
Message-ID: <20170908102701.GL4511@lemon> (raw)
In-Reply-To: <20170908100537.GI3609@redhat.com>

On Fri, 09/08 11:05, Daniel P. Berrange wrote:
> On Wed, Sep 06, 2017 at 08:49:00PM +0800, Fam Zheng wrote:
> > This patch groups the crypto objects into a few .mo objects based on
> > functional submodules, and moves inclusion conditions to *-objs
> > variables, then moves the global cflags/libs to the *-cflags and *-libs
> > variables.
> > 
> > For init.o and cipher.o, which may or may not need the library flags
> > depending on config, adding flags and libs unconditionally doesn't hurt,
> > because if the library is not available, the variables are empty.  This
> > makes less code.
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > 
> > ---
> > 
> > v4: Merge into one patch which is supposedly easier to manage and
> > review, and use .mo appraoch to avoid $(foreach) and $(eval) magics.
> 
> I don't think using  .mo is suitable here. You've used it as a generic
> mechanism for grouping .o files, but that is not what it does. There
> are special semantics around .mo rules that affect how the final
> binaries are linked.

Using .mo is okay here, but after a hindsight I think grouping by library
(nettle.mo, gcrypt.mo, etc.) is better than grouping by functionality, for
modularization in the future. But that also means assigning the cflags/libs
variable cannot be simplified like this.

> 
> eg looking back at the description of .mo files 
> 
> [quote]
> commit c261d774fb9093d00e0938a19f502fb220f62718
> Author: Fam Zheng <famz@redhat.com>
> Date:   Mon Sep 1 18:35:10 2014 +0800
> 
> [...snip...]
> 
>     3) When linking an executable, those .mo files in its "-y" variables are
>        filtered out, and replaced by one or more -Wl,-u,$symbol flags. This
>        is done in the added macro "process-archive-undefs".
>     
>        These "-Wl,-u,$symbol" flags will force ld to pull in the function
>        definition from the archives when linking.
>     
>        Note that the .mo objects, that are actually meant to be linked in
>        the executables, are already expanded in unnest-vars, before the
>        linking command. So we are safe to simply filter out .mo for the
>        purpose of pulling undefined symbols.
>     
>        process-archive-undefs works as this: For each ".mo", find all the
>        undefined symbols in it, filter ones that are defined in the
>        archives. For each of these symbols, generate a "-Wl,-u,$symbol" in
>        the link command, and put them before archive names in the command
>        line.
> [/quote]
> 
> Based on this, I don't think I can ack this patch, because it can
> have unexpected consequences.

This described the process-archive-undefs semantics of .mo, but not the essence
of it.  Basically .mo is just partial linking with the additional services of
-cflags, -libs and the above -Wl,-u thing. I cannot think of any unexpected
consequences with this change. We've had sdl.mo in ui/Makefile.objs for long,
just for the same purpose of this patch, with no problem.

Fam

  reply	other threads:[~2017-09-08 10:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-06 12:49 [Qemu-devel] [PATCH v4] buildsys: Move crypto cflags/libs to per object variables Fam Zheng
2017-09-08  6:31 ` Fam Zheng
2017-09-08  6:59   ` Fam Zheng
2017-09-08 10:05 ` Daniel P. Berrange
2017-09-08 10:27   ` Fam Zheng [this message]
2017-09-08 10:36     ` Daniel P. Berrange
2017-09-08 10:58       ` Fam Zheng
2017-09-08 11:00         ` Daniel P. Berrange
2017-09-08 11:23           ` Fam Zheng
2017-09-08 12:36             ` Daniel P. Berrange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170908102701.GL4511@lemon \
    --to=famz@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).