aboutsummaryrefslogtreecommitdiff
path: root/gcc/configure.ac
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-06-03 10:22:25 +0200
committerJan Beulich <jbeulich@suse.com>2022-06-03 10:22:25 +0200
commit6124f4248888484f419671f4f7bd40d253d3de06 (patch)
tree7cc681c73410c6031e7a800bc82886c596311c73 /gcc/configure.ac
parentd4630b65d12046ecc477d382f5a2094b8250b21b (diff)
downloadgcc-6124f4248888484f419671f4f7bd40d253d3de06.zip
gcc-6124f4248888484f419671f4f7bd40d253d3de06.tar.gz
gcc-6124f4248888484f419671f4f7bd40d253d3de06.tar.bz2
configure: arrange to use appropriate objcopy
Using the system objcopy is wrong when other configure checks have probed a different set of binutils (I've noticed the problem on a system where the base objcopy can't deal with compressed debug sections). Arrange for the matching one to be picked up, first and foremost if an "in tree" one is available, by mirroring respective logic already present for nm. gcc/ * Makefile.in (ORIGINAL_OBJCOPY_FOR_TARGET): New. * configure.ac: Check for objcopy, producing ORIGINAL_OBJCOPY_FOR_TARGET. * configure: Update accordingly. * exec-tool.in (ORIGINAL_OBJCOPY_FOR_TARGET): New. Handle objcopy.
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r--gcc/configure.ac30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 4cd48b4..e098b905 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2815,6 +2815,36 @@ case "$ORIGINAL_NM_FOR_TARGET" in
*) AC_CONFIG_FILES(nm:exec-tool.in, [chmod +x nm]) ;;
esac
+# Figure out what objcopy we will be using.
+AS_VAR_SET_IF(gcc_cv_objcopy,, [
+if test -f $gcc_cv_binutils_srcdir/configure.ac \
+ && test -f ../binutils/Makefile \
+ && test x$build = x$host; then
+ gcc_cv_objcopy=../binutils/objcopy$build_exeext
+elif test -x objcopy$build_exeext; then
+ gcc_cv_objcopy=./objcopy$build_exeext
+elif ( set dummy $OBJCOPY_FOR_TARGET; test -x $[2] ); then
+ gcc_cv_objcopy="$OBJCOPY_FOR_TARGET"
+else
+ AC_PATH_PROG(gcc_cv_objcopy, $OBJCOPY_FOR_TARGET)
+fi])
+
+AC_MSG_CHECKING(what objcopy to use)
+if test "$gcc_cv_objcopy" = ../binutils/objcopy$build_exeext; then
+ # Single tree build which includes binutils.
+ AC_MSG_RESULT(newly built objcopy)
+ in_tree_objcopy=yes
+else
+ AC_MSG_RESULT($gcc_cv_objcopy)
+ in_tree_objcopy=no
+fi
+
+ORIGINAL_OBJCOPY_FOR_TARGET=$gcc_cv_objcopy
+AC_SUBST(ORIGINAL_OBJCOPY_FOR_TARGET)
+case "$ORIGINAL_OBJCOPY_FOR_TARGET" in
+ ./objcopy | ./objcopy$build_exeext) ;;
+ *) AC_CONFIG_FILES(objcopy:exec-tool.in, [chmod +x objcopy]) ;;
+esac
# Figure out what objdump we will be using.
AS_VAR_SET_IF(gcc_cv_objdump,, [