Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Johan Widen
Fri, 03 Feb 1989 22:30
ld++ for the Sequent Symmetry
Author: Johan Widen
Date: Fri, 03 Feb 1989 22:30
Date: Fri, 03 Feb 1989 22:30
473 lines
11525 bytes
11525 bytes
Enclosed is a patch for ld.c to make it work on the Sequent Symmetry.
ld++ still does not know about shared memory.
There are almost certainly some problems remaining with the port, but I have
managed to compile and run successfully many (but not all) of the testfiles
in libg++.
The following line should be put in the Makefile for compiling crt0.c on
a Sequent Symmetry.
$(CC) -D"CRT0_DUMMIES=bogus_fp," -DDOT_GLOBAL_START -g -c crt0.c
First a patch for crt0.c.
*** /tmp/src-g++/crt0.c Sun Dec 11 02:36:59 1988
--- crt0.c Thu Jan 26 17:34:52 1989
***************
*** 192,197
char **environ;
#endif
#if defined(orion) || defined(pyramid) || defined(celerity) || defined(ALLIANT)
#ifdef ALLIANT
--- 192,202 -----
char **environ;
#endif
+ #if defined(sequent)
+ asm(" .globl _387_flt");
+ asm(" .set _387_flt,0");
+ #endif
+
#if defined(orion) || defined(pyramid) || defined(celerity) || defined(ALLIANT)
#ifdef ALLIANT
*** ../g++-1.32/ld.c~ Sun Dec 11 00:51:48 1988
--- ld.c Thu Feb 2 23:48:28 1989
***************
*** 129,134
#define N_PAGSIZ(x) PAGSIZ
#define N_SEGSIZ(x) SEGSIZ
#endif vax
#endif
#ifndef N_TXTADDR
--- 129,140 -----
#define N_PAGSIZ(x) PAGSIZ
#define N_SEGSIZ(x) SEGSIZ
#endif vax
+ #ifdef sequent
+ #define PAGSIZ 4096
+ #define SEGSIZ PAGSIZ
+
+ #define N_PAGSIZ(x) PAGSIZ
+ #define N_SEGSIZ(x) SEGSIZ
#endif
#endif
***************
*** 130,135
#define N_SEGSIZ(x) SEGSIZ
#endif vax
#endif
#ifndef N_TXTADDR
#ifdef vax
--- 136,142 -----
#define N_PAGSIZ(x) PAGSIZ
#define N_SEGSIZ(x) SEGSIZ
#endif
+ #endif
#ifndef N_TXTADDR
#ifdef vax
***************
*** 135,142
#ifdef vax
#define TXTRELOC 0
#define N_TXTADDR(x) TXTRELOC
- #endif vax
-
#define N_DATADDR(x) \
(((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \
: (N_SEGSIZ(x)+((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZ(x)-1))))
--- 142,147 -----
#ifdef vax
#define TXTRELOC 0
#define N_TXTADDR(x) TXTRELOC
#define N_DATADDR(x) \
(((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \
: (N_SEGSIZ(x)+((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZ(x)-1))))
***************
*** 140,145
#define N_DATADDR(x) \
(((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \
: (N_SEGSIZ(x)+((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZ(x)-1))))
#define N_BSSADDR(x) (N_DATADDR(x)+(x).a_data)
#endif
--- 145,158 -----
#define N_DATADDR(x) \
(((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \
: (N_SEGSIZ(x)+((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZ(x)-1))))
+ #endif vax
+ #ifdef sequent
+ #define N_TXTADDR(x) \
+ (N_ADDRADJ(x))
+ #define N_DATADDR(x) \
+ (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \
+ : (N_SEGSIZ(x)+(((x).a_text-1) & ~(N_SEGSIZ(x)-1))))
+ #endif sequent
#define N_BSSADDR(x) (N_DATADDR(x)+(x).a_data)
#endif
***************
*** 788,793
/* Now check some option settings for consistency. */
if ((magic == ZMAGIC || magic == NMAGIC)
&& (text_start - text_start_alignment) & (page_size - 1))
fatal ("-T argument not multiple of page size, with sharable output", 0);
--- 801,807 -----
/* Now check some option settings for consistency. */
+ #ifdef NMAGIC
if ((magic == ZMAGIC || magic == NMAGIC)
#else
if ((magic == ZMAGIC)
***************
*** 789,794
/* Now check some option settings for consistency. */
if ((magic == ZMAGIC || magic == NMAGIC)
&& (text_start - text_start_alignment) & (page_size - 1))
fatal ("-T argument not multiple of page size, with sharable output", 0);
--- 803,811 -----
#ifdef NMAGIC
if ((magic == ZMAGIC || magic == NMAGIC)
+ #else
+ if ((magic == ZMAGIC)
+ #endif
&& (text_start - text_start_alignment) & (page_size - 1))
fatal ("-T argument not multiple of page size, with sharable output", 0);
***************
*** 855,860
magic = OMAGIC;
return;
case 'n':
magic = NMAGIC;
return;
--- 872,878 -----
magic = OMAGIC;
return;
+ #ifdef NMAGIC
case 'n':
magic = NMAGIC;
return;
***************
*** 858,863
case 'n':
magic = NMAGIC;
return;
case 'o':
output_filename = arg;
--- 876,882 -----
case 'n':
magic = NMAGIC;
return;
+ #endif
case 'o':
output_filename = arg;
***************
*** 1351,1356
case N_BSS:
reftype = "defined in BSS section";
break;
}
fprintf (stderr, "symbol %s %s in ", sp->name, reftype);
--- 1370,1397 -----
case N_BSS:
reftype = "defined in BSS section";
break;
+
+ #ifdef sequent
+ case N_FN:
+ reftype = "filename";
+ break;
+
+ case N_SHUNDF:
+ reftype = "shared undf";
+ break;
+
+ case N_SHDATA:
+ reftype = "shared data";
+ break;
+
+ case N_SHBSS:
+ reftype = "shared BSS";
+ break;
+
+ default:
+ reftype = "I don't know this type";
+ break;
+ #endif
}
fprintf (stderr, "symbol %s %s in ", sp->name, reftype);
***************
*** 1886,1891
}
/* Do relocation. Initialize invariant data. */
#if defined(sun) && (TARGET == SUN4)
r1.r_addend = 0;
r1.r_type = RELOC_32;
--- 1927,1934 -----
}
/* Do relocation. Initialize invariant data. */
+ bzero(&r1, sizeof(r1));
+ bzero(&r2, sizeof(r2));
#if defined(sun) && (TARGET == SUN4)
r1.r_type = RELOC_32;
r1.r_extern = 1;
***************
*** 1887,1893
/* Do relocation. Initialize invariant data. */
#if defined(sun) && (TARGET == SUN4)
- r1.r_addend = 0;
r1.r_type = RELOC_32;
r1.r_extern = 1;
r2.r_addend = 0;
--- 1930,1935 -----
bzero(&r1, sizeof(r1));
bzero(&r2, sizeof(r2));
#if defined(sun) && (TARGET == SUN4)
r1.r_type = RELOC_32;
r1.r_extern = 1;
r2.r_type = RELOC_32;
***************
*** 1890,1896
r1.r_addend = 0;
r1.r_type = RELOC_32;
r1.r_extern = 1;
- r2.r_addend = 0;
r2.r_type = RELOC_32;
r2.r_extern = 1;
#else
--- 1932,1937 -----
#if defined(sun) && (TARGET == SUN4)
r1.r_type = RELOC_32;
r1.r_extern = 1;
r2.r_type = RELOC_32;
r2.r_extern = 1;
#else
***************
*** 1894,1900
r2.r_type = RELOC_32;
r2.r_extern = 1;
#else
- r1.r_pcrel = 0;
r1.r_length = 2;
r1.r_extern = 1;
r2.r_pcrel = 0;
--- 1935,1940 -----
r2.r_type = RELOC_32;
r2.r_extern = 1;
#else
r1.r_length = 2;
r1.r_extern = 1;
r2.r_length = 2;
***************
*** 1897,1903
r1.r_pcrel = 0;
r1.r_length = 2;
r1.r_extern = 1;
- r2.r_pcrel = 0;
r2.r_length = 2;
r2.r_extern = 1;
#endif
--- 1937,1942 -----
#else
r1.r_length = 2;
r1.r_extern = 1;
r2.r_length = 2;
r2.r_extern = 1;
#endif
***************
*** 2130,2135
/* If necessary, pad text section to full page in the file.
Include the padding in the text segment size. */
if (magic == NMAGIC || magic == ZMAGIC)
{
int text_end = text_size + N_TXTOFF (outheader);
--- 2169,2175 -----
/* If necessary, pad text section to full page in the file.
Include the padding in the text segment size. */
+ #ifdef NMAGIC
if (magic == NMAGIC || magic == ZMAGIC)
#else
if (magic == ZMAGIC)
***************
*** 2131,2136
Include the padding in the text segment size. */
if (magic == NMAGIC || magic == ZMAGIC)
{
int text_end = text_size + N_TXTOFF (outheader);
text_pad = ((text_end + page_size - 1) & (- page_size)) - text_end;
--- 2171,2179 -----
#ifdef NMAGIC
if (magic == NMAGIC || magic == ZMAGIC)
+ #else
+ if (magic == ZMAGIC)
+ #endif
{
int text_end = text_size + N_TXTOFF (outheader);
text_pad = ((text_end + page_size - 1) & (- page_size)) - text_end;
***************
*** 2138,2143
}
outheader.a_text = text_size;
/* Make the data segment address start in memory on a suitable boundary. */
--- 2181,2189 -----
}
outheader.a_text = text_size;
+ #ifdef sequent
+ outheader.a_text += N_ADDRADJ (outheader);
+ #endif
/* Make the data segment address start in memory on a suitable boundary. */
***************
*** 2457,2462
outheader.a_machtype = HP9000S200_ID;
#endif
outheader.a_text = text_size;
outheader.a_data = data_size;
outheader.a_bss = bss_size;
outheader.a_entry = (entry_symbol ? entry_symbol->value
--- 2503,2511 -----
outheader.a_machtype = HP9000S200_ID;
#endif
outheader.a_text = text_size;
+ #ifdef sequent
+ outheader.a_text += N_ADDRADJ (outheader);
+ #endif
outheader.a_data = data_size;
outheader.a_bss = bss_size;
outheader.a_entry = (entry_symbol ? entry_symbol->value
***************
*** 2731,2736
fatal_with_file ("nonexternal relocation code invalid in ", entry);
}
#if defined(sun) && (TARGET == SUN4)
if (p->r_type >= RELOC_DISP8 && p->r_type <= RELOC_WDISP22)
#else
--- 2780,2832 -----
fatal_with_file ("nonexternal relocation code invalid in ", entry);
}
+ #if defined(sequent)
+ if (p->r_bsr) /* BSR is a Balance CALL instruction... */
+ {
+ relocation -= pc_relocation;
+
+ switch (length)
+ {
+ case 0:
+ *(char *) (data + addr) = relocation - *(char *) (data + addr);
+ break;
+
+ case 1:
+ *(short *) (data + addr) = relocation - *(short *) (data + addr);
+ break;
+
+ case 2:
+ *(int *) (data + addr) = relocation - *(int *) (data + addr);
+ break;
+
+ default:
+ fatal_with_file ("invalid relocation field length in ", entry);
+ }
+ }
+ else
+ {
+ if (p->r_pcrel)
+ relocation -= pc_relocation;
+
+ switch (length)
+ {
+ case 0:
+ *(char *) (data + addr) += relocation;
+ break;
+
+ case 1:
+ *(short *) (data + addr) += relocation;
+ break;
+
+ case 2:
+ *(int *) (data + addr) += relocation;
+ break;
+
+ default:
+ fatal_with_file ("invalid relocation field length in ", entry);
+ }
+ }
+ #else
#if defined(sun) && (TARGET == SUN4)
if (p->r_type >= RELOC_DISP8 && p->r_type <= RELOC_WDISP22)
#else
***************
*** 2809,2814
default:
fatal_with_file ("invalid relocation field length in ", entry);
}
#endif
}
}
--- 2905,2911 -----
default:
fatal_with_file ("invalid relocation field length in ", entry);
}
+ #endif
#endif
}
}
--
Johan Widen
SICS, PO Box 1263, S-164 28 KISTA, SWEDEN
Tel: +46 8 752 15 32 Ttx: 812 61 54 SICS S Fax: +46 8 751 72 30
Internet: jw@sics.se or {mcvax,munnari,ukc,unido}!enea!sics.se!jw
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads