From patchwork Thu Oct 14 05:54:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Korn X-Patchwork-Id: 67784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 5C5DFB70EB for ; Thu, 14 Oct 2010 16:31:59 +1100 (EST) Received: (qmail 25947 invoked by alias); 14 Oct 2010 05:31:55 -0000 Received: (qmail 25937 invoked by uid 22791); 14 Oct 2010 05:31:53 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Oct 2010 05:31:47 +0000 Received: by wyb40 with SMTP id 40so2162856wyb.20 for ; Wed, 13 Oct 2010 22:31:45 -0700 (PDT) Received: by 10.216.136.27 with SMTP id v27mr970231wei.12.1287034305126; Wed, 13 Oct 2010 22:31:45 -0700 (PDT) Received: from [192.168.2.99] (cpc2-cmbg8-0-0-cust61.5-4.cable.virginmedia.com [82.6.108.62]) by mx.google.com with ESMTPS id x3sm4817898weq.8.2010.10.13.22.31.43 (version=SSLv3 cipher=RC4-MD5); Wed, 13 Oct 2010 22:31:43 -0700 (PDT) Message-ID: <4CB69B25.8050106@gmail.com> Date: Thu, 14 Oct 2010 06:54:45 +0100 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Dave Korn , GCC Patches , richard.sandiford@linaro.org Subject: Re: [PATCH, take2] Make LTO plugin object-file-format- and host- independent. References: <4CAC37E8.9060504@gmail.com> In-Reply-To: Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 12/10/2010 14:36, Richard Sandiford wrote: > Hi Dave, > > Sorry if this is a dup, but... > > Dave Korn 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: 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 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