This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: [APPROVE?] Fix MIPS and PowerPC with GCC 3.x
Bart Veer wrote:
"Gary" == Gary Thomas <gary at mlbassoc dot com> writes:
Jifl> This would be similar to the various hal_mk_defs.c's
Jifl> floating around, although they requires knowledge of asm
Jifl> syntax. Instead the C++ file can just generate the header
Jifl> contents directly with #define's and the custom build step
Jifl> can move it into the install tree. Something similar happens
Jifl> for the heap magic in the memalloc package (a TCL file doing
Jifl> the generating that time).
>>
>> I don't see how your approach is going to work. We need to know how
>> the target g++ messes about with its classes, not the host g++. Since
>> we cannot execute a feature test program, the way to do this is to
>> generate some assembler with the target g++ and analyse that, e.g.
>> with a Tcl script.
Gary> Which is exactly the problem solved by hal_mk_defs.c (albeit C
Gary> structures instead of C++ members...)
Ah, I think I understand now. The proposal was to generate what
amounts to C code using inline asm's in C++, rather than generate real
assembler and analyse it. As opposed to hal_mk_defs.c which does
generate assembler. I guess that would work, although I am a bit
uncomfortable with mixing up languages to this extent.
I'm not sure that's quite what I meant either, as you describe it there.
What I meant was something very similar to hal_mk_defs.c but the actual
inline directive doesn't matter. Right now hal_mk_defs.c uses .equ because
it wants the result to be available in asm, but we don't have that
problem. I was sorta getting at using #define as the output, i.e.
#define DEFINE(sym, val) \
asm volatile("\n\t#define \t" #sym ",%0" : : "i" (val))
The asm is never compiled so who cares :-). But on reflection this might
be a little risky to do directly so perhaps using some other marker and
then using sed to transform it into #define may be simpler after all :-).
It would be in C++ so there would be no mixed up languages. We would
simply be using sizeof() from a C++ file.
The only possible problem in fact is that it isn't just the size we might
need - it's the alignment requirements; but I'm sure we can do something
with GCC's __alignof__ for that. I think we're so far down the road of
relying on GCC features that we may as well give up trying to hold back!
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine