I'm just starting out with Assembly languege, having installed NASM on openSUSE 13.1, i386 family processor yesterday. My worry is that a simple program like "Hello World!" has flagged a warning when linking...see line 3 below:

  1. coker.mu@linux-jm54:~/nasm> nasm -f elf helloWorld.asm
  2. coker.mu@linux-jm54:~/nasm> ld -m elf_i386 -s -o helloWorld helloWorld.o

  3. ld: warning: cannot find entry symbol _start; defaulting to 0000000008048080

  4. coker.mu@linux-jm54:~/nasm> ls -l

  5. total 12
  6. -rwxr-xr-x 1 coker.mu users 360 Dec 19 21:06 helloWorld
  7. -rw-r--r-- 1 coker.mu users 429 Dec 19 21:04 helloWorld.asm
  8. -rw-r--r-- 1 coker.mu users 624 Dec 19 21:05 helloWorld.o

Even though the program prints as expected when executed, I worry about how many errors I might get in future as I venture into deeper waters. How do I suppress such frivolous warnings? I mean the program has the "global main" line as well as the "main:" label!!



Re: NASM Linker warning..

Forget about my earlier question... A bit of research has just revealed that I should have used "global _start" instead of "global main". Similarly I replaced "main:" with "_start:" and the warning vanished. False alarm!! Otherwise I'm having fun with the assembler!

Good for you in finding the cause of the problem. Note that in line 3 of your post, it indicates that it would use a default entry point, which is why it ran.

How would you fix it if you wanted the entry point of your program to be NewbieChameleon? You would use the -e or --entry command line option for ld:


I use a makefile and used this for an example and 64bit O:
ld -o $(APP) $(APP).o -melf_i386 -eNewbieChameleon -dynamic-linker /lib/ld-linux.so.2

@rubberman && GunnerInc;
Thank you both for your responses. Right now things are going fine, but I know as the waters get murkier I'll be back for more help! The command line option for ld is a bonus....Don't think I could have come up with it using the man page for ld! Thanx.