pand mm1, [somelabel]
Hi all,I'm having trouble getting my application to run when I assemble my own x86-32 asm.The code in question is in a shared library, and code that will cause the crash can look like this:
pand mm1, [somelabel]
I was previously able to modify such code by using RIP addressing, but as far as I know that's a 64-bit thing only.
My nexe validates always and doesn't crash on startup when I remove this line.
static int bar;int read_bar() {return bar;}int write_bar(int bar_) {return bar = bar_;}
$ toolchain/linux_x86_glibc/bin/x86_64-nacl-gcc -fPIC -masm=intel -O3 -S -o- test.c.file "test.c".intel_syntax noprefix.text.align 32.globl read_bar.type read_bar, @functionread_bar:.LFB0:.cfi_startprocpop r11mov eax, DWORD PTR bar[rip]nacljmp r11d,%r15.cfi_endproc.LFE0:.size read_bar, .-read_bar.align 32.globl write_bar.type write_bar, @functionwrite_bar:.LFB1:.cfi_startprocpop r11mov eax, edimov DWORD PTR bar[rip], edinacljmp r11d,%r15.cfi_endproc.LFE1:.size write_bar, .-write_bar.local bar.comm bar,4,4.ident "GCC: (GNU) 4.4.3 20141209 (Native Client r14192, Git Commit 7faaabb9f10e6dcae5f2b799da43e236e65cda95)".section .note.GNU-stack,"",@progbits
$ toolchain/linux_x86_glibc/bin/i686-nacl-gcc -fPIC -fomit-frame-pointer -masm=intel -O3 -S -o- test.c.file "test.c".intel_syntax noprefix.text.align 32.globl read_bar.type read_bar, @functionread_bar:add ecx, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_mov eax, DWORD PTR bar@GOTOFF[ecx]pop ecxnacljmp ecx.size read_bar, .-read_bar.align 32.globl write_bar.type write_bar, @functionwrite_bar:add ecx, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_mov eax, DWORD PTR 4[esp]mov DWORD PTR bar@GOTOFF[ecx], eaxpop ecxnacljmp ecx.size write_bar, .-write_bar.local bar.comm bar,4,4.ident "GCC: (GNU) 4.4.3 20141209 (Native Client r14192, Git Commit 7faaabb9f10e6dcae5f2b799da43e236e65cda95)".p2align 5.globl __i686.get_pc_thunk.cxpop ecxnacljmp ecx.section .note.GNU-stack,"",@progbits
pand mm1, [somelabel]
_GLOBAL_OFFSET_TABLE_
pand mm1, bar@GOTOFF[ecx]
pand mm1, [bar + rax + 32]
_GLOBAL_OFFSET_TABLE_
lea ecx, [ecx+rax+32]
pand mm1, bar@GOTOFF[ecx]