trying to replace MSlink with JWlink
if i include libcmt.lib i get the following output
works fine with MSlink
any solution
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-merge' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(..\build\amd64\mt_obj\initsect.obj): unknown directive '-merge' ignored
Error! E2028: ImageBase is an undefined reference
creating a 64-bit PE executable
file libcmt.lib(build\amd64\mt_obj\cpp_obj\mbctype.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\pesect.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\winsig.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\crt0.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\cpp_obj\strftime.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\getqloc.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\tzset.obj): undefined symbol ImageBase
make.bat
jwasm32 -win64 /c /Sa /Zi /FlWin64Exe.lst /FoWin64Exe.obj make.asm
link /SUBSYSTEM:console /BASE:0x0400000 /ENTRY:main /FIXED /DEBUG /OUT:Win64ExeLink.exe Win64Exe.obj kernel32.lib libcmt.lib oldnames.lib
jwlink RUNTIME windows FORMAT windows pe OPTION OFFSET=0x0400000 OPTION START="main" OPTION norelocs DEBUG codeview all OPTION cvpack NAME Win64ExeJWlink.exe FILE Win64Exe.obj LIBRARY kernel32.lib,libcmt.lib,oldnames.lib
make.asm
OPTION CASEMAP:NONE
OPTION PROCALIGN:16
X64Prologue MACRO procname,flag,bytecount,numlocals,regs,macroargs
push rbp
.pushreg rbp
mov rbp,rsp
.setframe rbp,000h
.endprolog
if numlocals NE 0
sub rsp,numlocals
endif
EXITM %numlocals
ENDM
OPTION PROLOGUE:X64Prologue
OPTION EPILOGUE:NONE
PUBLIC main
INCLUDE Main.asm
END
Main.asm
.CODE
main PROC FRAME
calloc PROTO;:QWORD,:QWORD
PUSH RSP
PUSH QWORD PTR [RSP]
AND SPL,0F0h
MOV RDX,1
MOV RCX,16
SUB RSP,32
CALL calloc
LEA RSP,[RSP+40]
POP RSP
lea rsp,[rbp+0]
pop rbp
ret 0
main ENDP
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looks like __ImageBase is a linker-defined symbol that is to give the base address of the module. It's not implemented in jwlink currently.
A possible workaround is to define the missing symbol in the source:
OPTION PROLOGUE:X64Prologue
OPTION EPILOGUE:NONE
.code
__ImageBase equ $ - 1000h ;<--- assumes that header has size 1000h
public __ImageBase
PUBLIC main
INCLUDE Main.asm
Last edit: japheth 2013-04-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
trying to replace MSlink with JWlink
if i include libcmt.lib i get the following output
works fine with MSlink
any solution
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-merge' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown directive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(..\build\amd64\mt_obj\initsect.obj): unknown directive '-merge' ignored
Error! E2028: ImageBase is an undefined reference
creating a 64-bit PE executable
file libcmt.lib(build\amd64\mt_obj\cpp_obj\mbctype.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\pesect.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\winsig.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\crt0.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\cpp_obj\strftime.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\getqloc.obj): undefined symbol ImageBase
file libcmt.lib(build\amd64\mt_obj\tzset.obj): undefined symbol ImageBase
make.bat
jwasm32 -win64 /c /Sa /Zi /FlWin64Exe.lst /FoWin64Exe.obj make.asm
link /SUBSYSTEM:console /BASE:0x0400000 /ENTRY:main /FIXED /DEBUG /OUT:Win64ExeLink.exe Win64Exe.obj kernel32.lib libcmt.lib oldnames.lib
jwlink RUNTIME windows FORMAT windows pe OPTION OFFSET=0x0400000 OPTION START="main" OPTION norelocs DEBUG codeview all OPTION cvpack NAME Win64ExeJWlink.exe FILE Win64Exe.obj LIBRARY kernel32.lib,libcmt.lib,oldnames.lib
make.asm
OPTION CASEMAP:NONE
OPTION PROCALIGN:16
X64Prologue MACRO procname,flag,bytecount,numlocals,regs,macroargs
push rbp
.pushreg rbp
mov rbp,rsp
.setframe rbp,000h
.endprolog
if numlocals NE 0
sub rsp,numlocals
endif
EXITM %numlocals
ENDM
OPTION PROLOGUE:X64Prologue
OPTION EPILOGUE:NONE
PUBLIC main
INCLUDE Main.asm
END
Main.asm
.CODE
main PROC FRAME
calloc PROTO;:QWORD,:QWORD
PUSH RSP
PUSH QWORD PTR [RSP]
AND SPL,0F0h
MOV RDX,1
MOV RCX,16
SUB RSP,32
CALL calloc
LEA RSP,[RSP+40]
POP RSP
lea rsp,[rbp+0]
pop rbp
ret 0
main ENDP
Looks like __ImageBase is a linker-defined symbol that is to give the base address of the module. It's not implemented in jwlink currently.
A possible workaround is to define the missing symbol in the source:
Last edit: japheth 2013-04-19
thanks for the quick response
i think your solution is correct
however if i simply make this change i get
jwlink RUNTIME windows FORMAT windows pe OPTION OFFSET=0x0400000 OPTION ST
ART="main" OPTION norelocs DEBUG codeview all OPTION cvpack NAME Win64ExeJWlink.
exe FILE Win64Exe.obj LIBRARY kernel32.lib,libcmt.lib,oldnames.lib
JWlink Version 1.9beta 10
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
loading object files
searching libraries
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown direct
ive '-merge' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown direct
ive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown direct
ive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown direct
ive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown direct
ive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(build\amd64\mt_obj\crt0init.obj): unknown direct
ive '-disallowlib' ignored
Warning! W1173: file libcmt.lib(..\build\amd64\mt_obj\initsect.obj): unknown dir
ective '-merge' ignored
creating a 64-bit PE executable
The instruction at 0x00415397 referenced memory at 0x01dc6df8.
The memory could not be written.
Exception fielded by 0x0043bdb0
EAX=0x00000006 EBX=0x000000c8 ECX=0x00000001 EDX=0x00401006
ESI=0x0044caac EDI=0x01dc6df8 EBP=0x002408f8 ESP=0x0018fb8c
EIP=0x00415397 EFL=0x00010213 CS =0x00000023 SS =0x0000002b
DS =0x0000002b ES =0x0000002b FS =0x00000053 GS =0x0000002b
Stack dump (SS:ESP)
0x01dc6df8 0x00411c4a 0x00416200 0x0044caac 0x00000006 0x00015200
0x0023e6ec 0x00000108 0x00000000 0x000000c8 0x00000000 0x00233e08
0x000000c8 0x00416bae 0x00004550 0x00058664 0x51717736 0x00000000
0x00000000 0x012f00f0 0x1202020b 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00400000 0x00000000 0x00001000 0x00000200
0x00000004 0x00000000 0x00010005 0x00000000 0x00000000 0x00000000
0x00000000 0x00000002 0x00100000 0x00000000 0x00001000 0x00000000
0x00100000 0x00000000 0x00001000 0x00000000 0x00000000 0x00000010
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
i can build other projects so i'm not sure what's going on
i'll try your change on larger projects & see if i can build
functioning exe's
I also get this crash if jwlink is to create debug info.
The proposed workaround at http://sourceforge.net/p/jwlink/tickets/2/ should also fix this bug.
There are a few warnings issued by cvpack:
warning: unknown header detected in types.
warning: unknown signature detected in symbol table.
I guess this is because it detected some CV8-style debug info in at least one of the crt library modules.