DGivney / assemblytutorials

This project was put together to teach myself NASM x86 assembly language on linux.
https://asmtutor.com/
654 stars 117 forks source link

Lesson 17 error #18

Closed Skeevert closed 4 years ago

Skeevert commented 5 years ago

Trying to compile lesson 17 "namespace" results in error: symbol 'finished' redefined

DGivney commented 5 years ago

Hi Skeevert

What platform/software versions are you using?

I'm not getting any errors on: Ubuntu 16.04 Nasm 2.11.08 GNU ld 2.26.1

DGivney commented 5 years ago

I can replicate the error if you remove the fullstop off one of the ".finished" labels on either line 23 or 34?

Skeevert commented 5 years ago

Hi. I'm using Debian 9.9 32-bit and NASM 2.12.01. I also tried copying functions.asm and namespace.asm into online compiler, which led to the same error. Yes, removing fullstop also leads to redefinition error for other finished labels

DGivney commented 5 years ago

Hi Skeevert,

I think you might be using a version of functions.asm which has a global "finished:" label in it.

This file got refactored, you can see the line difference between lesson 15 & lesson 17 (slen function); https://github.com/DGivney/assemblytutorials/blob/master/code/lesson15/functions.asm#L65 https://github.com/DGivney/assemblytutorials/blob/master/code/lesson17/functions.asm#L102

If you put this code from lesson 17 (cut & pasted functions.asm + namespace.asm): https://pastebin.com/xHAtRZ8e

Into this online nasm compiler: https://www.jdoodle.com/compile-assembler-nasm-online

You'll see the correct output.

Can you link to a paste of the code you're trying to execute please?

DGivney commented 5 years ago

If that's the case I think I might do one of 2 things;

  1. Add a note on Lesson17 warning people that labels in functions.asm gets updated to use local namespace.
  2. Use local namespace labels in functions.asm from the beginning.
Skeevert commented 5 years ago

Ah, I see. Thanks! I really had a global label "finished" in functions.asm

DGivney commented 5 years ago

Perfect, thanks for contacting me.

I'll update the tutorial later this weekend to make that more clear.