All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Anthony PERARD <anthony.perard@citrix.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>, "Wei Liu" <wl@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	xen-devel@lists.xenproject.org,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [XEN PATCH v4 12/18] xen/build: factorise generation of the linker scripts
Date: Thu, 16 Apr 2020 09:36:15 +0200	[thread overview]
Message-ID: <6001a8a3-aed6-0e74-f82d-823853e44483@suse.com> (raw)
In-Reply-To: <20200415165832.GE4088@perard.uk.xensource.com>

On 15.04.2020 18:58, Anthony PERARD wrote:
> On Wed, Apr 08, 2020 at 02:46:42PM +0200, Jan Beulich wrote:
>> On 31.03.2020 12:30, Anthony PERARD wrote:
>>>     - avoid using "define" for cmd_cc_lds_S, as adding '; \' on each line is
>>>       still mandatory for if_changed (or cmd) macro to work.
>>
>> I still don't believe in there being a need for "; \" there. This
>> actually breaks things, after all:
>>
>>> --- a/xen/Rules.mk
>>> +++ b/xen/Rules.mk
>>> @@ -236,6 +236,12 @@ cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@
>>>  %.s: %.S FORCE
>>>  	$(call if_changed,cpp_s_S)
>>>  
>>> +# Linker scripts, .lds.S -> .lds
>>> +quiet_cmd_cc_lds_S = LDS     $@
>>> +cmd_cc_lds_S = $(CPP) -P $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $<; \
>>> +    sed -e 's/.*\.lds\.o:/$(@F):/g' <$(dot-target).d >$(dot-target).d.new; \
>>> +    mv -f $(dot-target).d.new $(dot-target).d
>>
>> if $(CPP) or sed fail, previously the whole rule would have failed,
>> which no longer is the case with your use of semicolons. There
>> ought to be a solution to this, ideally one better than adding
>> "set -e" as the first command ("define" would at least deal with
>> the multi-line make issue, but without it being clear to me why the
>> semicolons would be needed I don't think I can suggest anything
>> there at the moment).
> 
> The only macro that will consumes cmd_cc_lds_S (and other cmd_*) is
> "cmd", it is defined as:
>     cmd = @set -e; $(echo-cmd) $(cmd_$(1))
> So, "set -e" is already there, and using semicolons in commands is
> equivalent to using "&&".
> 
> With "cmd" alone, multi-line command would work as expected (unless
> $(echo-cmd) is is trying to print the command line).
> 
> It's "if_changed" macro that doesn't work with multi-line commands.
> It does:
>     $(cmd); printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd
> With a multiple line command, $(make-cmd) get's expanded to multiple
> line, so the second argument of "printf" is going to be spread over
> multiple line in make, and thus multiple shell. We run into this error:
>     /bin/sh: -c: line 0: unexpected EOF while looking for matching `''
>     /bin/sh: -c: line 1: syntax error: unexpected end of file
> 
> This is why we need to have commands on a single line.
> 
> I hope the explanation is clear enough.

Yes, thanks. One question remains though: Why do we need multiple
commands here in the first place, when Linux gets away with one?

Two other remarks: For one the command's name, aiui, ought to be
cmd_cpp_lds_S (see Linux). And there ought to be cpp_flags, which
would then also be used by e.g. cmd_s_S (instead of both having
$(filter-out -Wa$(comma)%,$(a_flags)) open-coded).

Jan


  reply	other threads:[~2020-04-16  7:36 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 10:30 [XEN PATCH v4 00/18] xen: Build system improvements Anthony PERARD
2020-03-31 10:30 ` [XEN PATCH v4 01/18] xen/arm: Rename all early printk macro Anthony PERARD
2020-03-31 10:30 ` [XEN PATCH v4 02/18] xen/arm: Configure early printk via Kconfig Anthony PERARD
2020-04-01  9:22   ` Julien Grall
2020-03-31 10:30 ` [XEN PATCH v4 03/18] build,arm: Fix deps check of head.o Anthony PERARD
2020-04-01  9:42   ` Julien Grall
2020-03-31 10:30 ` [XEN PATCH v4 04/18] xen/build: include include/config/auto.conf in main Makefile Anthony PERARD
2020-04-08 11:33   ` Jan Beulich
2020-04-14 12:24     ` Anthony PERARD
2020-03-31 10:30 ` [XEN PATCH v4 05/18] xen/build: use new $(c_flags) and $(a_flags) instead of $(CFLAGS) Anthony PERARD
2020-04-08 11:36   ` Jan Beulich
2020-03-31 10:30 ` [XEN PATCH v4 06/18] xen/build: have the root Makefile generates the CFLAGS Anthony PERARD
2020-04-08 11:50   ` Jan Beulich
2020-04-15 14:10     ` Anthony PERARD
2020-04-15 15:55       ` Jan Beulich
2020-03-31 10:30 ` [XEN PATCH v4 07/18] build: Introduce documentation for xen Makefiles Anthony PERARD
2020-04-08 12:00   ` Jan Beulich
2020-04-15 14:38     ` Anthony PERARD
2020-03-31 10:30 ` [XEN PATCH v4 08/18] xen/build: introduce if_changed and if_changed_rule Anthony PERARD
2020-04-08 12:05   ` Jan Beulich
2020-03-31 10:30 ` [XEN PATCH v4 09/18] xen/build: Start using if_changed Anthony PERARD
2020-03-31 10:30 ` [XEN PATCH v4 10/18] xen/build: use if_changed on built_in.o Anthony PERARD
2020-04-08 12:40   ` Jan Beulich
2020-04-08 13:13     ` Andrew Cooper
2020-04-08 13:35       ` Jan Beulich
2020-04-15 16:06         ` Anthony PERARD
2020-03-31 10:30 ` [XEN PATCH v4 11/18] xen/build: Use if_changed_rules with %.o:%.c targets Anthony PERARD
2020-03-31 10:30 ` [XEN PATCH v4 12/18] xen/build: factorise generation of the linker scripts Anthony PERARD
2020-04-08 12:46   ` Jan Beulich
2020-04-15 16:58     ` Anthony PERARD
2020-04-16  7:36       ` Jan Beulich [this message]
2020-04-16  9:57         ` Anthony PERARD
2020-03-31 10:30 ` [XEN PATCH v4 13/18] xen/build: Use if_changed for prelink*.o Anthony PERARD
2020-03-31 10:30 ` [XEN PATCH v4 14/18] xen,symbols: rework file symbols selection Anthony PERARD
2020-04-08 12:54   ` Jan Beulich
2020-04-16 12:44     ` Anthony PERARD
2020-04-16 14:22       ` Jan Beulich
2020-04-16 15:09         ` Anthony PERARD
2020-04-17  7:12           ` Jan Beulich
2020-04-17 13:19             ` Anthony PERARD
2020-04-17 13:39               ` Jan Beulich
2020-04-17 14:42                 ` Anthony PERARD
2020-04-20 13:39                   ` Jan Beulich
2020-03-31 10:30 ` [XEN PATCH v4 15/18] xen/build: use if_changed to build guest_%.o Anthony PERARD
2020-04-08 13:02   ` Jan Beulich
2020-04-16 12:57     ` Anthony PERARD
2020-04-16 14:28       ` Jan Beulich
2020-03-31 10:31 ` [XEN PATCH v4 16/18] build,xsm: Fix multiple call Anthony PERARD
2020-04-08 13:28   ` Jan Beulich
2020-04-16 13:02     ` Anthony PERARD
2020-04-16 14:30       ` Jan Beulich
2020-03-31 10:31 ` [XEN PATCH v4 17/18] build,include: rework compat-build-source.py Anthony PERARD
2020-04-08 13:53   ` [XEN PATCH v4 17/18] build, include: " Jan Beulich
2020-04-16 13:07     ` Anthony PERARD
2020-03-31 10:31 ` [XEN PATCH v4 18/18] build,include: rework compat-build-header.py Anthony PERARD
2020-04-08 13:56   ` [XEN PATCH v4 18/18] build, include: " Jan Beulich
2020-04-16 14:17     ` Anthony PERARD
2020-04-16 14:34       ` Jan Beulich
2020-04-01  9:52 ` [XEN PATCH v4 00/18] xen: Build system improvements Julien Grall

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=6001a8a3-aed6-0e74-f82d-823853e44483@suse.com \
    --to=jbeulich@suse.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 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.