This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/54584] New: m68k-uclinux error: Link tests are not allowed after GCC_NO_EXECUTABLES


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54584

             Bug #: 54584
           Summary: m68k-uclinux error: Link tests are not allowed after
                    GCC_NO_EXECUTABLES
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: baker@usgs.gov


Created attachment 28193
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28193
Make m68k-uclinux-gcc/g++ cross compilers

Host: i686-pc-linux (also x86_64-apple-darwin10.8.0)
Target: m68k-uclinux (Coldfire)

Build of msep-data/libstdc++-v3 fails for FreeScale Coldfire uClinux target
(complete configure and build commands are attached):

:
Running configure in multilib subdir msep-data
:
checking command to parse
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/nm output from
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/xgcc
-B/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/
-B/usr/local/gcc-4.7-20120908/m68k-uclinux/bin/
-B/usr/local/gcc-4.7-20120908/m68k-uclinux/lib/ -isystem
/usr/local/gcc-4.7-20120908/m68k-uclinux/include -isystem
/usr/local/gcc-4.7-20120908/m68k-uclinux/sys-include  -msep-data -Wa,-mno-mac
object... failed
:
checking for shl_load... configure: error: Link tests are not allowed after
GCC_NO_EXECUTABLES.
make[2]: *** [configure-target-libstdc++-v3] Error 1

In msep-data/libstdc++-v3/config.log there is an earlier link failure which
causes gcc_no_link=yes:

configure:3885: /tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/xgcc
-B/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/
-B/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/../freescale-coldfire-gcc-4.7-20120908/m68k-uclinux/bin/
-B/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/../freescale-coldfire-gcc-4.7-20120908/m68k-uclinux/lib/
-isystem
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/../freescale-coldfire-gcc-4.7-20120908/m68k-uclinux/include
-isystem
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/../freescale-coldfire-gcc-4.7-20120908/m68k-uclinux/sys-include
 -msep-data -Wa,-mno-mac -o conftest -g -O2   conftest.c  >&5
/tmp/freescale-coldfile-xgcc/freescale-coldfire-2011.09/m68k-uclinux/bin/ld.real:
final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

configure:11284: checking for shl_load
configure:11284: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

I extracted the failed command and showed that the link fails for both
msep-data and -fPIC (implied by -msep-data):

$ cat conftest.c
/* confdefs.h */
#define PACKAGE_NAME "package-unused"
#define PACKAGE_TARNAME "libstdc++"
#define PACKAGE_VERSION "version-unused"
#define PACKAGE_STRING "package-unused version-unused"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
/* end confdefs.h.  */

int
main ()
{

  ;
  return 0;
}

# Failed link from libstdc++-v3/configure:
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/xgcc -t
-B/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/
-B/usr/local/gcc-4.7-20120908/m68k-uclinux/bin/
-B/usr/local/gcc-4.7-20120908/m68k-uclinux/lib/ -isystem
/usr/local/gcc-4.7-20120908/m68k-uclinux/include -isystem
/usr/local/gcc-4.7-20120908/m68k-uclinux/sys-include -msep-data -Wa,-mno-mac -o
conftest conftest.o
# /usr/local/gcc-4.7-20120908/m68k-uclinux/bin/ld.real: final link failed:
Nonrepresentable section on output
# collect2: error: ld returned 1 exit status

# The problem is actually with -fPIC (implied by -msep-data):
/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/xgcc -t
-B/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/
-B/usr/local/gcc-4.7-20120908/m68k-uclinux/bin/
-B/usr/local/gcc-4.7-20120908/m68k-uclinux/lib/ -isystem
/usr/local/gcc-4.7-20120908/m68k-uclinux/include -isystem
/usr/local/gcc-4.7-20120908/m68k-uclinux/sys-include -fPIC -Wa,-mno-mac -o
conftest conftest.o
# /usr/local/gcc-4.7-20120908/m68k-uclinux/bin/ld.real: final link failed:
Nonrepresentable section on output
# collect2: error: ld returned 1 exit status

The link does not fail when the GCC 4.6 crtbegin.o/crtend.o binaries are used:

# Linking with the 4.6 crtbegin/crtend binaries makes the problem go away:
\mv cross-gcc-4.7-20120908/gcc/msep-data/crtbegin{,-4.7}.o
\mv cross-gcc-4.7-20120908/gcc/msep-data/crtend{,-4.7}.o
\cp cross-gcc-{4.6-20120907,4.7-20120908}/gcc/msep-data/crtbegin.o
\cp cross-gcc-{4.6-20120907,4.7-20120908}/gcc/msep-data/crtend.o

/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/xgcc -t
-B/tmp/freescale-coldfile-xgcc/cross-gcc-4.7-20120908/./gcc/
-B/usr/local/gcc-4.7-20120908/m68k-uclinux/bin/
-B/usr/local/gcc-4.7-20120908/m68k-uclinux/lib/ -isystem
/usr/local/gcc-4.7-20120908/m68k-uclinux/include -isystem
/usr/local/gcc-4.7-20120908/m68k-uclinux/sys-include -msep-data -Wa,-mno-mac -o
conftest conftest.o

\mv cross-gcc-4.7-20120908/gcc/msep-data/crtbegin{-4.7,}.o
\mv cross-gcc-4.7-20120908/gcc/msep-data/crtend{-4.7,}.o

Two new features in GCC 4.7 libgcc/crtstuff.c (was gcc/crtstuff.c in GCC 4.6)
controlled by USE_INITFINI_ARRAY and USE_â_CLONE_REGISTRY:

USE_INITFINI_ARRAY is defined in gcc/config/initfini-array.h if
HAVE_INITFINI_ARRAY_SUPPORT is defined:

#ifdef HAVE_INITFINI_ARRAY_SUPPORT

#define USE_INITFINI_ARRAY

It is not defined in cross-gcc-4.7-20120908/gcc/auto-host.h:

/* #undef HAVE_INITFINI_ARRAY_SUPPORT */

I assume the definition is controlled by the new --enable-initfini-array GCC
configure option.

USE_TM_CLONE_REGISTRY is defined in libgcc/crtstuff.c if it is not already
defined and OBJECT_FORMAT_ELF is defined:

#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
# define USE_TM_CLONE_REGISTRY 1
#endif

This permits USE_TM_CLONE_REGISTRY to be defined as 0 elsewhere to disable the
feature, as is done for OpenVMS/Alpha in gcc/config/alpha/vms.h.

Don't know if -fgnu-tm depends on USE_TM_CLONE_REGISTRY.  (How can it?  It is
only set to 1 in crtstuff.c.)  I'm guessing that code emitted for -fgnu-tm will
fail to link when USE_TM_CLONE_REGISTRY is 0.

Perhaps all that is required is to fix the attributes of section
.tm_clone_table.

In the mean time, apply the same fix used for OpenMVS/Alpha to
gcc/config/m68k/uclinux.h (this patch is good for both GCC 4.7 and GCC 4.8):

--- gcc-4.7/gcc/config/m68k/uclinux.h
+++ gcc-4.7-patched/gcc/config/m68k/uclinux.h
@@ -22,2 +22,4 @@

+/* Do not use TM clone registry.  It breaks -msep-data (-fPIC) code. */
+#define USE_TM_CLONE_REGISTRY 0
 #undef STARTFILE_SPEC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]