Page 1 of 1

link.ld Example Explanation

Posted: Sun Jan 17, 2010 4:48 pm
by Nathan
Hello,
I've compiled successfully the FreeBASIC Barebones Example, there we have a example to use with ld called link.ld:

Code: Select all

OUTPUT_FORMAT("elf32-i386")
ENTRY (loader)

SECTIONS{
    . = 0x00100000;

    .text :{
        KERNEL_START = .;

        *(.text)
    }

    .rodata ALIGN (0x1000) : {
        *(.rodata)
        _CTORS = .;
        *(.ctors)
        _CTORS_END = .;       
    }

    .data ALIGN (0x1000) : {
        *(.data)
    }

    .bss : {
        SBSS = .;
        *(COMMON)
        *(.bss)
        EBSS = .;

        KERNEL_END = .;
    }
}
But as I've only used ld one time that my friend sent me a source to be compiled and I need to use ld, but someone could please explain me line-by-line about this script?

Best Regards,
Nathan Paulino Campos

Re: link.ld Example Explanation

Posted: Sun Jan 17, 2010 5:19 pm
by Combuster

Re: link.ld Example Explanation

Posted: Sun Jan 17, 2010 5:36 pm
by Nathan
I will use google before asking stupid questions! :D

Re: link.ld Example Explanation

Posted: Mon Jan 18, 2010 2:02 am
by qw
Here's the place to be: http://sourceware.org/binutils/docs/ld/index.html.

Nice avatar.