Assigning values to asm variables with asm linker as

I have this code that prints hello but I was looking online and I can’t for the life of me figure out how to change the H in the hello string to the character %. I tried mov [data+11], '%' but it doesn’t work. Anyone here know how to change the values of variables I define. For example the buf variable maybe? Some of the things I get to compile just segment fault the program.

.global _start
.intel_syntax noprefix

.section .text

// sys write
mov rax, 1
mov rdi, 1
lea rsi, [data+11]
mov rdx, 7

// sys exit
mov rdi, 0
mov rax, 60

    .byte   0xFF
    .hword  0xFFFF
    .quad   0xFFFFFFFF
    .asciz "Hello!\n"
    .float 3.14
    .double 3.14

buf: .space 1024

Educated guess is that your program is read-only in memory.

1 Like

that was the problem, once i put it under the .section .data it allowed me to write to the memory.