]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc: Make exec-tool.in handle missing Binutils more gracefully
authorJonathan Wakely <jwakely@redhat.com>
Sun, 28 Jul 2024 10:34:17 +0000 (11:34 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Sun, 28 Jul 2024 19:02:23 +0000 (20:02 +0100)
When users try to build a cross-compiler without first installing
binutils they get confusing errors like:
/tmp/gcc-obj/./gcc/as: line 114: exec: -m: invalid option

This is an incredibly common source of questions on gcc-help and IRC,
and bogus bug reports e.g. see PR 116119 for the latest example.

This change adds an explicit check for an empty $original variable and
exits with a user-friendly error.

gcc/ChangeLog:

* exec-tool.in: Exit with an error if $original is empty.

gcc/exec-tool.in

index 7d152e083a7d3ecb4511e7f7e52dba0d48bbe6bd..2767e1019b87f68e6f6de2f0297234360375857e 100644 (file)
@@ -81,6 +81,14 @@ case "$invoked" in
     ;;
 esac
 
+if test -z "$original"
+then
+  echo "$0: \$original is unset" >&2
+  echo "This probably means there is no '$invoked' for the target." >&2
+  echo "For a cross-compiler, you probably need to install Binutils first." >&2
+  exit 1
+fi
+
 case "$original" in
   ../*)
     # compute absolute path of the location of this script