public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
From: msokolov@ivan.Harhan.ORG (Michael Sokolov)
To: crossgcc@sources.redhat.com
Subject: Re: Structure alignment with GCC
Date: Thu, 10 Aug 2000 22:44:00 -0000	[thread overview]
Message-ID: <0008110541.AA28881@ivan.Harhan.ORG> (raw)

gshubin <gshubin@wco.com> wrote:

> Thanks, now I have a good example of why it is always a bad idea to use structures
> for passing data. I usually use the example of inter-processor communication, but
> now you have given me and example of inter-compiler communication [...]

Unfortunately, you don't always get to choose. Sometimes GCC has no other
choice but to mirror the ABI of some proprietary compiler in aspects like
alignment and calling convention, however wrong it is. Consider PalmOS, for
example. (It's a popular handheld embedded OS for the Motorola 68328 Dragonball
chip.) It's designers were clearly assembly-phobiac C fans who wrote the whole
OS in C, compiled it with one particular proprietary compiler, and effectively
made that compiler's ABI, which apparently isn't even documented or formally
set down anywhere, the de facto ABI for their OS. PalmOS has no traditional
system calls or separation between the system and applications, instead OS
routines in the ROM and application routines that application programmers write
just freely call each other, and everything is built on the assumption that
everything is written in C, with the C ABI being that of the proprietary
compiler used to compile the OS. Ouch. This is the kind of stuff that no
programmer should ever see in his/her worst nightmare. I don't recall even
Microsoft doing something as bad. (But then I've had the fortune of complete
isolation from Microsoft since early 1993, so I have no idea what else they've
done since then.)

As for PalmOS, there are patched versions of gcc 2.7.2.2 and 2.95.2 that mimic
the right ABI, more or less. More or less because so far I haven't found any
formal spec or in fact any documentation whatsoever for it, so it's all pure
guesswork so far. This will surely make my life interesting in a perverse way
when I get to integrating this stuff into the current GCC.

--
Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			615 N GOOD LATIMER EXPY STE #4
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

             reply	other threads:[~2000-08-10 22:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-10 22:44 Michael Sokolov [this message]
2000-08-11  9:45 ` Greg Shubin
2000-08-11 12:48   ` Christopher Bahns
2000-08-11 15:15     ` Greg Shubin
  -- strict thread matches above, loose matches on Subject: below --
2000-08-25 22:07 Michael Sokolov
2000-08-11 13:06 Matthew R Wette
2000-08-11 10:00 Michael Sokolov
2000-08-24 10:25 ` David A. Desrosiers
2000-08-10 22:23 Michael Sokolov
2000-08-10 22:46 ` Doug Evans
2000-08-10 19:34 Christopher Bahns
2000-08-10 21:56 ` gshubin

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=0008110541.AA28881@ivan.Harhan.ORG \
    --to=msokolov@ivan.harhan.org \
    --cc=crossgcc@sources.redhat.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).