NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: Anonymous on August 11, 2014, 01:10:32 AM

Title: Linking a 64 bit kernel
Post by: Anonymous on August 11, 2014, 01:10:32 AM
Hi All I have been trying to link my assembly code to a C++ file so I can fall my function kMain from assembly and When I link it with this script :
Code: [Select]
ENTRY(_Start)
SECTIONS
{
    . = 0x2000;

    .text : AT(ADDR(.text) - 0x2000)
    {
        _code = .;
        *(.text)
        *(.rodata*)
        . = ALIGN(4096);
    }

   .data : AT(ADDR(.data) - 0x2000)
   {
        _data = .;
        *(.data)
        . = ALIGN(4096);
   }

   .eh_frame : AT(ADDR(.eh_frame) - 0x2000)
   {
       _ehframe = .;
       *(.eh_frame)
        . = ALIGN(4096);
   }

   .bss : AT(ADDR(.bss) - 0x2000)
   {
       _bss = .;
       *(.bss)

       /*
        * You usually need to include generated COMMON symbols
        * under kernel BSS section or use gcc's -fno-common
        */

        *(COMMON)
       . = ALIGN(4096);
   }

   _end = .;

   /DISCARD/ :
   {
        *(.comment)
   }
}

I get a warning saying : x86_64-elf-ld: warning: cannot find entry symbol _Start; defaulting to 0000000000002000
But in my Assembly Code I have this at the start:
Code: [Select]
[BITS 16]
_Start:
Any Ideas as to why its not linking Correctly??
Edit:
I changed it to global _Start:
_Start and it worked my mistake
Title: Re: Linking a 64 bit kernel
Post by: Frank Kotler on August 13, 2014, 05:16:28 AM
I hear through the grapevine that the code is here:

https://github.com/AnonymousUser1337/Anmu

Right? Good plan!

Best,
Frank

Title: Re: Linking a 64 bit kernel
Post by: Anonymous on August 15, 2014, 08:14:35 PM
Ya it is Thanks :D