build: move '-mthumb-interwork' into the configure script

When we request a thumb build on a non-thumb-only target, we hand
compilation to a script that tries to build everything as thumb, falling
back to non-thumb arm mode if the thumb build fails.  In order for
this to work, the compiler flag -mthumb-interwork is required.

Move this definition out of the thumb-cc script, and into the configure
script (ie along with the other target-specific definitions)

Change-Id: Idc1f8caa088dbbf710b169b272de61cc0b7c9ca6
This commit is contained in:
Solomon Peachy 2026-09-19 20:44:41 -04:00
parent 34a18e7616
commit af9b65485b
2 changed files with 6 additions and 1 deletions

1
tools/configure vendored
View file

@ -4722,6 +4722,7 @@ fi
if test "$ARG_ARM_THUMB" = "1"; then
extradefines="$extradefines -DUSE_THUMB"
GCCOPTS="$GCCOPTS -mthumb-interwork"
CC="$toolsdir/thumb-cc.py $CC"
fi

View file

@ -31,7 +31,11 @@ if '-o' in args and args.index('-o') < len(args) - 1:
if len(args[args.index('-o') + 1].rsplit('.o', 1)) == 1:
execv(args[0], args) # output doesn't end in .o
args.append('-mthumb-interwork') # thumb-interwork is required
# thumb-interwork is required; add if not present
if '-mthumb-interwork' not in args:
args += ['-mthumb-interwork'];
# Try to compile in thumb mode first
gcc = Popen(args + ['-mthumb'], stdout=PIPE, stderr=PIPE)
(out, err) = gcc.communicate()