diff --git a/tools/configure b/tools/configure index 7f3628b540..3e5331360b 100755 --- a/tools/configure +++ b/tools/configure @@ -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 diff --git a/tools/thumb-cc.py b/tools/thumb-cc.py index 9e2b96c346..a7b31aead5 100755 --- a/tools/thumb-cc.py +++ b/tools/thumb-cc.py @@ -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()