Subject: Re: port windows CE code onto netbsd
To: David Brownlee <abs@NetBSD.org>
From: Kamal R. Prasad <kamalp@kprasad.org>
List: port-arm
Date: 11/15/2004 10:18:11
David Brownlee wrote:

> On Fri, 12 Nov 2004, Kamal R. Prasad wrote:
>
>>>     If the library really doesn't make any external calls then you
>>>     should just be able to objcopy to convert it to elf and link it
>>>     into a NetBSD binary (with a possibly a little glue to match up
>>>     function calling semantics).
>>>
>> You mean,
>> # objcopy -I windows_filename -O netbsd_filename
>>
>> will automatically make it a netbsd usable library?
>
>
>     Something more like 'objcopy -O elf32-arm infile outfile'
>     would give you an elf compatible library. I've not done this
>     personally but hopefully someone else can chime in.
>
I have actually done it (and was lazy to expect an answer before tryiug).
The binutils in my distribution had a problem with recognizing 
MS-Windows coff object files.
I had to upgrade to binutils-2.15 which contains the code to recognize 
wincoff files.

#binutils -I coff-i386 -O elf32-i386-freebsd <file>.obj <file>.o

will translate a given .obj file (extracted from a windows .lib file 
using ar command) to a .o file.
[I don't have the prototype on which to run netbsd-arm as yet, so tried 
this stuff on freebsd as a first step].

>>>     If it makes some external library calls such as malloc() then
>>>     you need to include another library which provides a 'windows'
>>>     wrapper to the native version of those functions (if the calling
>>
>>
>> The external functions called are the std libc functions. Its likely 
>> that the function prototypes don't change across platforms because of 
>> standardization.
>
>
>     Hopefully.
>
>>>     semantivcs are different) - the PEACE project is a good example of
>>>     a more complete version of this
>>>     http://chiharu.haun.org/peace/status.html
>>>
>> This seems to  be a work in progress.
>>
>>>     Is there no way you could get the vendor to provide the object
>>>     code in native NetBSD form?
>>>
>>>     Its relatively simple to setup a windows box to compile
>>>     NetBSD/arm32 binaries. Maybe if you offered to build a toolchain
>>>     (donwload NetBSD and './build.sh -m evbarm toolchain' :)
>>>     and asked them to compile the source using it?
>>>
>> Not a v. cooperative/competent vendor.
>
>
>     I'd start by compiling a trivial function that just doubles
>     the argument and returns the result under WinCE arm and to a .a,
>     objcopy and test the result works, then try the other lib.
>
Why would anyone want to massage the args?

regards
-kamal

>         David/absolute       -- www.NetBSD.org: No hype required --