This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: making aliases into the middle of a structure


On Apr 22, 1999, Zack Weinberg <zack@rabi.columbia.edu> wrote:

> On 22 Apr 1999 15:24:46 -0300, Alexandre Oliva wrote:
>> On Apr 22, 1999, Zack Weinberg <zack@rabi.columbia.edu> wrote:
>> 
>>> extern __typeof(x.b) y __attribute__ ((alias("x.b")));
>> 
>> This can't work.  The alias attribute defines an alias to a *symbol*,
>> not to an arbitrary expression. 

> I don't see that it would be terribly hard to extend alias so it could
> handle SYMBOL_REFs and COMPONENT_REFs as well as strings.

That would probably be a good idea.  alias could accept an arbitrary
expression.  If it's an lvalue within a global symbol, it will define
an actual alias, otherwise it could just emit an error or ``construct
a temporary and bind the reference to it'', to put it in C++ terms :-) 

>> why don't you compute the offset, say, in the configure
>> script, then #define the appropriate alias string?

> Because the preprocessor can't compute offsetof() all the way down;
> I'd have to compile and run a test program.  Which loses when
> cross-compiling.

Well, you could try to extract this information from the assembly
code, or from some RTL dump (since you're bound to gcc anyway), but I
wouldn't like to be the one to implement it :-)

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Brasil
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]