🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1670

ld++, problem in layout_ctors_and_dtors ()

#1670
From: Johan Widen
Date: Thu, 02 Feb 1989 23:07
105 lines
2912 bytes
	struct relocation_info r1, r2;

in this function will not be completely initialized on any machine where
struct reloclation_info has other fields than those defined on a Sun.

This holds true for example on the Sequent Symmetry. The following patch
appears to fix the problem.

(This is the ld++ distributed with g++-1.32. The line numbers will differ
as I have made other changes.)

*** ld.c.old	Thu Jan 26 16:40:37 1989
--- ld.c	Thu Feb  2 23:48:28 1989
***************
*** 1927,1932
      }
  
    /* 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;
***************
*** 1928,1934
  
    /* 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;
***************
*** 1931,1937
    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
***************
*** 1935,1941
    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;
***************
*** 1938,1944
    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
--
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
Technical Details
Message-ID: <JW.89Feb3000717@obelisk.sics.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!xanth!uunet!mcvax!kth!osiris!sics.se!jw

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!xanth!uunet!mcvax!kth!osiris!sics.se!jw
From: jw@sics.se (Johan Widen)
Newsgroups: gnu.g++.bug
Subject: ld++, problem in layout_ctors_and_dtors ()
Message-ID: <JW.89Feb3000717@obelisk.sics.se>
Date: 2 Feb 89 23:07:17 GMT
Sender: news@osiris.sics.se
Distribution: gnu
Organization: Swedish Institute of Computer Science, Kista
Lines: 105