Use compiler optimization for c68kexec.c#444
Open
piggynl wants to merge 1 commit intoYabause:masterfrom
Open
Conversation
9b52763 to
8582a6a
Compare
Author
|
Remove With this change, GCC doesn't complain about |
This was referenced Nov 22, 2022
Should be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In riscv64,
gccgenerates unlinkable ELF forc68kexec.c, causing yabause fails to build.This is a GCC bug. For long branches over 1MiB, RISC-V requires an indirect branch sequence (
auipc+jalr) instead a direct branch (j). But GCC can only generate ajwith an overflowed operand now. The jumpif (!C68k_Initialised) goto C68k_Init;crosses almost the entire function body, which is over 1MiB in riscv64, so we will encounter this bug.yabause/yabause/src/c68k/c68kexec.c
Line 207 in 7e38821
yabause/yabause/src/c68k/c68kexec.c
Lines 323 to 332 in 7e38821
Enabling compiler optimization (specifically
-freorder-blocks) allows GCC to reorder theC68k_Initblock to the front of the function, so there won't be a long branch, and yabause will build successfully.I noticed compiler optimization is disabled for
c68kexec.con purpose. Does any code depend on disabling compiler optimizations? Maybe there is something I can help with?