From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Lipe To: gas2@cygnus.com Subject: gas patches for SCO OpenServer 5 Date: Fri, 17 Nov 1995 16:29:00 -0000 Message-id: <9511171820.aa20393@rjlhome.arnet.com> X-SW-Source: 1995/msg00191.html Of all my patches required to host and target SCO OpenServer 5, I consider this one to be the most, er, questionable in its approach. If, after looking at that, you suggest better ways to implement this, I'm receptive. This does allow ELF and COFF generation with no problems. Thanx, RJL [ Yes, this is a bit of a form letter. Sorry. I have a lot of patches to send. ] I've done a round of changes to support hosting and targeting the GNU development tools on SCO OpenServer Release 5. The patches have had the test suites run on them, and I'm happy with the results. Lots of SCO users are interested in this stuff, as it's now possible [ for the first time ever ] to have a complete non-SCO development chain now. The patches have received a lot of testing and airtime, but I'll still welcome feedback on them. If you, the package maintainer, suggests implementing something in a different manner, I'm receptive to that. I understand I'll have to work with each package maintainer to get the copyrights transferred where appropriate, so please be gentle with me. My employer has agreed to sign any necessary releases, but advice on how to do that exercise once instead of nine times is welcome. For more information about a complete GNU development distribution for SCO OpenServer 5, see my home page at http://www.dgii.com/people/robertl/scods/sco_ds.html Thanx for your help. --- Robert Lipe Sr. Software Engr. Digi Internatinoal robertl@dgii.com *** ./gas/config/tc-i386.c.orig Sun Aug 6 15:10:35 1995 --- ./gas/config/tc-i386.c Wed Nov 8 22:07:18 1995 *************** *** 2970,2973 **** --- 2970,3073 ---- #endif /* BFD_ASSEMBLER? */ + #if SCO_ELF + /* + Heavily plagarized from obj_elf_version. The idea is to + emit the SCO specific identifier in the .notes section to + satisfy the SCO linker. + + This looks more complicated than it really is. As opposed + to the "obvious" solution, this should handle the cross dev + cases correctly. (i.e, hosting on a 64 bit big endian + processor, but generating SCO Elf code) Efficiency isn't + a concern, as there should be exactly one of these sections + per object module. + + SCO OpenServer 5 identifies it's ELF modules with a standard + ELF .note section. + + int_32 namesz = 4 ; Name size + int_32 descsz = 12 ; Descriptive information + int_32 type = 1 ; + char name[4] = "SCO" ; Originator name ALWAYS SCO + NULL + int_32 version = (major ver # << 16) | version of tools ; + int_32 source = (tool_id << 16 ) | 1 ; + int_32 info = 0 ; These are set by the SCO tools, but we + don't know enough about hte source + environment to set them. SCO ld currently + ignores them, and recommends we set them + to zero. + + */ + + #define SCO_MAJOR_VERSION 0x1 + #define SCO_MINOR_VERSION 0x1 + + + sco_id() + { + char *name; + unsigned int c; + char ch; + char *p; + asection *seg = now_seg; + subsegT subseg = now_subseg; + Elf_Internal_Note i_note; + Elf_External_Note e_note; + asection *note_secp = (asection *) NULL; + int i, len; + + /* create the .note section */ + + note_secp = subseg_new (".note", 0); + bfd_set_section_flags (stdoutput, + note_secp, + SEC_HAS_CONTENTS | SEC_READONLY); + + /* process the version string */ + + i_note.namesz = 4 ; + i_note.descsz = 12 ; /* 12 descriptive bytes */ + i_note.type = NT_VERSION; /* Contains a version string */ + + p = frag_more (sizeof (i_note.namesz)); + md_number_to_chars (p, (valueT) i_note.namesz, 4); + + p = frag_more (sizeof (i_note.descsz)); + md_number_to_chars (p, (valueT) i_note.descsz, 4); + + p = frag_more (sizeof (i_note.type)); + md_number_to_chars (p, (valueT) i_note.type, 4); + + p = frag_more (4); + strcpy(p, "SCO"); + + /* Note: this is the version number of the ELF we're representing */ + p = frag_more (4); + md_number_to_chars (p, (SCO_MAJOR_VERSION << 16) | (SCO_MINOR_VERSION), 4); + + /* Here, we pick a magic number for ourselves (yes, I "registered" it + with SCO. + The bottom bit shows that we are compat with the SCO ABI. + */ + p = frag_more (4); + md_number_to_chars (p, 0x4c520000 | 0x0001, 4); + + /* + If we knew (or cared) what the source language options were, + we'd fill them in here. SCO has given us permission to ignore + these and just set them to zero. + */ + p = frag_more (4); + md_number_to_chars (p, 0x0000, 4); + + frag_align (2, 0); + + /* We probably can't restore the current segment, for there + likely isn't one yet... */ + if (seg && subseg ) + subseg_set (seg, subseg); + } + #endif /* SCO_ELF */ + /* end of tc-i386.c */ *** ./gas/config/sco5.mt.orig Wed Nov 8 22:07:18 1995 --- ./gas/config/sco5.mt Wed Nov 8 22:07:18 1995 *************** *** 0 **** --- 1 ---- + TDEFINES=-Dtc_init_after_args=sco_id -DSCO_ELF *** ./gas/configure.orig Mon Sep 18 14:31:38 1995 --- ./gas/configure Mon Nov 13 22:36:52 1995 *************** *** 693,698 **** --- 693,699 ---- em=lynx ;; i386-*-sysv4* | i386-*-solaris* | i386-*-elf) fmt=elf ;; + i386-*-sco*elf) fmt=elf targ=sco5 ;; i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*) fmt=coff targ=i386coff ;; i386-*-vsta) fmt=aout ;; *************** *** 894,900 **** if test ! -r ${target_frag}; then target_frag=/dev/null # ick! but subst_file can't be conditionalized fi - case ${user_bfd_gas}-${primary_bfd_gas} in yes-yes | no-no) --- 895,900 ---- *** ./gas/configure.in.orig Mon Sep 18 14:31:42 1995 --- ./gas/configure.in Wed Nov 8 22:16:52 1995 *************** *** 168,173 **** --- 168,175 ---- fmt=elf ;; i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*) fmt=coff targ=i386coff ;; + i386-*-sco*elf) + fmt=elf ;; i386-*-vsta) fmt=aout ;; i386-*-go32) fmt=coff targ=i386coff ;; i386-*-gnu*) fmt=elf ;;