Bug 378 - [AIX] gcc cannot compile huge c file
Summary: [AIX] gcc cannot compile huge c file
Status: SUSPENDED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 2.95.2
: P3 enhancement
Target Milestone: ---
Assignee: David Edelsohn
URL:
Keywords:
: 4587 8305 (view as bug list)
Depends on:
Blocks:
 
Reported: 2000-07-05 13:56 UTC by tsawan
Modified: 2017-12-13 10:41 UTC (History)
4 users (show)

See Also:
Host:
Target: *-*-aix4.3*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-24 17:07:20


Attachments
gccaixbug.tar.gz (1.11 MB, application/x-gzip )
2003-05-21 15:17 UTC, tsawan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tsawan 2000-07-05 13:56:02 UTC
EB43_1.s: line 599772: The displacement must be greater than or equal to
        -32768 and less than or equal to 32767.

Release:
gcc2.95.2

Environment:
AIX 4.3.2

How-To-Repeat:
gunzip gccaixbug.tar.gz
tar -xvf gccaixbug.tar
cd gccaixbug
open the bug.log file to view a run session log

to run please type:  gcc -c EB43_1.c
Comment 1 tsawan 2000-07-05 13:56:02 UTC
Fix:
Split file into smaller chunks.
Comment 2 David Edelsohn 2001-09-24 14:46:56 UTC
Responsible-Changed-From-To: unassigned->dje
Responsible-Changed-Why: AIX
Comment 3 David Edelsohn 2001-09-24 14:46:56 UTC
State-Changed-From-To: open->suspended
State-Changed-Why: GCC not sophisticated enough to recognize and work-around
    this type of failure.
Comment 4 Dara Hazeghi 2003-06-16 19:12:11 UTC
*** Bug 4587 has been marked as a duplicate of this bug. ***
Comment 5 Steven Bosscher 2004-12-19 14:42:22 UTC
Can we close this bug as WONTFIX, or is it still an issue with 
newer AIX versions? 
 
 
Comment 6 David Edelsohn 2004-12-19 20:37:17 UTC
Other compilers for AIX can work around this problem, but this is asking a lot
from the compiler.  I am recategorizing this as an enhancement request.
Comment 7 Francois-Xavier Coudert 2005-01-10 09:53:32 UTC
Currently, the main problem with building for AIX5.1 is that TOC for cc1 and
f951 are too big for the linker to handle. Extra flags must be used:
-Wl,-bbigtoc and -mminimal-toc, that the configure mechanism doesn't set up as
default, so using LDFLAGS and CFLAGS is required. Could this be included
somewhere in the configure?

PS: if you feel a new PR is needed, I will do it.
Comment 8 Sergey Kashyrin 2006-02-24 17:53:49 UTC
Any chances to get it resolved ?

This severe bug is a showstopper for using OpenCobol with GCC on AIX platform
because all C programs are generated and there are no way to reduce the size of the programs automatically due to nature of Cobol language.
Comment 9 satyakaam Goswami 2007-03-28 09:32:36 UTC
Hi,
   We are getting the same error on AIX 5.3.0.0 , with gcc 3.2.3.
any fix for this bug in near future.

regards
Satya
Comment 10 Doug Dawson 2014-04-01 15:45:53 UTC
Has any progress been made on this bug? It still affects AIX 6.1 on gcc Version 4.7.2 compiling a 64 Bit gSOAP generated source.

AIX:doug:1> oslevel
6.1.0.0
AIX:doug:1> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix6.1.0.0/4.7.2/lto-wrapper
Target: powerpc-ibm-aix6.1.0.0
Configured with: configure --prefix=/opt/freeware --enable-languages=c,c++ --enable-threads=posix --disable-nls --with-gmp=/opt/freeware --with-mpfr=/opt/freeware --with-mpc=/opt/freeware --disable-libstdcxx-pch
Thread model: aix
gcc version 4.7.2 (GCC)
AIX:doug:1>
Comment 11 David Edelsohn 2014-04-01 16:02:04 UTC
Recent releases of GCC are built with linker options to allow larger data section. Are the user process limits (ulimit) set large enough?  One could rebuild GCC cc1 and cc1plus with even larger -bmaxdata value (or patch the binary with a larger value), but it's not clear which limit is hit.
Comment 12 Doug Dawson 2014-04-01 18:44:45 UTC
(In reply to David Edelsohn from comment #11)
> Recent releases of GCC are built with linker options to allow larger data
> section. Are the user process limits (ulimit) set large enough?  One could
> rebuild GCC cc1 and cc1plus with even larger -bmaxdata value (or patch the
> binary with a larger value), but it's not clear which limit is hit.

Current ulimit values:

core file size          (blocks, -c) 1048575
data seg size           (kbytes, -d) 262144
file size               (blocks, -f) 2097151
max memory size         (kbytes, -m) 32768
open files                      (-n) 2000
pipe size            (512 bytes, -p) 64
stack size              (kbytes, -s) 131072
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited


I changed the ulimits below, but had the same results. Note that this source compiles as 32 Bit on AIX 5.3 using 'gcc version 4.2.4'.

ulimit -d 393216
ulimit -m 65536
ulimit -s 262144
ulimit -n 4000

/tmp//ccZ4WBed.s: line 2939315: 1252-171 The displacement must be greater than or equal to
        -32768 and less than or equal to 32767.

When you say rebuild GCC cc1/cc1plus with even larger -bmaxdata, are you refering to the AIX environmental 'export LDR_CNTRL=MAXDATA=0x50000000'? Is this the recommended value?
Comment 13 David Edelsohn 2014-04-03 14:00:23 UTC
I mis-remembered the bug. This is a problem with branch distance. The GNU Assembler, GNU Linker and GOLD allow instruction relaxation that creates long branch stubs for far branches. The AIX toolchain does not provide equivalent functionality.
Comment 14 Lorinczy Zsigmond 2017-12-13 10:41:44 UTC
Problem still present in gcc-4.8.3 (AIX6/PowerPC/64bit); couldn't compile 'readelf.c' from 'GNU!binutils-2.29'. (Note: the problem has nothing to do with the linking.)