gcc

[PR43847] fix wrong use of objdump during cross build

Bug #590696 reported by Marcin Juszkiewicz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Low
Andrew Stubbs
4.4
Invalid
Undecided
Unassigned
4.5
Fix Released
Low
Andrew Stubbs
Linaro GCC Tracking
Fix Released
Undecided
Matthias Klose
gcc
Confirmed
Medium
gcc-4.5 (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: gcc-4.5

During cross building of gcc-4.5 there are some checks done to know does host gcc supports plugins.

Problem is that tests are compiled with host CC but checked with target objdump. In result they fail so build ends before it even started.

Attached patch fixes it.

upstream bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43847

Related: lp:gcc-linaro/4.5,revno=99382

Related branches

Revision history for this message
In , Kai-ruottu (kai-ruottu) wrote :

The code in 'gcc-4.5.0/gcc/configure' :

-------------------- clip -----------------------------------
pluginlibs=
if test x"$enable_plugin" = x"yes"; then

  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exported symbols" >&5
$as_echo_n "checking for exported symbols... " >&6; }
  echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c
  ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest > /dev/null 2>&1
  if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
    : # No need to use a flag
  else
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -rdynamic" >&5
$as_echo_n "checking for -rdynamic... " >&6; }
    ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest > /dev/null 2>&1
    if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
      pluginlibs="-rdynamic"
    else
      enable_plugin=no
    fi
  fi
-------------------- clip -----------------------------------

will cause an error when the $target-objdump doesn't understand the $host
binaries like :

-------------------- clip -----------------------------------
Links are now set up to build a cross-compiler
from x86_64-unknown-linux-gnu to arm-unknown-elf.
checking for exported symbols...
/usr/local/cross-gcc-arm-elf-4.5.0/arm-elf/bin/objdump:
conftest: File format not recognized
checking for -rdynamic...
/usr/local/cross-gcc-arm-elf-4.5.0/arm-elf/bin/objdump:
conftest: File format not recognized
-------------------- clip -----------------------------------

The host GCC (CC) compiles and links a program and then the executable
will be looked with 'objdump' ($gcc_cv_objdump). But the latter is now
pointing to the target one!

Revision history for this message
In , Pinskia (pinskia) wrote :

Actually gcc_cv_objdump is correct for the rest of configure.ac; just we are using the incorrect one for the plugin test.

Also note we need to use the one for built for the build for the host. (for Canadian crosses).

Revision history for this message
In , Matthias Klose (doko) wrote :

having an objdump which supports both the host and the target works around this issue.

Revision history for this message
Marcin Juszkiewicz (hrw) wrote :
Revision history for this message
In , Matthias Klose (doko) wrote :
Revision history for this message
Matthias Klose (doko) wrote :
Changed in gcc-4.5 (Ubuntu):
status: New → Fix Committed
importance: Undecided → Medium
Changed in gcc:
status: Unknown → Confirmed
Matthias Klose (doko)
Changed in linaro:
status: New → Confirmed
tags: added: armel toolchain
Loïc Minier (lool)
affects: linaro → gcc-linaro
Loïc Minier (lool)
summary: - fix wrong use of objdump during cross build
+ [PR43847] fix wrong use of objdump during cross build
Revision history for this message
Matthias Klose (doko) wrote :

applied in 4.5.0-6ubuntu1

Changed in gcc-4.5 (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Michael Hope (michaelh1) wrote :

As at 2010-08-06, the fix has not landed in upstream trunk or the upstream 4.5 branch.

Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

Patch backported.

Michael Hope (michaelh1)
description: updated
Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

Matthias, I'm assigning the upstream submission of this patch to you.

Changed in gcc-linaro-tracking:
assignee: nobody → Matthias Klose (doko)
milestone: none → 4.6.0
Revision history for this message
Matthias Klose (doko) wrote :
Revision history for this message
In , Doko-v (doko-v) wrote :

Subject: Bug 43847

Author: doko
Date: Thu Sep 9 18:22:48 2010
New Revision: 164113

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164113
Log:
2010-09-09 Matthias Klose <email address hidden>

        PR bootstrap/43847
        * configure.ac (--enable-plugin): Enhance for cross builds.
        * configure: Regenerate.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/configure
    trunk/gcc/configure.ac

Revision history for this message
In , Doko-v (doko-v) wrote :

Subject: Bug 43847

Author: doko
Date: Thu Sep 9 18:25:26 2010
New Revision: 164114

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164114
Log:
2010-09-09 Matthias Klose <email address hidden>

        PR bootstrap/43847
        * configure.ac (--enable-plugin): Enhance for cross builds.
        * configure: Regenerate.

Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/configure
    branches/gcc-4_5-branch/gcc/configure.ac

Revision history for this message
Matthias Klose (doko) wrote :

fixed on the trunk, r164113

Changed in gcc-linaro-tracking:
status: New → Fix Released
Changed in gcc:
importance: Unknown → Medium
Revision history for this message
In , Joern Clausen (joernc1) wrote :

The current code (GCC 4.7.3)

  *)
    if test x$build = x$host; then
      export_sym_check="objdump${exeext} -T"
    elif test x$host = x$target; then
      export_sym_check="$gcc_cv_objdump -T"
    else
      export_sym_check=
    fi

does not use OBJDUMP or similar hints for the correct name and location of "objdump" when not doing a cross compile. On Solaris, I set

OBJDUMP=/usr/sfw/bin/gobjdump

which leads to

Links are now set up to build a native compiler for sparc-sun-solaris2.10.
checking for exported symbols... /software/local/gcc/src/gcc-4.7.3/gcc/configure: line 27313: objdump: command not found
yes
checking for -rdynamic... /software/local/gcc/src/gcc-4.7.3/gcc/configure: line 27323: objdump: command not found
no

Revision history for this message
In , Pinskia (pinskia) wrote :

The code is now in config/gcc-plugin.m4 and still does not use ${OBJDIR} or ${NM} (for the darwin case).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.