To get the length of a string, I am using the following function:
string:     .asciz "hello world!\n"
get_string_length:
    mov $0, %eax    # size goes in rax
  .L1_loop:
    movzbw string(,%eax,1), %ebx
    cmp $0, %ebx
    je .L1_exit
    inc %eax
    jmp .L1_loop
  .L1_exit:
    ret
However, I have also seen the following:
hello_world:
    .ascii "hello world\n"
    hello_world_len = . - hello_world
How does the following work? That is the . notation and all to get the length? For example, in this github snippet here: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/9dccafe00d9b0affa8847836a71ebb4c37be7090/userland/arch/x86_64/freestanding/linux/hello.S