This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: Structure alignment with GCC


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


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