Related articles |
---|
Linkers, etc, and Object Code Templatey-Type-Things? s.g.best@btopenworld.com (Simon G Best) (2004-02-01) |
Re: Linkers, etc, and Object Code Templatey-Type-Things? ppluzhnikov@charter.net (Paul Pluzhnikov) (2004-02-04) |
Re: Linkers, etc, and Object Code Templatey-Type-Things? s.g.best@btopenworld.com (Simon G Best) (2004-02-08) |
Re: Linkers, etc, and Object Code Templatey-Type-Things? cdodd@acm.org (Chris Dodd) (2004-02-08) |
From: | Chris Dodd <cdodd@acm.org> |
Newsgroups: | comp.compilers |
Date: | 8 Feb 2004 22:08:33 -0500 |
Organization: | Compilers Central |
References: | 04-02-012 04-02-043 |
Keywords: | linker, code |
Posted-Date: | 08 Feb 2004 22:08:33 EST |
I recall some discussion at some point of adding metaobject support to
the linker (specifically, GNU ld). The basic idea is that while a
normal object consists of some binary data (in sections), some
relocation info, and a list of symbols defined and used, a metobject
would consist of the name of a program to invoke, some binary data,
and some regular expressions for symbols.
When the linker was linking the program, if it had an undefined symbol
it needed, and that symbol name matched the regular expression in some
metaobject, it would invoke the specified program, giving it the
binary data from the metaobject and the symbol(s) that it needed, and
the program would product a normal object that defined those symbols.
Paul Pluzhnikov <ppluzhnikov@charter.net> wrote:
> They don't, and for C++ they are impossible (I think).
> Consider:
>
> template <typename T>
> void assign(const T &rhs)
> {
> this->someField = rhs;
> }
>
> What kind of object code can compiler generate here?
So for this, the compiler would produce a metaobject that contained
some internal form of the template function (probably at least
pre-parsed, possibly something more processed), and a regular
expression that would match any particular instantiation of the
template (the precise form of this depends on the compiler's
name-mangling scheme). The linker would then invoke the compiler at
link time to get the correct instantiation(s).
The whole point of this is that the linker doesn't need to know
anything about the compiler's internal data structures (it just deals
with a block of binary data), or its name mangling scheme or other
conventions (it just knows about regular expressions).
-chris
Return to the
comp.compilers page.
Search the
comp.compilers archives again.