Menu

#123 option win64:0 with -elf64

open
nobody
None
1
2011-03-04
2011-02-17
drizz
No

It seems parameters are saved to shadow space regardless of the "option win64:0" setting.

Discussion

  • japheth

    japheth - 2011-02-17

    In my test cases it works as expected - with "option win64:0", nothing is saved.

     
  • drizz

    drizz - 2011-02-18

    quick test compile on windows .
    jwasm -c -elf64 -Fo"testasm.o" testasm.asm
    objconv -fasm testasm.o testasm_dis.asm

    TESTASM.ASM:
    ---------------------------
    .x64p
    option frame:auto
    option win64:0;disable autosaving of register params to shadow space
    option language:c;decl
    option casemap:none
    option procalign:16

    .code
    ConsoleWrite proc c FRAME uses rsi rdi lpBuffer
    ;LOCAL nbrw, dwLen:DWORD
    ret
    ConsoleWrite endp
    end

    // --------------------------------------------------------------------

    DISASSEMBLY from OBJCONV:
    ---------------------------------------------------
    ; Disassembly of file: testasm.o
    ; Fri Feb 18 15:05:21 2011
    ; Mode: 64 bits
    ; Syntax: MASM/ML64
    ; Instruction set: 8086, x64
    option dotname

    public _ConsoleWrite

    _text SEGMENT PARA 'CODE' ; section number 1

    _ConsoleWrite PROC
    mov qword ptr [rsp+8H], rcx ; 0000 _ 48: 89. 4C 24, 08
    push rbp ; 0005 _ 55
    mov rbp, rsp ; 0006 _ 48: 8B. EC
    push rsi ; 0009 _ 56
    push rdi ; 000A _ 57
    add rsp, 0 ; 000B _ 48: 83. C4, 00
    pop rdi ; 000F _ 5F
    pop rsi ; 0010 _ 5E
    pop rbp ; 0011 _ 5D
    ret ; 0012 _ C3
    _ConsoleWrite ENDP

    _text ENDS

    _data SEGMENT PARA 'DATA' ; section number 2

    _data ENDS

    .xdata SEGMENT ALIGN(8) 'CONST' ; section number 3

    _$xdatasym label byte
    db 01H, 0BH, 04H, 05H, 0BH, 70H, 0AH, 60H ; 0000 _ .....p.`
    db 09H, 53H, 06H, 50H ; 0008 _ .S.P

    .xdata ENDS

    .pdata SEGMENT DWORD 'CONST' ; section number 4

    ; Error: Overlapping relocations
    dq _ConsoleWrite ; 0000 _ 0000001300000000 (d)
    dq _$xdatasym ; 0008

    .pdata ENDS

    END

    NOTE:
    this line:
    mov qword ptr [rsp+8H], rcx ; 0000 _ 48: 89. 4C 24, 08
    this line (simple "if" check for 0 i think):
    add rsp, 0 ; 000B _ 48: 83. C4, 00

     
  • japheth

    japheth - 2011-02-18

    Ok, I somehow managed to ignore the mentioned -elf64 cmdline switch in the error caption.

    The real problem is that keyword FRAME is NOT rejected if format is -elf64.

     
  • drizz

    drizz - 2011-02-18

    I use FRAME keyword because it provides 16 byte stack alignment.

     
  • japheth

    japheth - 2011-02-18

    > I use FRAME keyword because it provides 16 byte stack alignment.

    Ups, based on your error report, I released a "fixed" v2.05rc22 which disabled FRAME ( and also the win64-SEH- directives ) if option -elf64 is given.

     
  • japheth

    japheth - 2011-03-04
    • priority: 5 --> 1
     

Log in to post a comment.