Bug 5453 - objcopy does not seem to work for absolute addresses on i386 OSes installed on x86_64 hardware
Summary: objcopy does not seem to work for absolute addresses on i386 OSes installed o...
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on: 5059
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-06 22:29 UTC by Matt Anderson
Modified: 2007-12-07 01:49 UTC (History)
1 user (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Anderson 2007-12-06 22:29:42 UTC
While trying to build grub on a Core 2 Duo system that has i386 Fedora installed
on it I was stopped at ./configure time due to failing the following check:

dnl Some versions of `objcopy -O binary' vary their output depending
dnl on the link address.
AC_DEFUN([grub_PROG_OBJCOPY_ABSOLUTE],
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
[cat > conftest.c <<\EOF
void
cmain (void)
{
   *((int *) 0x1000) = 2;
}
EOF

if AC_TRY_EVAL(ac_compile) && test -s conftest.o; then :
else
  AC_MSG_ERROR([${CC-cc} cannot compile C source code])
fi
grub_cv_prog_objcopy_absolute=yes
for link_addr in 2000 8000 7C00; do
  if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext
-Wl,$link_addr conftest.o -o conftest.exec]); then :
  else
    AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
  fi
  if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
  else
    AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
  fi
  if test ! -f conftest.old || AC_TRY_COMMAND([cmp -s conftest.old conftest]); then
    mv -f conftest conftest.old
  else
    ## ./configure fails out here
    grub_cv_prog_objcopy_absolute=no
    break
  fi
done
rm -f conftest*])
AC_MSG_RESULT([$grub_cv_prog_objcopy_absolute])])

This test initially failed with Fedora's 2.17 based objcopy rpm, but I also was
able to get the same behavior from an unpatched copy of binutils-2.18.50.tar.gz.

I tried building grub on a Pentium 4 system with i386 Fedora and that worked
just fine.  I also was able to successfully build on my Core 2 Duo system with
the x86_64 version of RHEL 5.1.
Comment 1 Alan Modra 2007-12-07 00:08:42 UTC
The grub test is bogus.  This is not a bug in objcopy.  Please complain to the
grub authors.
Comment 2 H.J. Lu 2007-12-07 01:49:48 UTC
This is a dup of PR 5059.