[PATCH,take2] Make LTO plugin object-file-format- and host- independent.

Dave Korn dave.korn.cygwin@gmail.com
Thu Oct 14 07:38:00 GMT 2010


On 12/10/2010 14:36, Richard Sandiford wrote:
> Hi Dave,
> 
> Sorry if this is a dup, but...
> 
> Dave Korn <dave.korn.cygwin@gmail.com> writes:
>> 	* configure.ac: Source config.gcc to determine lto_binary_reader.
> 
> ...I've been experimenting with some ARM builds and noticed that this
> doesn't quite work with options like --with-cpu.  The problem is that
> config.gcc validates the option against ${srcdir}/config/arm/arm-cores.def
> and exits the configure script if it can't find the file.
> 
> It's a little (read "very") hackish, but how about the following?
> Tested on arm-linux-gnueabi using --with-cpu=cortex-a8.  Alternatively,
> we could add a new m4 macro for setting lto_binary_reader.

  I reckon there are so few targets to which any of this applies that it's not
worth busting a gut over.  I'm planning on just doing this in the patch that
makes the coff lto-plugin work:

Index: lto-plugin/configure.ac
===================================================================
--- lto-plugin/configure.ac	(revision 165450)
+++ lto-plugin/configure.ac	(working copy)
@@ -10,14 +10,27 @@ AC_ARG_VAR(LIBELFLIBS,[How to link libelf])
 AC_ARG_VAR(LIBELFINC,[How to find libelf include files])
 AM_PROG_LIBTOOL
 AC_SUBST(target_noncanonical)
-. ${srcdir}/../gcc/config.gcc
-case ${lto_binary_reader} in
-  *coff*) LTO_FORMAT=coff ;;
-  *elf*)  LTO_FORMAT=elf ;;
-  *) AC_MSG_ERROR([LTO plugin is not supported on this target.]) ;;
+# Trying to get this information from gcc's config is tricky.
+case $target in
+  x86_64*-mingw*)
+    SYM_STYLE=elf
+    LTO_FORMAT=coff
+    COFFENDIAN=-DCOFFENDIAN=0
+    ;;
+  *-cygwin* | *-mingw* )
+    SYM_STYLE=win32
+    LTO_FORMAT=coff
+    COFFENDIAN=-DCOFFENDIAN=0
+    ;;
+  *)
+    SYM_STYLE=elf
+    LTO_FORMAT=elf
+    COFFENDIAN=
+    ;;
 esac
-
+AC_SUBST(SYM_STYLE)
 AC_SUBST(LTO_FORMAT)
+AC_SUBST(COFFENDIAN)
 AC_TYPE_UINT64_T
 AC_CONFIG_FILES(Makefile)
 AC_OUTPUT


  Once I realised I was going to need a couple of other pieces of information
that I couldn't get from groping about in config.gcc anyway, the whole pain
seemed just more trouble than it was worth.  Makes sense to you?

    cheers,
      DaveK




More information about the Gcc-patches mailing list