You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/asm: 386 assembler silently drops indices when indexing symbols #41286
Create an assembly file with the following content, assemble it for 386:
DATA bar<>(SB)/4, $0x0
GLOBL bar<>(SB), 0, $4
TEXT foo<>(SB), 4, $0
MOVL bar<>(SB)(AX), AX
Then, dump the resulting object file.
What did you expect to see?
Something like
TEXT foo<1>(SB) gofile../.../bug.s
bug.s:5 0x142 8b0500000000 MOVL 0(AX), AX [2:6]R_ADDR:bar
What did you see instead?
TEXT foo<1>(SB) gofile../.../bug.s
bug.s:5 0x142 8b0500000000 MOVL 0, AX [2:6]R_ADDR:bar
It appears that the index register has been dropped silently. Please either fail this kind of code during assembly or add support for indexing into global symbols.
Activity
cherrymui commentedon Sep 9, 2020
Index into a global symbol is not a supported addressing mode. We should emit an error.
gopherbot commentedon Oct 19, 2026
Change https://go.dev/cl/850566 mentions this issue:
cmd/internal/obj/x86: reject base register on global symbol referencescmd/internal/obj/x86: reject base register on global symbol references