delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/26/03:23:39

Date: Sun, 25 Jan 1998 22:22:37 -0800 (PST)
Message-Id: <199801260622.WAA01664@adit.ap.net>
Mime-Version: 1.0
To: elange AT thegrid DOT net, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Flexible Linking for GCC?

At 11:35  1/24/1998 -0800, Eric Lange wrote:
>I need to do some 32-bit programming under DOS, but not with DPMI
>compliance.  So far, I have been doing all of my development using MASM
>6.11, because only an assembler gives me the flexibility I need.
>However, my development time is too long, and I need to develop an SDK
>for other users (my application is an OS-extender).
>
>I want to be able to develop in C/C++ for obvious reasons.  But, all I
>need the compiler to do is generate 32-bit code under some set of
>assumptions.  I also want the linker to allow me to replace all of the
>startup code, so I can load it any way I choose.  Basically, I just need
>to know the compiler assumptions.
>
>For example:
>
>* All code in a single code segment (just need to know the size)
>* All heap, global and static in a single DS
>* All stack in a single SS (DS == SS is okay)
All these are true.
>
>I believe that just about any compiler (including GCC for DJGPP) can do
>this.  It's the linker that needs to provide me with flexibility.  I do
>not need any of the OS-service libraries (I won't use StdIO.H, Malloc.H,
>or Stream.H), and I won't need any DPMI services.  I just need 32-bit
>compiled code linked with my own assembly objects.  Does the DJGPP
>linker allow me to have some sort of linker definition file?  Does it
>provide the flexibility I need?  Is there another linker out there that
>does?  For Watcom, Microslop, or Borland?  Any experience with this?

You probably can do this. If you invoke the linker directly (see the info
page for `ld'), you can omit the startup code, etc, etc. The tricky part is
getting all your code in the same format. GAS, the backend to GCC, produces
COFF object files. I believe MASM can produce COFF as well, so that may
work. Otherwise, you can convert your asm to AT&T syntax and submit it to
GAS. It may be possible to mess with the assembler and linker to get them to
use some other format, but I suspect that would be non-trivial.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019