Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers LCC > building lcc 4....
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1034 of 1062
Post > Topic >>

building lcc 4.2 on linux

by odt@[EMAIL PROTECTED] (Olaf Dietrich) Apr 18, 2008 at 09:00 AM

Hi,

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


* As re****ted before, (Message-ID: <bvqf4t$ft5$1@[EMAIL PROTECTED]
>
  or <1156087442.615889.184160@[EMAIL PROTECTED]
>)
  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
@[EMAIL PROTECTED]
 -10,8 +10,8 @[EMAIL PROTECTED]
 
 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 };
@[EMAIL PROTECTED]
 -35,7 +35,7 @[EMAIL PROTECTED]
 
 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
 




 1 Posts in Topic:
building lcc 4.2 on linux
odt@[EMAIL PROTECTED] (O  2008-04-18 09:00:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 23 23:42:34 CDT 2008.