xen-devel.lists.xenproject.org archive mirror
 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>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [Xen-devel] [XEN PATCH v3 22/23] xen, symbols: rework file symbols selection
Date: Thu, 5 Mar 2020 15:44:09 +0100	[thread overview]
Message-ID: <69b5a9bc-9321-18a7-8b64-690c6cb33e05@suse.com> (raw)
In-Reply-To: <20200226113355.2532224-23-anthony.perard@citrix.com>

On 26.02.2020 12:33, Anthony PERARD wrote:
> Rework symbols so it prefer file symbols that names an object file to
> file symbols that have a directory component.

I'm afraid I don't understand the distinction you apparently mean to
make: Something having a directory component may still name an
object file. I guess you want to refer to source file names.

> But have symbols still prefer the first file symbol if one of the above
> is true, or prefer the second file symbols if it names a source file
> without directory component.

"one of the above is true" meaning "'object file' or 'has directory
component'"? The first paragraph being a preference statement imo
doesn't lend itself to continuing like this.

Further I guess you mean "last" instead of "second"?

In total I understand the intended order of preference is
- object file name
- source file name with path component(s)
- source file name without any path component

> In a future patch, we are going want to run $(CC) from the root directory
> (xen.git/xen that is). So the guest_walk_%.o files are going to have
> two file symbols, one with a directory component and another one
> which name an object file.

Depending on the Kconfig settings, even today there may be two
file symbols there. Please could you (a) consider both build
modes in you description and (b) make clear - perhaps by way of
giving an example - what would result without your change, and
what will result with in in place (and then also before and
after that future change)? And, knowing they behave differently,
perhaps (c) also cover gcc vs clang (which will then likely also
cover the "why is this" part of the description).

> We still want to prefer the file symbols
> that names an object file, no mater if it is first or second.
> 
> And before running everything from the root directory, we will be able
> to use the same runes to build the guest_%.o as to build any other %.o
> files from %.c files (the rule with the objcopy --redefine-sym).

And when running everything from the root directory, we again
won't be able to? If so, what's the point of mentioning this,
when the almost immediate goal is to run everything from the
root directory?

> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> --- a/xen/tools/symbols.c
> +++ b/xen/tools/symbols.c
> @@ -80,11 +80,17 @@ static inline int is_arm_mapping_symbol(const char *str)
>  	       && (str[2] == '\0' || str[2] == '.');
>  }
>  
> +enum symbol_type {
> +     symbol = 0,
> +     single_source = 1,
> +     dir_source = 2,
> +     obj_source = 3,

If numeric values matter, please say so in a comment. There's
no need at all to assign numeric values like you do here -
the same numbering will result with the "= <N>" dropped. I
guess you also mean obj_file rather than the pretty ambiguous
obj_source. Similarly with you renaming multi_source to
dir_source, I don't think single_source makes sense anymore.
Maybe simple_source or file_source, and maybe also path_source
instead of dir_source?

> +};
>  static int read_symbol(FILE *in, struct sym_entry *s)

Please have a blank line between these. I don't, however, see
why the scope of this enum gets widened to the entire file.

>  {
>  	char str[500], type[20] = "";
>  	char *sym, stype;
> -	static enum { symbol, single_source, multi_source } last;
> +	static enum symbol_type last;
>  	static char *filename;
>  	int rc = -1;
>  
> @@ -125,13 +131,19 @@ static int read_symbol(FILE *in, struct sym_entry *s)
>  		 * prefer the first one if that names an object file or has a
>  		 * directory component (to cover multiply compiled files).
>  		 */
> -		bool multi = strchr(str, '/') || (sym && sym[1] == 'o');
> -
> -		if (multi || last != multi_source) {
> +		enum symbol_type current;
> +		if (sym && sym[1] == 'o')

Blank line between declaration(s) and statement(s) please.

Jan

> +		    current = obj_source;
> +		else if (strchr(str, '/'))
> +		    current = dir_source;
> +		else
> +		    current = single_source;
> +
> +		if (current > last || last == single_source) {
>  			free(filename);
>  			filename = *str ? strdup(str) : NULL;
> +			last = current;
>  		}
> -		last = multi ? multi_source : single_source;
>  		goto skip_tail;
>  	}
>  
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-03-05 14:44 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 11:33 [Xen-devel] [XEN PATCH v3 00/23] xen: Build system improvements Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 01/23] xen/include: remove include of Config.mk Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 02/23] Makefile: Fix install-tests Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 03/23] xen/build: Remove confusing comment on the %.s:%.S rule Anthony PERARD
2020-02-26 11:53   ` Wei Liu
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 04/23] xen/build: remove use of AFLAGS-y Anthony PERARD
2020-02-26 12:58   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 05/23] xen/build: Allow to test clang .include without asm symlink Anthony PERARD
2020-02-27  9:05   ` Roger Pau Monné
2020-02-27  9:22     ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 06/23] xen/build: Fix section-renaming of libfdt and libelf Anthony PERARD
2020-02-27  9:38   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 07/23] xen/build: Use obj-y += subdir/ instead of subdir-y Anthony PERARD
2020-02-27  9:22   ` Roger Pau Monné
2020-02-27  9:43   ` Jan Beulich
2020-03-04 14:14     ` Jan Beulich
2020-03-05  9:24   ` Jan Beulich
2020-03-05 13:42     ` Andrew Cooper
2020-03-05 15:02     ` Julien Grall
2020-03-05 15:59       ` Anthony PERARD
2020-03-05 16:31         ` Julien Grall
2020-03-09  6:46     ` Tian, Kevin
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 08/23] xen/build: use $(clean) shorthand for clean targets Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 09/23] xen/build: extract clean target from Rules.mk Anthony PERARD
2020-03-04 14:13   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 10/23] xen/build: run targets csopes, tags, .. without Rules.mk Anthony PERARD
2020-03-04 14:17   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 11/23] xen/build: make tests in test/ directly Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 12/23] xen/build: Move as-option-add to xen/ Anthony PERARD
2020-03-04 14:17   ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 13/23] xen/build: include include/config/auto.conf in main Makefile Anthony PERARD
2020-03-04 14:29   ` Jan Beulich
2020-03-10 17:10     ` Anthony PERARD
2020-03-11  9:26       ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 14/23] xen/build: use new $(c_flags) and $(a_flags) instead of $(CFLAGS) Anthony PERARD
2020-02-27 10:22   ` Roger Pau Monné
2020-03-10 17:55     ` Anthony PERARD
2020-03-04 14:42   ` Jan Beulich
2020-03-10 17:43     ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 15/23] xen/build: have the root Makefile generates the CFLAGS Anthony PERARD
2020-02-27 11:05   ` Roger Pau Monné
2020-03-17 18:05     ` Anthony PERARD
2020-03-19 16:24       ` Anthony PERARD
2020-03-23 15:11         ` Roger Pau Monné
2020-03-24 17:11           ` [Xen-devel] " Anthony PERARD
2020-03-04 15:00   ` Jan Beulich
2020-03-17 18:35     ` Anthony PERARD
2020-03-18 10:20       ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 16/23] xen/build: introduce if_changed and if_changed_rule Anthony PERARD
2020-03-04 15:45   ` Jan Beulich
2020-03-18 10:44     ` Anthony PERARD
2020-03-18 11:14       ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 17/23] xen/build: Start using if_changed Anthony PERARD
2020-02-27 13:09   ` Roger Pau Monné
2020-03-04 16:00     ` Jan Beulich
2020-03-18 10:52       ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 18/23] xen/build: use if_changed on built_in.o Anthony PERARD
2020-03-04 16:03   ` Jan Beulich
2020-03-18 10:55     ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 19/23] xen/build: Use if_changed_rules with %.o:%.c targets Anthony PERARD
2020-03-04 16:09   ` Jan Beulich
2020-03-18 11:14     ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 20/23] xen/build: factorise generation of the linker scripts Anthony PERARD
2020-02-27 13:14   ` Roger Pau Monné
2020-03-05 11:07     ` Jan Beulich
2020-03-05 11:05   ` Jan Beulich
2020-03-18 11:59     ` Anthony PERARD
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 21/23] xen/build: Use if_changed for prelink*.o Anthony PERARD
2020-02-27 13:16   ` Roger Pau Monné
2020-03-04 16:12     ` Jan Beulich
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 22/23] xen, symbols: rework file symbols selection Anthony PERARD
2020-03-05 14:44   ` Jan Beulich [this message]
2020-02-26 11:33 ` [Xen-devel] [XEN PATCH v3 23/23] xen/build: use if_changed to build guest_%.o Anthony PERARD
2020-03-05 15:12   ` Jan Beulich
2020-02-27 21:17 ` [Xen-devel] [XEN PATCH v3 00/23] xen: Build system improvements Stewart Hildebrand
2020-03-06 10:12   ` Anthony PERARD

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=69b5a9bc-9321-18a7-8b64-690c6cb33e05@suse.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien@xen.org \
    --cc=konrad.wilk@oracle.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 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).