You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Change the default for the labels
* Update macro.inc and include_asm.h each time splat is run
* Option to customize generated macro.inc file
* use endlabels in incbins
* changelog and docs
* black
* update docs
* Update tests
* review changes and some fixes
* path fixes
* nmlabel -> nonmatching
* Use configured labels instead of hardcoded ones
* fix python 3.9 not having newline argument on write_text
* Fix windows?
Copy file name to clipboardExpand all lines: docs/Configuration.md
+41-4Lines changed: 41 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,21 @@ String that is placed before the contents of newly-generated assembly (`.s`) fil
122
122
generated_s_preamble: .set fp=64
123
123
```
124
124
125
+
### generated_macro_inc_content
126
+
127
+
String that is placed after the contents of the splat-generated `macro.inc` file.
128
+
129
+
### generate_asm_macros_files
130
+
131
+
Tells splat to regenerate files containing assembly macros and C macros each time splat is run.
132
+
133
+
Specifically splat generates `include/include_asm.h`, `include/macro.inc`, `include/labels.inc` and `include/gte_macros.inc`, which contain the proper C and assembly macro definitions expected for building the generated assembly correctly. This allows splat to update the macro definitions with minimal user intervention and headaches.
134
+
135
+
Turning this off can be useful in case the user wants to control exactly the contents of those files, but it is not recommended, since the user definitions may get outdated. Before turning this option off consider using the [`generated_macro_inc_content`](#generated_macro_inc_content) option to customize the contents of the generated `macro.inc` file.
136
+
137
+
Some files may not be generated depending on the selected platform and compiler, because those setups don't require them. For example `include_asm.h` won't be generated if the compiler is set to `IDO` or `MWCCPS2`. `include/gte_macros.inc` is only generated on psx projects.
138
+
139
+
Defaults to `True`.
125
140
126
141
### o_as_suffix
127
142
@@ -653,26 +668,48 @@ Determines the macro used to declare functions in asm files
653
668
654
669
### asm_function_alt_macro
655
670
656
-
Determines the macro used to declare symbols in the middle of functions in asm files (which may be alternative entries)
671
+
Determines the macro used to declare symbols in the middle of functions in asm files (which may be alternative entries).
672
+
673
+
Defaults to `alabel`.
657
674
658
675
### asm_jtbl_label_macro
659
676
660
-
Determines the macro used to declare jumptable labels in asm files
677
+
Determines the macro used to declare jumptable labels in asm files.
678
+
679
+
Defaults to `jlabel`.
661
680
662
681
### asm_data_macro
663
682
664
-
Determines the macro used to declare data symbols in asm files
683
+
Determines the macro used to declare data symbols in asm files.
684
+
685
+
Defaults to `dlabel`.
665
686
666
687
### asm_end_label
667
688
668
-
Determines the macro used at the end of a function, such as endlabel or .end
689
+
Determines the macro used at the end of a function, such as `endlabel` or `.end`.
690
+
691
+
Defaults to `endlabel`.
692
+
693
+
### asm_data_end_label
694
+
695
+
Determines the macro used at the end of a data symbol.
696
+
697
+
Defaults to `enddlabel`.
669
698
670
699
### asm_ehtable_label_macro
671
700
672
701
Determines the macro used to declare ehtable labels in asm files.
673
702
674
703
Defaults to `ehlabel`
675
704
705
+
### asm_nonmatching_label_macro
706
+
707
+
Determines the macro used to declare the given symbol is a non matching one.
708
+
709
+
Explicitly specifying that a symbol haven't been matched yet in the generated assembly is useful for other tools that consume the build artifacts of the project. This information can be used by those tools for stuff like progress reporting.
710
+
711
+
Defaults to `nonmatching`
712
+
676
713
### asm_emit_size_directive
677
714
678
715
Toggles the .size directive emitted by the disassembler
These macros must be defined in an included header, which splat currently does not produce.
121
+
These macros must be defined in an included header, which splat generates and updates by default for GCC-based projects.
122
122
123
123
For a GCC example, see the [include.h](https://github.com/AngheloAlf/drmario64/blob/master/include/include_asm.h) from the Dr. Mario project.
124
124
@@ -130,27 +130,75 @@ For MWCC, you will need [mwccgap](https://github.com/mkst/mwccgap) to include as
130
130
131
131
splat relies on some assembly macros for the asm generation. They usually live on the `include/macro.inc` file. Without these macros then an assembler would not be able to build our disassemblies.
132
132
133
+
By default splat will generate files with the required assembly macros.
134
+
133
135
Those macros usually look like this:
134
136
135
137
```mips
136
-
.macro glabel label
137
-
.global \label
138
+
# A function symbol.
139
+
.macro glabel label, visibility=global
140
+
.\visibility \label
138
141
.type \label, @function
139
142
\label:
143
+
.ent \label
140
144
.endm
141
145
142
-
.macro dlabel label
143
-
.global \label
146
+
# The end of a function symbol.
147
+
.macro endlabel label
148
+
.size \label, . - \label
149
+
.end \label
150
+
.endm
151
+
152
+
# An alternative entry to a function.
153
+
.macro alabel label, visibility=global
154
+
.\visibility \label
155
+
.type \label, @function
144
156
\label:
157
+
.aent \label
145
158
.endm
146
159
160
+
# A label referenced by an error handler table.
161
+
.macro ehlabel label, visibility=global
162
+
.\visibility \label
163
+
\label:
164
+
.endm
165
+
166
+
167
+
# A label referenced by a jumptable.
147
168
.macro jlabel label
148
169
.global \label
149
170
\label:
150
171
.endm
172
+
173
+
174
+
# A data symbol.
175
+
.macro dlabel label, visibility=global
176
+
.\visibility \label
177
+
.type \label, @object
178
+
\label:
179
+
.endm
180
+
181
+
# End of a data symbol.
182
+
.macro enddlabel label
183
+
.size \label, . - \label
184
+
.endm
185
+
186
+
187
+
# Label to signal the symbol haven't been matched yet.
188
+
.macro nonmatching label, size=1
189
+
.global \label\().NON_MATCHING
190
+
.type \label\().NON_MATCHING, @object
191
+
.size \label\().NON_MATCHING, \size
192
+
\label\().NON_MATCHING:
193
+
.endm
151
194
```
152
195
153
-
Where `glabel` is used for functions, `dlabel` is used for data, rodata and bss variables and `jlabel` is used for branch labels used by jumptables.
196
+
The most commonly used labels are:
197
+
198
+
- `glabel`and `endlabel` which are used to define function symbols.
199
+
- `dlabel`and `enddlabel` which are used to defined data, rodata and bss symbols.
200
+
- `jlabel`is used for defining branch labels used by jumptables.
201
+
- `nonmatching`is used to define the symbol haven't been matched yet.
154
202
155
203
Asm differ tools can sometimes struggle to show diffs with `jlabel`s when combined with certain compilers. A workaround for this issue is to mark the `jlabel` as a function, like this:
0 commit comments