1

I have a small "hello world" program in asm. After compiling and linking, I can see all the names I used for my variables and labels in the final elf file (opened with text editor). Why ? Shouldn't variables and so on be replaced by static or relative addresses ? How can I hide this info ?

I am using nasm on ubuntu x86 64 : nasm -f elf64 hello.asm && ld -o a hello.o

Thomas
  • 6,610
  • 7
  • 40
  • 79

2 Answers2

1

It is debug information. You can remove it from the object file using the command strip.

johnfound
  • 6,751
  • 2
  • 25
  • 53
1

Stripping can also be accomplished in link time by calling --strip-all flag, in your case: nasm -f elf64 hello.asm && ld -o a hello.o --strip-all.

This will remove ALL of the symbols from the output file, if you wish to remove only the debug ones you can use --strip-debug.

You can read about more options here: http://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html

ordahan
  • 167
  • 8