autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

x86_64 ld elf


From: Patrick Shinpaugh
Subject: x86_64 ld elf
Date: Tue, 18 Oct 2005 02:58:07 -0400

Hi,
I'm trying to use autoconf (2.59) to create 32 or 64 bit libraries based
on an enable flag when processor supports both (i.e. x86_64 or EM64T).
The issue I have come across is the gnu linker ld which automatically
has "-m elf_x86_64" added through the generated configure script
(LD="/usr/bin/ld -m elf_x86_64"). Even if I set CXXFLAGS and LDFLAGS to
"-m32" the result is the same. Looking at the internals of the configure
script (excerpt below) there should be some way to request 32 bit and it
should append "-m elf_i386" instead. I have tried setting LD manually
but it is overwritten with each AC_PROG_test (where test is CXX or CPP
or some other test) and during these tests it appears that other
important variables are being set which cause the build to fail because
they end up trying to use 64 bit libraries instead of 32 bit. I suppose
I could force it after each and every AC_PROG_TEST but that seems rather
redundant and not at all robust.

Any help would be greatly appreciated.


configure
***************************************************************************
...
x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-
*linux*)
  # Find out which ABI we are using.
  echo 'int i;' > conftest.$ac_ext
  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; then
    case "`/usr/bin/file conftest.o`" in
    *32-bit*)
      case $host in
        x86_64-*linux*)
          LD="${LD-ld} -m elf_i386"
          ;;
        ppc64-*linux*|powerpc64-*linux*)
          LD="${LD-ld} -m elf32ppclinux"
          ;;
        s390x-*linux*)
          LD="${LD-ld} -m elf_s390"
          ;;
        sparc64-*linux*)
          LD="${LD-ld} -m elf32_sparc"
          ;;
      esac
      ;;
    *64-bit*)
      case $host in
        x86_64-*linux*)
          LD="${LD-ld} -m elf_x86_64"
          ;;
        ppc*-*linux*|powerpc*-*linux*)
          LD="${LD-ld} -m elf64ppc"
          ;;
        s390*-*linux*)
          LD="${LD-ld} -m elf64_s390"
          ;;
        sparc*-*linux*)
          LD="${LD-ld} -m elf64_sparc"
          ;;
      esac
      ;;
    esac
  fi
  rm -rf conftest*
  ;;
...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]