Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Compiling EMX programs with gcc4.3.2

1 view
Skip to first unread message

Ilya Zakharevich

unread,
Sep 9, 2009, 4:07:21 AM9/9/09
to
I just put emx-with-gcc4.zip to Hobbes. Below is the README-emx file
from the distribution.

Enjoy,
Ilya

=======================================================
How to compile applications with EMX runtime with newer gcc's.

0) What for? This may be necessary to avoid bugs in k-libc, and/or for
compatibility with libraries compiled for EMX runtime.

1) What are the problems to circumvent? Currently, the following
incompatibilities are known:

a) EMX (effectively) uses -fno-leading-underscore when in OMF mode (-Zomf)

b) The "system libraries" used by EMX are differently named;

c) EMX may be used with/without -Zmt (this modifies library path,
and makes certain defines);

d) GCC generates code calling some new `internal functions'; they are not
provided by EMX runtime;

e) It looks like newer gcc uses more aggressive optimization for `stdarg'
variable-argument functions; it looks like this produces wrong code
without pessimizations done in new headers.

2) How to circumvent the problems? Attached is a Perl script run_gcc4.pl
which modifies `gcc environment' so that gcc compiles and links vs.
(mostly) EMX headers and libraries.

However, certain modifications are needed (numeration matches one above):

a) gcc433 has a bug (?) so that -fno-leading-underscore is ignored;
I use gcc432;

b) c) are circumvented by the script;

d) to support "implicit alloca()" done by large data on stack, one needs
__alloca.a, __alloca.lib duplicated to c_dll.a, c_dll.lib (provided,
with source code).

No other new gcc-internal functions are provided - I needed none so far.

e) One needs pessimizations done in new stdarg.h.

Myself, for completeness I just copy directories
./emx, ./386, ./machine
and files
alloca.h, stdarg.h, varargs.h, sys/_types.h
from ./include directory of gcc3.3.5 to a separate directory, and assign
this directory to $GCC_SYSINCL in the script run_gcc4.pl.

3) Prerequisites:

A) C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, LIBRARY_PATH (maybe PATH too) set
up so EMX compiler works;

B) files listed above (the script on PATH, the libraries on LIBRARY_PATH,
headers directory in run_gcc4.pl);

C) Unpacked gcc4.3.2 binary distribution; assign the directory to $GCCDIR
in the script run_gcc4.pl.

D) pretty minimal Perl installation (binary-only is OK, if you comment
`use strict' line in the script).

4) Usage: instead of gcc use
perl -S run_gcc4.pl

5) Limitations: none known yet, but there must be many...

6) Where to get: gcc3.3.5 is in ftp://ftp.netlabs.org/pub/gcc/
I used gcc4.3.2 from http://download.smedley.info/gcc-4.3.2-os2-20081025.zip
perl is e.g., on http://ilyaz.org/software/perl/os2/582+
(perl_exc.zip is the minimal installation).

0 new messages