From: "Christopher Li" <sparse@chrisli.org>
To: Alexey Zaytsev <alexey.zaytsev@gmail.com>
Cc: linux-sparse@vger.kernel.org, Josh Triplett <josh@kernel.org>,
Codrin Alexandru Grajdeanu <grcodal@gmail.com>
Subject: Re: [PATCH 0/10] Sparse linker
Date: Thu, 4 Sep 2008 00:27:40 -0700 [thread overview]
Message-ID: <70318cbf0809040027i79476a4ds3d1086f5ca434d9d@mail.gmail.com> (raw)
In-Reply-To: <f19298770809032103h5ea34122g44fda595d775cecf@mail.gmail.com>
On Wed, Sep 3, 2008 at 9:03 PM, Alexey Zaytsev <alexey.zaytsev@gmail.com> wrote:
> If I understand the question right, no. Every "sparse object" .so has a
> "struct ptr_list *symbols" entry (in fact, the only non-static entry) that
> points to the serialized ptr list of the "struct sold_symbol". The linker
> dlopen()'s the .so and hooks to the entry, for every input object file.
> After that, it simply calls ptr_list_concat() on the opened symbol lists,
> and serializes the resulting combined list. There is of course nothing
> wrong if we modify the data obtained from the .so, as it is cow-mmaped.
...
> Well, I serialize the data into C, and then compile it into .so, if
> that was the question. You might want to apply the first patch
> and look at the serialization-test output.
OK. I just realized that you are building a completely different kind
of "linker" than I have in mind.
Generate C source file and let gcc to compile and link it is an
interesting idea. But I think it is a step back wards.
For starts, how do you handle the case that the symbol from your
input file have conflict on the function define in the loader itself?
If I understand your plan correctly, I don't see how it can handle
the following case:
file a.c:
void foo(void) {
printf("%p\n", &bar);
}
file b.c
bar() {
printf("%p\n", &foo);
}
So do you put the extern symbol in your .so as symbol as well?
If you don't, how do you link the extern symbol to where it is defined?
If you do, then you can't load a.so alone because "bar" symbol is not
resolved. And you can't load b.so because "foo" symbol can't resolve.
If you link a.o and b.o together into ab.so. Then you pretty much need to
link the whole linux kernel (except the modules) into one flat file. It defeat
the purpose of having the linker and loader to load single sparse object
file one at a time. Ideally the checker should be able to dynamic load the
sparse object file only when it is needed.
Chris
next prev parent reply other threads:[~2008-09-04 7:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-03 21:55 [PATCH 0/10] Sparse linker alexey.zaytsev
2008-09-03 21:55 ` [PATCH 01/10] Serialization engine alexey.zaytsev
2008-09-03 21:55 ` [PATCH 02/10] Handle -emit_code and the -o file options alexey.zaytsev
2008-09-03 21:55 ` [PATCH 03/10] Check stdin if no input files given, like cc1 alexey.zaytsev
2008-09-03 21:55 ` [PATCH 04/10] Add char *first_string(struct string_list *) alexey.zaytsev
2008-09-03 21:55 ` [PATCH 05/10] Serializable ptr lists alexey.zaytsev
2008-09-03 21:55 ` [PATCH 06/10] Linker core, serialization and helper functions alexey.zaytsev
2008-09-03 21:55 ` [PATCH 07/10] Let sparse serialize the symbol table of the checked file alexey.zaytsev
2008-09-03 21:55 ` [PATCH 08/10] Sparse Object Link eDitor alexey.zaytsev
2008-09-03 21:55 ` [PATCH 09/10] Rewrite cgcc, add cld and car to wrap ld and ar alexey.zaytsev
2008-09-03 21:55 ` [PATCH 10/10] A simple demonstrational program that looks up symbols in sparse object files alexey.zaytsev
[not found] ` <70318cbf0809031808u8610f3h4b3d53a7b76a7799@mail.gmail.com>
2008-09-04 1:16 ` Fwd: [PATCH 0/10] Sparse linker Christopher Li
2008-09-04 1:54 ` Tommy Thorn
2008-09-04 4:03 ` Alexey Zaytsev
2008-09-04 7:27 ` Christopher Li [this message]
2008-09-04 9:41 ` Alexey Zaytsev
2008-09-04 10:35 ` Christopher Li
2008-09-04 13:29 ` Alexey Zaytsev
2008-09-04 13:35 ` Alexey Zaytsev
2008-09-04 19:04 ` Christopher Li
2008-09-04 20:21 ` Alexey Zaytsev
2008-09-04 21:24 ` Christopher Li
2008-09-05 9:49 ` Alexey Zaytsev
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=70318cbf0809040027i79476a4ds3d1086f5ca434d9d@mail.gmail.com \
--to=sparse@chrisli.org \
--cc=alexey.zaytsev@gmail.com \
--cc=grcodal@gmail.com \
--cc=josh@kernel.org \
--cc=linux-sparse@vger.kernel.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).