Getting GCC to always dllimport vtables on X86?

2008-03-04 Thread Reuben Harris
Hi,


Sure hope I've come to the right place...

I need to somehow persuade GCC (on x86) to always treat vtables as if
they were dllimport'ed. For linking to work on my target platform (a
custom X86 OS) it's important that constructors reference vtables
indirectly (i.e. through pointers in idata). The other side of this
coin is a small hack to ld to allow dllimports to work, not just from
importing modules, but from the exporting module as well (i.e. __imp__
symbols for vtables get created automatically once ld detects its
unresolved).

Is there anyone here who would be willing to show me the way with
this? Although I am a proficient C/C++ programmer, I am a GNU noob and
the GCC source code scares me... :-)  I think I've found the right
place in GCC - import_export_vtable in decl2.c - but am at a loss to
understand the ld source.

Many thanks,


-- Reuben Harris


Injecting data declarations?

2008-03-06 Thread Reuben Harris
Hi,

I would like to modify GCC to inject a link-once word-sized data
declaration into the object file, i.e. to behave AS IF there were
extra declarations in the source code, e.g.:

void* __secret__Foo = &Foo;

(Where Foo is some piece of static data that was defined in source.)

Can someone give me a pointer?  I imagine I need to call 'start_decl'
and 'finish_decl', but how do I create the declarator tree for
start_decl? How do I specify the type?

Many thanks,


-- Reuben