From owner-freebsd-hackers Sat Oct 5 09:51:59 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA25688 for hackers-outgoing; Sat, 5 Oct 1996 09:51:59 -0700 (PDT) Received: from dg-rtp.dg.com (dg-rtp.rtp.dg.com [128.222.1.2]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id JAA25605 for ; Sat, 5 Oct 1996 09:50:41 -0700 (PDT) Received: by dg-rtp.dg.com (5.4R3.10/dg-rtp-v02) id AA20653; Sat, 5 Oct 1996 12:50:06 -0400 Received: from ponds by dg-rtp.dg.com.rtp.dg.com; Sat, 5 Oct 1996 12:50 EDT Received: from lakes.water.net (lakes [10.0.0.3]) by ponds.water.net (8.7.5/8.7.3) with ESMTP id IAA11242; Sat, 5 Oct 1996 08:50:59 -0400 (EDT) Received: (from rivers@localhost) by lakes.water.net (8.7.5/8.6.9) id IAA05158; Sat, 5 Oct 1996 08:50:50 -0400 (EDT) Date: Sat, 5 Oct 1996 08:50:50 -0400 (EDT) From: Thomas David Rivers Message-Id: <199610051250.IAA05158@lakes.water.net> To: Charles_Boatwright@cisnc.canon.com, ponds!FreeBSD.ORG!freebsd-hackers Subject: Re: x86 COFF with FreeBSD Content-Type: text Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > Hey, > > I hope that this isn't a "beaten to death question." > > I have a MSVC COFF library, from MSVC 4., > I need to link it under FreeBSD. > > The facts. > > The library is C, not C++ (no name mangling). > The library is portable (no OS specific calls, only standard C). > The library is 32 bit. > The library is HUGE > 4 Meg; > 30 000 functions. > NO SOURCE. > > The needs: > > Link library with gnu ld to produce an a.out. > > Knowledge of problem. > > Used cygnus tool chain on X86-cygwin32 to begin BFD - COFF research. > No success. > > Does anyone know how this can be done, or can it be done???? > > Any help, ideas, books in which to read things, places in which to bury > my head (a bucket of sand???) would be excellent. > > TIA This can be done - but it's not easy... I know it can be done because the group I manage at work is responsible for tools that make something close to this possible. Your first issue is to understand the COFF format produced by MSCV4 - you'll find that Microsoft is now documenting all of that stuff quite well (you can find it on MSN, for example.) Then, after writing your own linker that handles FreeBSD .o's and this library; you'll have the problem of call/return stacks... it's quite possible they are different. To handle that, you'll have to add keywords (or some other machinations) to the C that you compile on the FreeBSD side, and alter the C compiler. Then, after that, you'll have to consider sizes and alignments of data. With luck, they'll all be the same. Although I know MSC has extensions to allow arbitrary bitfield alignment, and some other items that may make this a problem.... - Good Luck! - - Dave Rivers -