Skip to content

Commit

Permalink
gba: always use ARM mode instead of Thumb mode
Browse files Browse the repository at this point in the history
This results in bigger code size, but it works around a bug in the
linker.

The issue starts with the problem that libraries (picolibc, compiler-rt)
were compiled as ARM and the rest as Thumb. This causes some blx
instructions to be inserted by the linker to call into these libraries.

Ideally we should fix the libraries to use Thumb mode instead, but that
requires some more extensive changes (including fixes to compiler-rt)
and it's just way easier to use ARM mode everywhere.
  • Loading branch information
aykevl authored and deadprogram committed Apr 21, 2020
1 parent ceeba52 commit 565ff99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions targets/gameboy-advance.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"llvm-target": "thumb4-none-eabi",
"llvm-target": "arm4-none-eabi",
"cpu": "arm7tdmi",
"build-tags": ["gameboyadvance", "arm7tdmi", "baremetal", "linux", "arm"],
"goos": "linux",
Expand All @@ -10,7 +10,7 @@
"libc": "picolibc",
"cflags": [
"-g",
"--target=thumb4-none-eabi",
"--target=arm4-none-eabi",
"-mcpu=arm7tdmi",
"-Oz",
"-Werror",
Expand Down

1 comment on commit 565ff99

@trevor403
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting solution to avoid switching modes... I guess this will have to do for now!

Please sign in to comment.