From 1f7fd8b7ad3c90f8051f61558a68658e90218d3e Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 8 Oct 2024 16:12:10 +0900 Subject: [PATCH] Substitute `coroutine_transfer` with prefixed symbol in Makefile ``` coroutine/arm64/Context.S:31:57: error: invoking macro TOKEN_PASTE argument 1: empty macro arguments are undefined in ISO C90 [-Wpedantic] 31 | .global PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) | ^ ``` --- coroutine/amd64/Context.S | 5 ++--- coroutine/arm32/Context.S | 7 +++---- coroutine/arm64/Context.S | 5 ++--- coroutine/loongarch64/Context.S | 5 ++--- coroutine/ppc/Context.S | 5 ++--- coroutine/ppc64/Context.S | 5 ++--- coroutine/ppc64le/Context.S | 7 +++---- coroutine/riscv64/Context.S | 5 ++--- coroutine/x86/Context.S | 5 ++--- template/Makefile.in | 4 +++- 10 files changed, 23 insertions(+), 30 deletions(-) diff --git a/coroutine/amd64/Context.S b/coroutine/amd64/Context.S index eebf9bf18efcc2..4b94d31f30839f 100644 --- a/coroutine/amd64/Context.S +++ b/coroutine/amd64/Context.S @@ -10,12 +10,11 @@ * one at the bottom of this file */ #define TOKEN_PASTE(x,y) x##y -#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name) .text -.globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) -PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): +.globl PREFIXED_SYMBOL(coroutine_transfer) +PREFIXED_SYMBOL(coroutine_transfer): #if defined(__CET__) && (__CET__ & 0x01) != 0 /* IBT landing pad */ diff --git a/coroutine/arm32/Context.S b/coroutine/arm32/Context.S index 1850c4c4080602..945e4f82d5d61b 100644 --- a/coroutine/arm32/Context.S +++ b/coroutine/arm32/Context.S @@ -6,16 +6,15 @@ ## #define TOKEN_PASTE(x,y) x##y -#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name) .file "Context.S" .text -.globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) +.globl PREFIXED_SYMBOL(coroutine_transfer) .align 2 -.type PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer),%function +.type PREFIXED_SYMBOL(coroutine_transfer),%function .syntax unified -PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): +PREFIXED_SYMBOL(coroutine_transfer): # Save caller state (8 registers + return address) push {r4-r11,lr} diff --git a/coroutine/arm64/Context.S b/coroutine/arm64/Context.S index 2391333caee064..11f6aa08108baa 100644 --- a/coroutine/arm64/Context.S +++ b/coroutine/arm64/Context.S @@ -6,7 +6,6 @@ ## #define TOKEN_PASTE(x,y) x##y -#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name) #if defined(__APPLE__) #define x29 fp @@ -28,8 +27,8 @@ ## See "Providing protection for complex software" for more details about PAC/BTI ## https://developer.arm.com/architectures/learn-the-architecture/providing-protection-for-complex-software -.global PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) -PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): +.global PREFIXED_SYMBOL(coroutine_transfer) +PREFIXED_SYMBOL(coroutine_transfer): #if defined(__ARM_FEATURE_PAC_DEFAULT) && (__ARM_FEATURE_PAC_DEFAULT != 0) # paciasp (it also acts as BTI landing pad, so no need to insert BTI also) diff --git a/coroutine/loongarch64/Context.S b/coroutine/loongarch64/Context.S index 662f5dfb6c7af8..6e10cd032bea8d 100644 --- a/coroutine/loongarch64/Context.S +++ b/coroutine/loongarch64/Context.S @@ -1,11 +1,10 @@ #define TOKEN_PASTE(x,y) x##y -#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name) .text .align 2 -.global PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) -PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): +.global PREFIXED_SYMBOL(coroutine_transfer) +PREFIXED_SYMBOL(coroutine_transfer): # Make space on the stack for caller registers addi.d $sp, $sp, -0xa0 diff --git a/coroutine/ppc/Context.S b/coroutine/ppc/Context.S index e2431a9250da21..f44b2419b4dfee 100644 --- a/coroutine/ppc/Context.S +++ b/coroutine/ppc/Context.S @@ -9,15 +9,14 @@ ; To add support for AIX, *BSD or *Linux, please make separate implementations. #define TOKEN_PASTE(x,y) x##y -#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name) .machine ppc7400 ; = G4, Rosetta .text -.globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) +.globl PREFIXED_SYMBOL(coroutine_transfer) .align 2 -PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): +PREFIXED_SYMBOL(coroutine_transfer): ; Make space on the stack for caller registers ; (Should we rather use red zone? See libphobos example.) subi r1,r1,80 diff --git a/coroutine/ppc64/Context.S b/coroutine/ppc64/Context.S index f8561e0e7d0bee..20a47c61c6914e 100644 --- a/coroutine/ppc64/Context.S +++ b/coroutine/ppc64/Context.S @@ -8,15 +8,14 @@ ; To add support for AIX, *BSD or *Linux, please make separate implementations. #define TOKEN_PASTE(x,y) x##y -#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name) .machine ppc64 ; = G5 .text -.globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) +.globl PREFIXED_SYMBOL(coroutine_transfer) .align 2 -PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): +PREFIXED_SYMBOL(coroutine_transfer): ; Make space on the stack for caller registers ; (Should we rather use red zone? See libphobos example.) subi r1,r1,160 diff --git a/coroutine/ppc64le/Context.S b/coroutine/ppc64le/Context.S index 61be9efcf0461a..cccd002be5a5ac 100644 --- a/coroutine/ppc64le/Context.S +++ b/coroutine/ppc64le/Context.S @@ -1,12 +1,11 @@ #define TOKEN_PASTE(x,y) x##y -#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name) .text .align 2 -.globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) -.type PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer), @function -PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): +.globl PREFIXED_SYMBOL(coroutine_transfer) +.type PREFIXED_SYMBOL(coroutine_transfer), @function +PREFIXED_SYMBOL(coroutine_transfer): # Make space on the stack for caller registers addi 1,1,-152 diff --git a/coroutine/riscv64/Context.S b/coroutine/riscv64/Context.S index cc4e872f84b3dd..8e7fc74ffc1ee5 100644 --- a/coroutine/riscv64/Context.S +++ b/coroutine/riscv64/Context.S @@ -1,11 +1,10 @@ #define TOKEN_PASTE(x,y) x##y -#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name) .text .align 2 -.global PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) -PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): +.global PREFIXED_SYMBOL(coroutine_transfer) +PREFIXED_SYMBOL(coroutine_transfer): # Make space on the stack for caller registers addi sp, sp, -0xd0 diff --git a/coroutine/x86/Context.S b/coroutine/x86/Context.S index f06a417084b4e2..b04e71aa1cbbfa 100644 --- a/coroutine/x86/Context.S +++ b/coroutine/x86/Context.S @@ -6,12 +6,11 @@ ## #define TOKEN_PASTE(x,y) x##y -#define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name) .text -.globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) -PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): +.globl PREFIXED_SYMBOL(coroutine_transfer) +PREFIXED_SYMBOL(coroutine_transfer): # Save caller registers pushl %ebp diff --git a/template/Makefile.in b/template/Makefile.in index 4cc0865ddcd56b..c4e2d6d542d44e 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -452,9 +452,11 @@ gc_impl.$(OBJEXT): gc/$(BUILTIN_GC).c probes.h @$(ECHO) compiling $< $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $< +PREFIXED_SYMBOL = name +_PREFIXED_SYMBOL = TOKEN_PASTE($(SYMBOL_PREFIX),name) .$(ASMEXT).$(OBJEXT): @$(ECHO) assembling $< - $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -DSYMBOL_PREFIX=$(SYMBOL_PREFIX) -c $< + $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ "-DPREFIXED_SYMBOL(name)=$($(SYMBOL_PREFIX)PREFIXED_SYMBOL)" -c $< .c.$(ASMEXT): @$(ECHO) translating $<