All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Jan Beulich <jbeulich@suse.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
Subject: Re: [XEN PATCH v4 14/18] xen,symbols: rework file symbols selection
Date: Thu, 16 Apr 2020 16:09:29 +0100	[thread overview]
Message-ID: <20200416150929.GL4088@perard.uk.xensource.com> (raw)
In-Reply-To: <312e719f-2bae-cb29-a6dd-29ae0d976d95@suse.com>

On Thu, Apr 16, 2020 at 04:22:05PM +0200, Jan Beulich wrote:
> On 16.04.2020 14:44, Anthony PERARD wrote:
> > On Wed, Apr 08, 2020 at 02:54:35PM +0200, Jan Beulich wrote:
> >> On 31.03.2020 12:30, Anthony PERARD wrote:
> >>> We want to use the same rune to build mm/*/guest_*.o as the one use to
> >>> build every other *.o object. The consequence it that file symbols that
> >>> the program ./symbols prefer changes with CONFIG_ENFORCE_UNIQUE_SYMBOLS=y.
> >>>
> >>> (1) Currently we have those two file symbols:
> >>>     guest_walk.c
> >>>     guest_walk_2.o
> >>> (2) with CONFIG_ENFORCE_UNIQUE_SYMBOLS used on guest_walk.c, we will have:
> >>>     arch/x86/mm/guest_walk.c
> >>>     guest_walk_2.o
> >>>
> >>> The order in which those symbols are present may be different.
> >>>
> >>> Currently, in case (1) ./symbols chooses the *.o symbol (object file
> >>> name). But in case (2), may choose the *.c symbol (source file name with
> >>> path component) if it is first
> >>>
> >>> We want to have ./symbols choose the object file name symbol in both
> >>> cases.
> >>
> >> I guess the reason for wanting this is somehow connected to the
> >> statement at the beginning of the description, but I can't seem
> >> to be able to make the connection.
> > 
> > I'm not sure I can explain it better.
> > 
> > The "object file name" file symbol is used to distinguish between symbols
> > from all mm/*/guest_* objects. The other file symbol present in those
> > object is a "source file name without any path component symbol".
> > 
> > But building those objects with the same rune as any other objects, and
> > having CONFIG_ENFORCE_UNIQUE_SYMBOLS=y, changes the file symbols present
> > in the resulting object. We still have the "object file name" symbol,
> > but now we also have "source file name with path components" symbol.
> > Unfortunately, all mm/*/guest_*.o in one directory are built from the
> > same source file, and thus have the same "source file name" symbol, but
> > have different "object file name" symbol. We still want to be able to
> > distinguish between guest_*.o in one dir, and the only way for that is
> > to use the "object file name" symbol.
> 
> So where's the difference from how things work right now? The "same rune"
> aspect doesn't really change - right now we also build with effectively
> the same logic, just that -DGUEST_PAGING_LEVELS=... gets added. I guess
> it might help if you showed (for one particular example) how the set of
> file symbols changes from what we have now (with and without
> CONFIG_ENFORCE_UNIQUE_SYMBOLS=y) to what there would be with your changes
> to the symbols utility to what there will be with those changes.

The logic to build objects from C files changed in 81ecb38b83b0 ("build:
provide option to disambiguate symbol names"), with objects build with
__OBJECT_FILE__ explicitly left alone. So the logic is different now (at
least when CONFIG_ENFORCE_UNIQUE_SYMBOLS=y).

I did add the example of building arch/x86/mm/guest_walk_2.o to the
commit message, reworded below:

For example, when building arch/x86/mm/guest_walk_2.o from guest_walk.c,
this would be the difference of file symbol present in the object when
building with CONFIG_ENFORCE_UNIQUE_SYMBOLS=y:

(1) Currently we have those two file symbols:
    guest_walk.c
    guest_walk_2.o
(2) When building with the same rune, we will have:
    arch/x86/mm/guest_walk.c
    guest_walk_2.o

The order in which those symbols are present may be different. Building
without CONFIG_ENFORCE_UNIQUE_SYMBOLS will result in (1).


> >>> So this patch changes that ./symbols prefer the "object file
> >>> name" symbol over the "source file name with path component" symbols.
> >>>
> >>> The new intended order of preference is:
> >>>     - first object file name symbol
> >>>     - first source file name with path components symbol
> >>>     - last source file name without any path component symbol
> >>
> >> Isn't this going to lead to ambiguities again when
> >> CONFIG_ENFORCE_UNIQUE_SYMBOLS? Several object files (in different
> >> dirs) are named the same, after all. Static symbols with the same
> >> name in such objects would hence resolve to the same kallsyms
> >> name.
> > 
> > "object file name" symbol are only present in mm/*/guest_*.o objects,
> > they all have different basenames. There is no ambiguity here.
> 
> At least not right now, I see. Could you make this aspect more explicit
> by adding something like "(present only in object files produced from
> multiply compiled sources)" to the first bullet point?

Will do.

-- 
Anthony PERARD


  reply	other threads:[~2020-04-16 15:09 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
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 [this message]
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=20200416150929.GL4088@perard.uk.xensource.com \
    --to=anthony.perard@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --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.