From: Linus Torvalds (torvalds@klaava.Helsinki.FI)
Date: 03/11/93


From: torvalds@klaava.Helsinki.FI (Linus Torvalds)
Subject: Re: [Q] What is "Exec format error. Wrong Architecture"?
Date: Thu, 11 Mar 1993 20:05:29 GMT

In article <10265@lhdsy1.lahabra.chevron.com> jjctc@lhdsy1.lahabra.chevron.com (James C. Tsiao) writes:
>
>Currently I'm trying to port some fortran programs onto
>my Linux machine. I've run into an error that I cannot
>resolve. Basically, the fortran program dimensions some
>rather large arrays. The program runs with one set of
>array size, but if I increase the array size by 1 Meg,
>then the program will not run. Instead it produces the
>following error:
>
>plog: Exec format error. Wrong Architecture.
>
>"Plog" is the name of the program. On the working (smaller)
>version, 'size plog' gives:
>
>text data bss dec hex
>425984 86016 49308736 49820736 2f83440
>
>On the non-working version, 'size plog' gives:
>
>text data bss dec hex
>425984 86016 53308736 53820736 3353d40

Oops. Mea culpa. I "usually" don't run quite that big binaries (read:
never even tried), and there is a outdated test in the execve code that
tests the size of the binaries. The file is linux/fs/exec.c, and the
bug is somewhere around line 570 or so.. Looks like this:

        if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC) ||
                ex.a_trsize || ex.a_drsize ||
*** ex.a_text+ex.a_data+ex.a_bss>0x3000000 ||
                inode->i_size < ex.a_text+ex.a_data+ex.a_syms+N_TXTOFF(ex)) {
                retval = -ENOEXEC;
                goto exec_error2;
        }

The offending line is marked with *** - it checks that the executable is
less than 48MB due to the original linux address space restrictions
(before I rewrote the memory manager in 0.95 or so). Just remove the
line, recompile the kernel, and everything should be ok (actually, there
is a process size limit even in the current memory manager, but it's at
a much more reasonable 1.5GB).

        Linus "there was a time when I thought 48MB was a lot" Torvalds