Bug 33354

Summary: gcc ia64 short data segment overflowed (0x4001e8 >= 0x400000)
Product: [Retired] Red Hat Linux Reporter: John Reiser <jreiser>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: paul
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-04-25 13:10:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description John Reiser 2001-03-27 05:13:59 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.75 [en] (X11; U; Linux 2.2.5-15 i586)

There is no way to compile and load a program which uses
more than 262144 string constants.  On other platforms,
"-fpic" and/or "-G 8" can be used to generate
"worst case" code that has "no limits" other than the full
address space.  But currently on ia64, -G is unrecognized
and code compiled -fpic still can get "short data segment

(This specific reproducible test case is abstracted from
a real program which is too cumbersome to present in a bug report.)

Reproducible: Always
Steps to Reproduce:
1.compile & run generator program genstring.c:
    gcc genstring.c; ./a.out  ## generates f0.c .. f511.c
2.compile a main program and the 512 generated files:
    gcc -c -fpic main.c f*.c
3.attempt to link
    gcc main.o f*.o

#include <stdio.h>

	int f0,f1,g,h;
    for (h=0; h<512; ++h) {
	char buf[10];
	FILE *file;
	sprintf(buf, "f%d.c", h);
	file = fopen(buf, "w");
	for (f0=0; f0<64; ++f0) {
		fprintf(file, "static char ");
		for (f1=8; --f1>=0; ) {
			fprintf(file, "*s%d%s",
				(f0<<3)|f1, ((0!=f1) ? "," : ";\n") );
	fprintf(file, "void f%d(){\n", h);
	for (f0=0; f0<64; ++f0) {
		for (f1=8; --f1>=0; ) {
			fprintf(file, "\ts%d=\"string %d\";\n",
				(f0<<3)|f1, (f0<<3)|f1 );
	fprintf(file, "}\n");
	return 0;
-----end genstring.c

extern void f128();
-----end main.c


Actual Results:
ld: a.out: short data segment overflowed (0x4001e8 >= 0x400000)
collect2: ld returned 1 exit status

Expected Results:  Successful completion of load with no complaint.

Comment 1 Jakub Jelinek 2001-04-25 13:09:58 UTC
-G is not recognized IMHO just because of omission in specs,
should fix it (or hand edit
and change line after *cc1: to
  %{profile:-p} %{G*}

Comment 2 Jakub Jelinek 2001-04-28 18:10:39 UTC
-G is supported on ia64 in gcc-2.96-82.