https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110297

--- Comment #2 from Andreas Schwab <sch...@linux-m68k.org> ---
The go side of the mmap C function is using the wrong type for the offset
argument.

Dump of assembler code for function runtime.mmap:
   0xb692c340 <+0>:     push    {r4, r5, lr}
   0xb692c344 <+4>:     sub     sp, sp, #20
   0xb692c348 <+8>:     mov     r5, #0
   0xb692c34c <+12>:    mov     r12, r1
   0xb692c350 <+16>:    mov     r4, r0
   0xb692c354 <+20>:    mov     r1, r2
   0xb692c358 <+24>:    ldr     r0, [sp, #40]   ; 0x28
   0xb692c35c <+28>:    mov     r2, r3
   0xb692c360 <+32>:    ldr     r3, [sp, #36]   ; 0x24
   0xb692c364 <+36>:    str     r0, [sp, #8]
   0xb692c368 <+40>:    str     r3, [sp]
   0xb692c36c <+44>:    mov     r0, r12
   0xb692c370 <+48>:    ldr     r3, [sp, #32]
   0xb692c374 <+52>:    str     r5, [sp, #12]
   0xb692c378 <+56>:    bl      0xb6454e80 <mmap@plt>
=> 0xb692c37c <+60>:    cmn     r0, #1
   0xb692c380 <+64>:    movne   r3, r0
   0xb692c384 <+68>:    beq     0xb692c398 <runtime.mmap+88>
   0xb692c388 <+72>:    mov     r0, r4
   0xb692c38c <+76>:    stm     r4, {r3, r5}
   0xb692c390 <+80>:    add     sp, sp, #20
   0xb692c394 <+84>:    pop     {r4, r5, pc}
   0xb692c398 <+88>:    bl      0xb644b424 <runtime.errno@plt>
   0xb692c39c <+92>:    mov     r3, r5
   0xb692c3a0 <+96>:    mov     r5, r0
   0xb692c3a4 <+100>:   b       0xb692c388 <runtime.mmap+72>

sp+36 is fd and sp+40 is offset.  The latter is then passed as 64-bit value in
sp+8/sp+12, but mmap expects a 32-bit offset.  Apparently go is assuming the
mmap64 interface.

Reply via email to