'assembly code unexpectedly printing .shstrtab.text.data

i am very new to assembly although i have lots of c and c++ experience. my assembly code is supposed to print hello world like all first programs in a new language. it prints out hello world but also prints out some extra text:

hello world!
.shstrtab.text.data

and here is my assembly program:

section .text
    global _start       ;for the linker
    
_start:
    mov edx, length     ; message length
    mov ecx, message    ; message to write
    mov ebx, 1      ; file descriptor stdout
    mov eax, 4      ; system call number
    int 0x80    ; call kernel
    
    mov eax, 1  ;system call number for sys_exit to exit program
    int 0x80    ; call kernel
    
section .data
message db "hello world!"
length DD 10

if you know how to fix this also explain why is this happening. thanks.

extra info: i am using nasm assembler with ld linker



Solution 1:[1]

so the problem is in adding length as it gives the address of length variable but not the value. the answer is to use move edx, [length]. thanks to Jester for pointing me that out

Solution 2:[2]

length equ $ - message | instead of length dd 10

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 python_is_good_cpp_is_best
Solution 2 cigien