[BUG]: nasm addressing issue with 64 bit mode
Describe the bug
When writing 64 bit nasm, storing an address with the .rodata or .data sections, causes a "warning: 64-bit unsigned relocation zero-extended from 32 bits [-w+zext-reloc]".
Steps to reproduce
- Goto godbolt.org
- Switch language to Assembly
- Open nasm compiler(any should work)
- Type:" BITS 64 _start: ret section .data label: dq _start " into the file
- Assemble
Expected behavior
The aforementioned error shouldn't be there(I think its because the compile option is set to elf, not elf64).
Reproduction link
https://godbolt.org/z/xWjW35fEE
Screenshots
Not applicable/needed
Operating System
Not applicable/needed
Browser version
Not applicable/needed
I think the best fix is to either switch the default from elf to elf64, or to give the user knowledge that they can change from elf to elf64 manually like in "https://godbolt.org/z/3M1GoecsT" because I had to look at the nasm.ts file to find this.
32 bits is just the default for the nasm assembler itself, we don't explicitly set it. And there's not much we can do about it
We could switch the default(to prevent the issue entirely because 64 bit elf can work in 32 and 16 bit modes) to 64 bits by switching "options = ['-g', '-f', 'elf', '-F', 'stabs'].concat(options);" in nasm.ts(line 68) to "options = ['-g', '-f', 'elf64', '-F', 'stabs'].concat(options);"
This is now live