Skip to content

Commit

Permalink
Update PS2 asm prelude (#1278)
Browse files Browse the repository at this point in the history
Update ps2 asm prelude

Updates existing macros and adds more macros to support declaring visibility for symbols
  • Loading branch information
1superchip authored Jun 22, 2024
1 parent ee9abf7 commit 83bafc6
Showing 1 changed file with 55 additions and 9 deletions.
64 changes: 55 additions & 9 deletions backend/coreapp/asm_preludes/ps2.s
Original file line number Diff line number Diff line change
@@ -1,21 +1,67 @@
.macro glabel label
.global \label
.type \label, @function
\label:
.macro glabel name, visibility=global
.\visibility "\name"
.type "\name", @function
"\name":
.endm

.macro dlabel label
.global \label
\label:
.macro dlabel name, visibility=global
.\visibility "\name"
.type "\name", @object
"\name":
.endm

.macro jlabel label
\label:
.macro jlabel name, visibility=local
.\visibility "\name"
"\name":
.endm

.macro .late_rodata
.section .rodata
.endm

# Defines a sized symbol with function type.
# Usage:
# .fn my_function, local
# /* asm here */
# .endfn my_function
.macro .fn name, visibility=global
.\visibility "\name"
.type "\name", @function
"\name":
.endm

.macro .endfn name
.size "\name", . - "\name"
.endm

# Defines a sized symbol with object type.
# Usage:
# .obj my_object, local
# /* data here */
# .endobj my_object
.macro .obj name, visibility=global
.\visibility "\name"
.type "\name", @object
"\name":
.endm

.macro .endobj name
.size "\name", . - "\name"
.endm

# Defines a sized symbol without a type.
# Usage:
# .sym my_sym, local
# /* anything here */
# .endsym my_sym
.macro .sym name, visibility=global
.\visibility "\name"
"\name":
.endm

.macro .endsym name
.size "\name", . - "\name"
.endm

.set noat
.set noreorder

0 comments on commit 83bafc6

Please sign in to comment.