Closed dezgeg closed 2 weeks ago
Is it possible to add a simple test (or couple of tests) for this?
In terms of a review, can we call it __maspsx_include_asm_hack
(rather than global)
In terms of the wording:
When compiling with non-zero
-G
value, some versions of GCC reorder functions to appear after data definitions in the output assembly. Unfortunately, this also causes functions to be placed after__asm__
statements, thus breaking the usual implementation of theINCLUDE_ASM
macro.By using this updated
INCLUDE_ASM
macro, each included assembly file is wrapped in a dummy function (thus preserving ordering), and maspsx will strip out the wrapper machinery (keeping only lines containingmaspsx-keep
) ensuring the resulting output is as expected.
Yeah,I'll try to add some tests (and test more GCC versions as well).
I avoided adding include_asm
to the macro name because I had thought it could be used more generically to implement for instance INCLUDE_RODATA()
as well, but now that I think more maybe this trick can't help can't fix rodata ordering anyway...
Updated
Could you run black
on the repo and commit the change, it's going to swap all your '
for "
...
Done
With some versions of GCC, passing -G to it causes INCLUDE_ASM()'d functions get reordered. Add an extremely ugly hack that makes it possible to workaround that problem.