public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* Re: GNU ld for SCO OpenServer 5
       [not found] ` <5db8v9$eib@gw0.dgii.com>
@ 1998-10-03 20:47   ` Jouke Numan
  0 siblings, 0 replies; only message in thread
From: Jouke Numan @ 1998-10-03 20:47 UTC (permalink / raw)
  To: Robert Lipe

Robert Lipe wrote:

> In <32F7F8E9.2876@ozemail.com.au> Russell Robinson
> <russellr@ozemail.com.au> writes:
>
> >GNU binutils-2.7 contains an "ld" that doesn't support OpenServer 5.
>
> That's correct.  Nobody (to my knowledge) has taken the time to train
> GNU ld how to deal with SCO's idea of implementing weak symbols in
> COFF.  It's probably not horribly hard for someone that knows about
> such things.  You just listed the only justification I can think of
> for doing it - g++ demangling.
>


I have to admit I did get BFD & ld working for OS5. Apply the
following patches to the binutils-2.7 distribution to get ld working
on OS5. Unfortunately they are not sufficient to be included in a
general distribution because the same COFF types are also used by
other targets. If someone solves that, he/she is free to redistribute
my edits. Unfortunately, I've no time to spend time to do it
myself. Another unsolved thing is the integration with gcc, I used gld
as a standalone linker.

Another benefit of the patches is that nm works on COFF objects which
have weak symbols, so even if you don't want ld on OS5, some of the
edits may be of interest.

				Success!


Patches to get weak symbols working (Luckily there is a NT_WEAK, I just
duplicated
the coding):

*** binutils-2.7/bfd/coffcode.h.orig    Wed Jul 10 17:19:29 1996
--- binutils-2.7/bfd/coffcode.h Tue Sep 10 10:17:09 1996
***************
*** 3233,3238 ****
--- 3233,3239 ----
            /* PE uses storage class 0x67 for a weak external symbol. 
*/
            case C_NT_WEAK:
  #endif
+           case C_SCO_WEAKEXT:
              if ((src->u.syment.n_scnum) == 0)
                {
                  if ((src->u.syment.n_value) == 0)
***************
*** 3276,3281 ****
--- 3277,3284 ----
              if (src->u.syment.n_sclass == C_NT_WEAK)
                dst->symbol.flags = BSF_WEAK;
  #endif
+             if (src->u.syment.n_sclass == C_SCO_WEAKEXT)
+               dst->symbol.flags = BSF_WEAK;
  
              break;
  
***************
*** 3461,3466 ****
--- 3464,3470 ----
  #ifdef COFF_WITH_PE
  #define OTHER_GLOBAL_CLASS C_SECTION
  #endif
+ #define OTHER_GLOBAL_CLASS C_SCO_WEAKEXT
  
  #ifdef OTHER_GLOBAL_CLASS
  
*** binutils-2.7/include/coff/internal.h.orig   Thu Jul  4 18:21:13 1996
--- binutils-2.7/include/coff/internal.h        Mon Sep  9 15:19:05 1996
***************
*** 215,220 ****
--- 215,225 ----
  #define C_ALIAS               105     /* duplicate tag               
*/
  #define C_HIDDEN      106     /* ext symbol in dmert public lib */
  
+ 
+   /* Storage classes for SCO OS5  */
+ #define C_SHADOW        107     /* shadow symbol                */
+ #define C_SCO_WEAKEXT   108     /* weak external                */
+ 
  /* New storage classes for WINDOWS_NT   */
  #define C_SECTION       104     /* section name */
  #define C_NT_WEAK     105     /* weak external */



Edits to get ld made:

*** binutils-2.7/configure.in.orig      Mon Jul 15 21:15:15 1996
--- binutils-2.7/configure.in   Mon Sep  9 13:27:00 1996
***************
*** 452,458 ****
    i[345]86-*-sco3.2v5*)
      # The linker does not yet know about weak symbols in COFF,
      # and is not configured to handle mixed ELF and COFF.
!     noconfigdirs="$noconfigdirs gprof ld target-libgloss"
      ;;
    i[345]86-*-sco*)
      noconfigdirs="$noconfigdirs gprof target-libgloss"
--- 452,458 ----
    i[345]86-*-sco3.2v5*)
      # The linker does not yet know about weak symbols in COFF,
      # and is not configured to handle mixed ELF and COFF.
!     noconfigdirs="$noconfigdirs gprof target-libgloss"
      ;;
    i[345]86-*-sco*)
      noconfigdirs="$noconfigdirs gprof target-libgloss"

*** binutils-2.7/ld/scripttempl/i386coff.sc.orig        Thu Jul  4
18:25:04 1996
--- binutils-2.7/ld/scripttempl/i386coff.sc     Mon Sep  9 15:49:29 1996
***************
*** 13,18 ****
--- 13,19 ----
  
  SECTIONS
  {
+   ${RELOCATING+ _runtime_env = 0x02020008;}
    .text ${RELOCATING+ SIZEOF_HEADERS} : {
      ${RELOCATING+ *(.init)}
      *(.text)
***************
*** 27,33 ****
    {                                   
      *(.bss)
      *(COMMON)
!     ${RELOCATING+ end = .};
    }
    ${RELOCATING- ${INIT}}
    ${RELOCATING- ${FINI}}
--- 28,35 ----
    {                                   
      *(.bss)
      *(COMMON)
!     ${RELOCATING+ _end = .;}
!     ${RELOCATING+ end = .;}
    }
    ${RELOCATING- ${INIT}}
    ${RELOCATING- ${FINI}}

-- 
+------------------------------------------------------+
| Signature of: Jouke Numan  <jnuman@hiscom.nl>        |
| HISCOM bv, department of Systems Development         |
| Schipholweg 97, 2316 AX  Leiden, the Netherlands     |
| +31-71-5256757 (office) +31-71-5216675 (FAX)         |
+------------------------------------------------------+


From owner-gas2@cygnus.com  Mon Oct  5 06:49:10 1998
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) id GAA22404;
	Mon, 5 Oct 1998 06:41:16 -0700 (PDT)
Received: from out4.ibm.net (out4.ibm.net [165.87.194.239])
	by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id GAA22399
	for <gas2@cygnus.com>; Mon, 5 Oct 1998 06:41:14 -0700 (PDT)
Received: from slip129-37-91-232.tx.us.ibm.net (slip129-37-91-232.tx.us.ibm.net [129.37.91.232]) by out4.ibm.net (8.8.5/8.6.9) with SMTP id NAA16922 for <gas2@cygnus.com>; Mon, 5 Oct 1998 13:41:10 GMT

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-10-03 20:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <32F7F8E9.2876@ozemail.com.au>
     [not found] ` <5db8v9$eib@gw0.dgii.com>
1998-10-03 20:47   ` GNU ld for SCO OpenServer 5 Jouke Numan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).