[comp.lang.c] g++ ld.c bug on SunOS 4.1

ken@csis.dit.csiro.au (Ken Yap) (12/11/90)

I keep seeing queries about why g++ won't work under SunOS 4.1 because
the generated binaries segfault, etc. I'm dismayed that archive keepers
at FSF and elsewhere haven't seen fit to put this fix in a file with a
prominent name like SunOS4.1-gld-bugfix. Here is the one line fix for
the problem. Better fixes probably exist but this one worked for me.  I
believe the ld.c in binutils works properly too.

RCS file: ld.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** /tmp/,RCSt1a16443	Tue Dec 11 12:29:07 1990
--- /tmp/,RCSt2a16443	Tue Dec 11 12:29:08 1990
***************
*** 1004,1009 ****
--- 1004,1010 ----
       This depends on the kind of system and on the output format selected.  */
  
    N_SET_MAGIC (outheader, magic);
+   outheader.a_entry = PAGSIZ;           /* SunOS 4.1 bug */
  #ifdef INITIALIZE_HEADER
    INITIALIZE_HEADER;
  #endif

ken@csis.dit.csiro.au (Ken Yap) (12/11/90)

Apologies for that last article, my finger (or brain) slipped, I should
have added a ++ to the group name.  I can't seem to cancel the article
with our setup here.  However, it does so happen that if you had
problems with gcc and gld on 4.1, well, this is the fix.  (But you
should use /bin/ld if you want shared libraries.)