Skip to content

Commit

Permalink
Merge pull request pret#64 from WhenGryphonsFly/master
Browse files Browse the repository at this point in the history
  • Loading branch information
luckytyphlosion authored Aug 13, 2023
2 parents c2e57ee + 5458d3d commit b5f1974
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions gcc/flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,3 +454,6 @@ extern int flag_hex_asm;
/* Nonzero if generated DWARF debug info should be corrected rather than
match the original (buggy) GCC 2.95.x output. */
extern int flag_fixed_debug_line_info;

/* Nonzero if prologue bug should be fixed. */
extern int flag_prologue_bugfix;
7 changes: 5 additions & 2 deletions gcc/thumb.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,11 @@ far_jump_used_p()
rtx insn;

#ifndef OLD_COMPILER
if (current_function_has_far_jump)
return 1;
if (!flag_prologue_bugfix)
{
if (current_function_has_far_jump)
return 1;
}
#endif

for (insn = get_insns(); insn; insn = NEXT_INSN(insn))
Expand Down
10 changes: 10 additions & 0 deletions gcc/toplev.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,9 @@ int flag_hex_asm = 0;
/* Fix buggy DWARF line info generation. */
int flag_fixed_debug_line_info = 0;

/* Fix prologue bug in new compiler. */
int flag_prologue_bugfix = 0;

typedef struct
{
char *string;
Expand Down Expand Up @@ -729,6 +732,13 @@ lang_independent_options f_options[] =
"Use hex instead of decimal in assembly output"},
{"fix-debug-line", &flag_fixed_debug_line_info, 1,
"Generate fixed DWARF line info"},
#ifndef OLD_COMPILER
/* This flag fixes a bug in the newer agbcc version that causes `lr` to be
saved onto the stack in functions where it is not necessary. This is
needed to produce matching code for certain GBA games. */
{"prologue-bugfix", &flag_prologue_bugfix, 1,
"Prevent unnecessary saving of the lr register to the stack"},
#endif
};

#define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))
Expand Down

0 comments on commit b5f1974

Please sign in to comment.