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

building lcc 4.2 on linux

8 views
Skip to first unread message

Olaf Dietrich

unread,
Apr 18, 2008, 5:00:06 AM4/18/08
to
Hi,

I've just built lcc for linux and found some issues
that perhaps could be fixed:


* As reported before, (Message-ID: <bvqf4t$ft5$1...@grizzly.ps.uni-sb.de>
or <1156087442.6...@b28g2000cwb.googlegroups.com>)
cpp is not longer found /usr/lib/gcc/i486-linux-gnu/4.1.2/ (or
similar). So, if the gcc preprocessor is still required (is it?),
then linux.c should be updated. I tried the following (not really
knowing what I'm doing here - i.e. are there any potential
problems with the absolute path to cpp?):


--- etc/linux.c.orig 2008-04-18 09:37:10.000000000 +0200
+++ etc/linux.c 2008-04-18 10:12:26.000000000 +0200
@@ -10,8 +10,8 @@

char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
char inputs[256] = "";
-char *cpp[] = { LCCDIR "gcc/cpp",
- "-U__GNUC__", "-D_POSIX_SOURCE", "-D__STDC__=1", "-D__STRICT_ANSI__",
+char *cpp[] = {"/usr/bin/cpp",
+ "-U__GNUC__", "-D_POSIX_SOURCE", "-D__STRICT_ANSI__",
"-Dunix", "-Di386", "-Dlinux",
"-D__unix__", "-D__i386__", "-D__linux__", "-D__signed__=signed",
"$1", "$2", "$3", 0 };
@@ -35,7 +35,7 @@

int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
- cpp[0] = concat(&arg[8], "/gcc/cpp");
+ cpp[0] = "/usr/bin/cpp";
include[0] = concat("-I", concat(&arg[8], "/include"));
include[1] = concat("-I", concat(&arg[8], "/gcc/include"));
ld[9] = concat(&arg[8], "/gcc/crtbegin.o");

* There is another change shown in the diff above, which avoids constants
warnings about the redefinition of __STDC__:

lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/8q.s:
<command line>:1:1: warning: "__STDC__" redefined
<built-in>: warning: this is the location of the previous definition

I removed the definition "-D__STDC__=1", from the driver linux.c.

* Finally the test doesn't run very smooth; its result is:


lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/8q.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/array.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/cf.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/cq.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/cvt.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/fields.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/front.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/incr.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/init.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/limits.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/paranoia.s:
117c117
< pushl $.LC2
---
> pushl $.LC14
120c120
< pushl $_iob+32
---
> pushl stdout
125c125
[...
about 6660 more lines of diffs!
...]
20577c20581
< .LC8:
---
> .LC19:
20581c20585
< .LC2:
---
> .LC14:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/sort.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/spill.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/stdarg.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/struct.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/switch.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/wf1.s:
lcc/4.2/x86-linux/rcc -target=x86/linux lcc/4.2/x86-linux/x86/linux/tst/yacc.s:
25,27c25,27
< jmp .LC3
< .LC2:
< .LC5:
---
> jmp .LC14
> .LC13:
> .LC16:
30c30
< jl .LC6
---
> jl .LC17
[...
about 1150 more lines of diffs!
...]


Anyway, the resulting compiler appears to be working! Great work!


Olaf

0 new messages