What file formats does this version of 'ld' support? ld --help (look for "supported targets" and "supported emulations" at the end of the displayed messages. Examples: (DJGPP) ld.exe: supported targets: coff-go32 coff-go32-exe a.out-i386 srec symbolsrec tekhex binary ihex (MinGW32) LD.EXE: supported targets: pe-i386 pei-i386 srec symbolsrec tekhex binary ihex (ELF binutils for DJGPP) ld-elf.exe: supported targets: elf32-i386 coff-i386 srec symbolsrec tekhex binary ihex I want DJGPP to make a COFF file, not an .EXE: ld --oformat coff-go32 ... Where do the data and code go? Where the default linker script (/djgpp/lib/djgpp.djl) puts them. I want to use my own linker script, in file krnl.ld: ld -T krnl.ld ... I want to make a binary file, and I want the code to start at 100h, like a .COM file ld --oformat binary -Ttext=0x100 -o krnl.com ... (Note: this will not output zeroes for the BSS section.) Can I partially link a bunch of .o files into another .o file? ld -r -o krnl.o ... (Note: no warning messages about missing external symbols.) Can I make an executable file in relocatable format, kinda like a DOS .EXE? ld -r --no-undefined ... or possibly ld --emit-relocs ... GCC for Linux makes a dynamically-linked executable by default; how do I make a statically-linked executable? ld -Bstatic ... Can I strip out the debug information as I link? ld -s ... How do I make a DLL (shared library) with GCC for Linux? ld -shared ... (C code going into a DLL must be compiled with -fPIC) How do I make a (COFF) DLL with DJGPP? Apart from DXE (see the DJGPP FAQ) which is rather limited, there is no standard way to do this. Perhaps you could substitute relocatable (.o) files for DLLs. How do I make an ELF DLL with DJGPP using the ELF binutils? You can't. ld-elf understands the '-shared' option but, except for trivial code, fails with an error message such as foo.c:59: undefined reference to `__GLOBAL_OFFSET_TABLE_' Update: compiling to asm, then using sed to fix the extra leading underscore lets you compile and link: gcc -s -S -O2 -Wall -W -fPIC -o x my_dll.c sed -e s/__GLOBAL_OFFSET_TABLE_/_GLOBAL_OFFSET_TABLE_/g y as-elf -o my_dll.o y deltree /y x y ld-elf -shared -o my_dll.so my_dll.o This produces an ELF DLL, but there are subtle bugs in the ELF binutils for DJGPP, so the DLL may not work. I want DJGPP to put my code at 0x40000000 (1 gig) and align the code, data, and BSS sections on page (4K) boundaries. Write your own linker script. Maybe something like this: OUTPUT_FORMAT("coff-go32") ENTRY(start) SECTIONS { .text 0x40000000 : /* 1 gig */ { *(.text) . = ALIGN(4096); etext = .; _etext = .; } .data : { *(.data) . = ALIGN(4096); edata = .; _edata = .; } .bss : { *(.bss) *(COMMON) } end = .; _ebss = .; } ================================================================ COMPILER OPTIONS ================================================================ Can I make position-independent code (PIC)? Do this with the compiler (GCC), not the linker: gcc -fPIC ... GCC for BeOS makes position-independent code by default; how do I make a non-PIC executable? ld -fno-PIC ... Can I pass arguments to functions in registers, instead of on the stack? Do this with the compiler (GCC), not the linker: gcc -mregparm=NNN ... Code generated with GCC pushes and pops EBP, even for functions with no arguments. Can I prevent this? gcc -fomit-frame-pointer ...