School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,175 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,545 people online right now. Registration is fast and FREE... Join Now!




Nasm file size

 

Nasm file size

sunion

6 Nov, 2009 - 07:53 AM
Post #1

D.I.C Head
**

Joined: 24 Aug, 2008
Posts: 68



Thanked: 2 times
My Contributions
Hi, I have a bootloader written in assembly and it works.
The bootloader jumps to the kernel, and the kernel calls the kmain function written in c.
Now here is the problem:
If i want to call kmain from my kernel.asm file, I have to use the
CODE
extern kmain
.
But for some reason nasm can't use extern functions in binary format, so i need to use
"nasm -f elf kernel.asm" if I use it this way I can link it with the c function without problems, but then my filesize is to big.
if I just use nasm kernel.asm my file size is like 88bytes and if i use the -f elf its like 3kb.
So this is my problem, my bootloader only loads the second 512 bytes from the floppy, so if my file size is 3kb, my bootloader won't load the whole program.

I also tried after linking the c function and the kernel this:
"objcopy kernel.o final -R .note -R .comment -S -O binary" wich get my filesize back to normal, but then my c function does not work.

I hope someone can help me? if you need more info just ask smile.gif

thanks---

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 07:22PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month