Cross gcc-ld anything/i386-coff

Michael Bloom mb at ttidca.TTI.COM
Wed Aug 15 22:38:59 AEST 1990


In article <1990Aug12.205924.7097 at kth.se> Per Andersson writes:
>
>Have anybody started hacking ld to link COFF objects ? Or at least link
>386 object files on for example a sparc. Getting gcc and gas to run was
>a piece of cake. This seems to be quite difficult. To bad we don't have
>a system V/386 source distribution.

Well, I started a while back, and gave up. "hacking" gnu ld to support
multiple object formats is not the way to go. Even if you were to get
it working, you'd end up with a horiffically unsupportable mess.

What is really needed is to overhaul it (essentially a rewrite) to be
more general.  This is something I'm planning to do when I have some
more time. When it's done,  I'll include it in a new release of the
COFF (with stabs) patch set for gas and gdb.


Incidentally, look for the following in the next release of the COFF
patch set:

1: collection (within "gas/coff-conv.c") of the N_SETT symbols generated
 by g++ to produce ".ctor" and ".dtor" sections that are properly
 merged into the ".data" section by the native loader (using a provided
 loader directive file to direct the merge and generate the element
 count). 

 This is not a general substitute for being able to create and switch
 to arbitrary multiple sections in assembly code, but it does eliminate
 the need to use collect and link twice when using the native COFF
 loader.

2: A new program, "humantussin", that reads an a.out file into a buffer
 and passes it to a version of "convert_to-coff()" (compiled with 
 "-DSTANDALONE_CONV") in exactly the same manner that the a.out image 
 built in gas/write.c would be passed to "convert_to_coff()" when
 assembling to COFF in gas. 

 This will allow people who were previously using coff-encapsulation 
 to convert their a.out libraries to COFF libraries.  Humantussin is 
 essentially the inverse  operation of robotussin, with the exception that 
 *all debug information is retained* in it's output.

 If you take an arbitrary file foo.s, assemble it to COFF,  then use the
 same gas binary to generate an a.out and convert that a.out to a second 
 COFF file with humantussin, the only bytes that will differ between the 
 COFF file produced by gas and the COFF file produced by humantussin
 will be the COFF timestamp.



More information about the Comp.unix.i386 mailing list