Skip to content

Commit

Permalink
Substitute coroutine_transfer with prefixed symbol in Makefile
Browse files Browse the repository at this point in the history
```
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)
      |                                                         ^
```
  • Loading branch information
nobu committed Oct 8, 2024
1 parent 9759376 commit 1f7fd8b
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 30 deletions.
5 changes: 2 additions & 3 deletions coroutine/amd64/Context.S
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
7 changes: 3 additions & 4 deletions coroutine/arm32/Context.S
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
5 changes: 2 additions & 3 deletions coroutine/arm64/Context.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions coroutine/loongarch64/Context.S
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 2 additions & 3 deletions coroutine/ppc/Context.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions coroutine/ppc64/Context.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions coroutine/ppc64le/Context.S
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 2 additions & 3 deletions coroutine/riscv64/Context.S
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 2 additions & 3 deletions coroutine/x86/Context.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion template/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<
Expand Down

0 comments on commit 1f7fd8b

Please sign in to comment.