Linker problem

Rudy Gingles rudyatek@dizzyelmer.com
Fri Nov 2 13:14:00 GMT 2001


Hi all, I'm compiling an OS kernel I'm working on, and I've started to get a
weird error while linking. Basically, I'm getting 'Undefined references' to
many of the functions in my code. I've narrowed it down to the undefined
references coming from all my assembler files (.S), but as I defined all the
functions as .global, I don't see why the error occurs. I'm compiling into
elf32-i386 format, and running the linker from the same directory as all of
the source/object files. I'm at a total loss as to why it can't find those
functions. And to add to it, the link works (for the most part) when
compiled under djgpp (DOS gcc port) rather than under Linux. Why the
difference? Maybe something isn't setup right, or a path not specified? And
help or hints or anything would be appreciated, I'm at a total loss here.
Thanks!!

Command line:

ld -T kernel.lds -o out.elf entry.o (...more files...) init.o -lc -lgcc

LD script used (kernel.lds):

/* ------------------------------------------ */
OUTPUT_FORMAT("elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)

SEARCH_DIR("/usr/lib")

SECTIONS
{
    . = 0x100000;
    .text :
    {
        _btext = .;
        *(.text)
        _etext = .;
    }
    .data ALIGN(0x1000) :
    {
        _bdata = .;
        *(.data)
        _edata = .;
    }
    .bss ALIGN(0x1000) :
    {
        _bbss = .;
        *(.bss)
        *(COMMON)
        _ebss = .;
    }
    .note.sig ALIGN(0x1000) :
    {
        _bsig = .;
        *(.note.sig)
        _esig = .;
    }
}
/* ------------------------------------------ */

--
Rudy Gingles



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.292 / Virus Database: 157 - Release Date: 10/26/2001



More information about the Gcc-help mailing list