From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH LP-BUILD-TOOLS] Allow patching files compiled multiple times
Date: Mon, 5 Mar 2018 15:01:38 -0500 [thread overview]
Message-ID: <20180305200138.GD12836@char.us.oracle.com> (raw)
In-Reply-To: <773fc51c-6bfb-6f27-a8fa-11b080c19447@citrix.com>
On Mon, Mar 05, 2018 at 10:32:51AM +0000, Ross Lagerwall wrote:
> On 02/23/2018 05:08 PM, Ross Lagerwall wrote:
> > gas prior to binutils commit fbdf9406b0 (appears in 2.27) outputs symbol
> > table entries resulting from .file in reverse order. If we get two
> > consecutive file symbols, prefer the first one if that names an object
> > file or has a directory component (to cover multiply compiled files).
> >
> > This is the same workaround that was applied in Xen commit d37d63d4b548
> > ("symbols: prefix static symbols with their source file names") for
> > Xen's internal symbol table.
> >
> > This fixes building a livepatch for XSA-243.
> > ---
> > lookup.c | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/lookup.c b/lookup.c
> > index 39125c6..645b91a 100644
> > --- a/lookup.c
> > +++ b/lookup.c
> > @@ -149,16 +149,34 @@ int lookup_local_symbol(struct lookup_table *table, char *name, char *hint,
> > struct symbol *sym, *match = NULL;
> > int i;
> > char *curfile = NULL;
> > + enum { other, multi_source } last_type = other;
> > memset(result, 0, sizeof(*result));
> > for_each_symbol(i, sym, table) {
> > if (sym->type == STT_FILE) {
> > + const char *ext = strrchr(sym->name, '.');
> > + int multi = strchr(sym->name, '/') ||
> > + (ext && ext[1] == 'o');
> > +
> > + /*
> > + * gas prior to binutils commit fbdf9406b0 (appears in
> > + * 2.27) outputs symbol table entries resulting from
> > + * .file in reverse order. If we get two consecutive
> > + * file symbols, prefer the first one if that names an
> > + * object file or has a directory component (to cover
> > + * multiply compiled files).
> > + */
> > + if (last_type == multi_source)
> > + continue;
> > +
> > if (!strcmp(sym->name, hint)) {
> > curfile = sym->name;
> > + last_type = multi ? multi_source : other;
> > continue; /* begin hint file symbols */
Perhaps add some logging as well?
> > } else if (curfile)
> > curfile = NULL; /* end hint file symbols */
> > }
> > + last_type = other;
> > if (!curfile)
> > continue;
> > if (sym->bind == STB_LOCAL && !strcmp(sym->name, name)) {
> >
>
> Ping, Konrad?
This looks familiar, but how come it has no SoB?
>
> --
> Ross Lagerwall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
prev parent reply other threads:[~2018-03-05 20:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-23 17:08 [PATCH LP-BUILD-TOOLS] Allow patching files compiled multiple times Ross Lagerwall
2018-03-05 10:32 ` Ross Lagerwall
2018-03-05 20:01 ` Konrad Rzeszutek Wilk [this message]
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=20180305200138.GD12836@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=ross.lagerwall@citrix.com \
--cc=xen-devel@lists.xen.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).