public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Zack Weinberg <zack@rabi.columbia.edu>
To: law@cygnus.com
Cc: egcs@egcs.cygnus.com
Subject: Re: making aliases into the middle of a structure
Date: Fri, 23 Apr 1999 10:40:00 -0000	[thread overview]
Message-ID: <199904231740.NAA18365@blastula.phys.columbia.edu> (raw)
In-Reply-To: <3059.924848074@upchuck.cygnus.com>

On Fri, 23 Apr 1999 00:14:34 -0600, Jeffrey A Law wrote:
>
>  In message < org15s33hj.fsf@lua.lbi.dcc.unicamp.br >you write:
>  > > 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 :-)
>Cygnus implemented a switch to have the compiler dump offsets for fields
>within structures in a format intended to be used by assembly code.
>
>It's not something we've used a lot and haven't ever thought it worth
>the effort to clean it up and submit it to egcs.

This is a cute idea, and I could think of uses in libc, but it doesn't
really solve my current problem (without excessive magic).  I'd much
rather be able to write

extern int var __attribute__ ((alias (structure.field)));

which is what the patch I sent yesterday implements.

Incidentally, I found what I think is a GAS bug: it forgets
aliases to symbols allocated with .comm.  For example:

int common;
extern int alias __attribute__ ((alias("common")));

`alias' will not be defined in the object file.  The assembly dump
looks correct to me.

zw

WARNING: multiple messages have this Message-ID
From: Zack Weinberg <zack@rabi.columbia.edu>
To: law@cygnus.com
Cc: egcs@egcs.cygnus.com
Subject: Re: making aliases into the middle of a structure
Date: Fri, 30 Apr 1999 23:15:00 -0000	[thread overview]
Message-ID: <199904231740.NAA18365@blastula.phys.columbia.edu> (raw)
Message-ID: <19990430231500.IdZbA7M_ThAVHTOSHv1fd8YXwyf7f3rLNCUZe3dIeV8@z> (raw)
In-Reply-To: <3059.924848074@upchuck.cygnus.com>

On Fri, 23 Apr 1999 00:14:34 -0600, Jeffrey A Law wrote:
>
>  In message < org15s33hj.fsf@lua.lbi.dcc.unicamp.br >you write:
>  > > 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 :-)
>Cygnus implemented a switch to have the compiler dump offsets for fields
>within structures in a format intended to be used by assembly code.
>
>It's not something we've used a lot and haven't ever thought it worth
>the effort to clean it up and submit it to egcs.

This is a cute idea, and I could think of uses in libc, but it doesn't
really solve my current problem (without excessive magic).  I'd much
rather be able to write

extern int var __attribute__ ((alias (structure.field)));

which is what the patch I sent yesterday implements.

Incidentally, I found what I think is a GAS bug: it forgets
aliases to symbols allocated with .comm.  For example:

int common;
extern int alias __attribute__ ((alias("common")));

`alias' will not be defined in the object file.  The assembly dump
looks correct to me.

zw

  reply	other threads:[~1999-04-23 10:40 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-22 11:13 Zack Weinberg
1999-04-22 11:25 ` Alexandre Oliva
1999-04-22 11:30   ` Zack Weinberg
1999-04-22 11:38     ` Alexandre Oliva
1999-04-22 14:31       ` Zack Weinberg
1999-04-23 15:24         ` Richard Henderson
1999-04-23 16:27           ` Zack Weinberg
1999-04-23 16:52             ` Richard Henderson
1999-04-30 23:15               ` Richard Henderson
1999-04-30 23:15             ` Zack Weinberg
1999-04-30 23:15           ` Richard Henderson
1999-04-30 23:15         ` Zack Weinberg
1999-04-23 10:34       ` Jeffrey A Law
1999-04-23 10:40         ` Zack Weinberg [this message]
1999-04-23 15:54           ` Richard Henderson
1999-04-23 16:19             ` Zack Weinberg
1999-04-26  1:46               ` Andreas Schwab
1999-04-30 23:15                 ` Andreas Schwab
1999-04-30 23:15               ` Zack Weinberg
1999-04-30 23:15             ` Richard Henderson
1999-04-30 23:15           ` Zack Weinberg
1999-04-23 13:36         ` Jamie Lokier
1999-04-23 13:49           ` Zack Weinberg
1999-04-23 15:20             ` Jamie Lokier
1999-04-30 23:15               ` Jamie Lokier
1999-04-23 22:58             ` Andi Kleen
1999-04-30 23:15               ` Andi Kleen
1999-04-30 23:15             ` Zack Weinberg
1999-04-24 21:53           ` Jeffrey A Law
1999-04-30 23:15             ` Jeffrey A Law
1999-04-30 23:15           ` Jamie Lokier
1999-04-30 23:15         ` Jeffrey A Law
1999-04-30 23:15       ` Alexandre Oliva
1999-04-30 23:15     ` Zack Weinberg
1999-04-30 23:15   ` Alexandre Oliva
1999-04-30 23:15 ` Zack Weinberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199904231740.NAA18365@blastula.phys.columbia.edu \
    --to=zack@rabi.columbia.edu \
    --cc=egcs@egcs.cygnus.com \
    --cc=law@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).