Porting Questions

Gabriel Dos Reis Gabriel.Dos-Reis@cmla.ens-cachan.fr
Thu Jun 28 11:10:00 GMT 2001


"David A. Greene" <greened@eecs.umich.edu> writes:

| Gabriel Dos Reis wrote:
| 
| > "David A. Greene" <greened@eecs.umich.edu> writes:
| > | 
| > | - There are many places where gcc's __builtin_* functions
| > | are called.  Obviously, we don't have these.  Right now
| 
| > | functions and #define be appropriate?  For example, test
| > | for __builting_alloca and #define ALLOCA_FUNCTION to
| > | alloca or __builtin_alloca as appropriate.
| > 
| > Basically we build a config header file at configure time pretty much
| > like c++config.h. Then your create a file, call it your-stubs.cc
| > (#including you header config file) where you define the 
| > missing functions.  Then you link it to the library.
| > You don't need to play macro hackery games.  If your compiler happens
| > to implement the missing __builtin_xxx then the only thing you need is
| > to remove your-stubs.cc.
| 
| Ok, I think I'm following you here.  What you're saying
| is to esentially put compiler runtime changes into libstdc++.
| Really, all this does is build a runtime support library
| for the compiler, which IMHO should stay with the compiler.
| I could easily implement __builtin_* for our compiler as
| a special runtime library, no sweat.  But this doesn't help
| all the other compilers out there.  Your solution _does_
| help all the other compilers but at the expense of being
| overly complicated, IMHO.

Overly complicated ?  

1) Using autotools, you can list the missing functions -- you can even
reuse c++config.h.

2) Except from __builtin_alloca, all __builtin_xxx do
have standard forms (from the C library) or can readily be implemented
in terms of C standard functions.

| Is this really what people want me to do?  If so, I'll do
| it, but it seems uglier than a #define to me. It does
| solve the problem of fabs(long double), of course.

You can use #define if that helps solve your problem, but I'm not
willing to play more CPP hackery games in V3 headers.  The point is
that, somehow you have to provide some homegrown definitions for some
missing symbols to accomodate some targets, so you'll have to do what
I'm saying in one or another form.

-- Gaby



More information about the Libstdc++ mailing list