diff --git a/include/macros.inc b/include/macros.inc index be5ec9cd..bca05c7b 100644 --- a/include/macros.inc +++ b/include/macros.inc @@ -145,3 +145,54 @@ .set THRM1, 1020 .set THRM2, 1021 .set THRM3, 1022 + +# 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 + +# Generates a relative relocation against a symbol. +# Usage: +# .rel my_function, .L_label +.macro .rel name, label +.4byte "\name" + ("\label" - "\name") +.endm