From c345f7f137a3340168fd3e9a484981cc2f3ee6c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 10 Jan 2021 07:46:25 +0100 Subject: [PATCH] [ASM x64] Make UNIMPLEMENTED macro self-suffisant This fixes link errors with MsgUnimplemented not defined on binaries not linking to CRT. --- sdk/include/asm/asm.inc | 23 ++++++++++++----------- sdk/lib/crt/except/amd64/chkstk_asm.s | 3 --- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/sdk/include/asm/asm.inc b/sdk/include/asm/asm.inc index afbfdf24cd8..b3b265ef4f3 100644 --- a/sdk/include/asm/asm.inc +++ b/sdk/include/asm/asm.inc @@ -246,6 +246,10 @@ ENDM /* Macro values need to be marked */ #define VAL(x) \x +#define CR "\r" +#define LF "\n" +#define NUL "\0" + /* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ #define MACRO(...) .macro __VA_ARGS__ #define ENDM .endm @@ -383,14 +387,15 @@ code = 1 .endm .macro UNIMPLEMENTED2 file, line, func - jmp 3f -1: .asciz "\func" -2: .asciz \file -3: + jmp 4f +1: .ascii "Unimplemented", CR, LF, NUL +2: .asciz "\func" +3: .asciz \file +4: sub rsp, 0x20 - lea rcx, MsgUnimplemented[rip] - lea rdx, 1b[rip] - lea r8, 2b[rip] + lea rcx, 1b[rip] + lea rdx, 2b[rip] + lea r8, 3b[rip] mov r9, \line call DbgPrint add rsp, 0x20 @@ -404,10 +409,6 @@ code = 1 #define else .else #define elseif .elseif -#define CR "\r" -#define LF "\n" -#define NUL "\0" - /* CFI annotations */ #define CFI_STARTPROC .cfi_startproc #define CFI_ENDPROC .cfi_endproc diff --git a/sdk/lib/crt/except/amd64/chkstk_asm.s b/sdk/lib/crt/except/amd64/chkstk_asm.s index eb06952b0db..255c66e6df5 100644 --- a/sdk/lib/crt/except/amd64/chkstk_asm.s +++ b/sdk/lib/crt/except/amd64/chkstk_asm.s @@ -13,9 +13,6 @@ /* CODE **********************************************************************/ .code64 -MsgUnimplemented: - .ascii "Unimplemented", CR, LF, NUL - FUNC __chkstk .endprolog UNIMPLEMENTED chkstk