From patchwork Tue Mar 25 19:28:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 333690 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0F43B140081 for ; Wed, 26 Mar 2014 06:29:13 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=ThcuUoffz7DtLqSBh5osyb4jZ2Hyr 8eKGnb2cSfA+IcEdrR5DwVmW+j/kCqeC0LpfoUw5rzZB5iOQ+zXlyh3ZBsgnZk4s Hs+Zi+864OAzYowat5sGt+rHRQe8TlHhQ1b8YIAEEq6MKL+sgGfLPtoNMHnu7w27 iI1z0zG55WiGdQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=Swy7Oi38phR2E7sc9chop9FOGUc=; b=Irw 4c5ORJS6WDpdx9Roc74vxlPHMsVdG2Lppv9lXvna1dSySC2WTW0JpgZd+grolDJa J8bs23CZHIeszDO8f33BYAEN/riAxhrxn/vz8BaR1MZaxB6O8PGtmGvWcNjy2gxQ XCv+fKTeUCvuGHNDYU9jCF0OvRZ1yLH/SGadA/pY= Received: (qmail 20908 invoked by alias); 25 Mar 2014 19:29:05 -0000 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 Received: (qmail 20888 invoked by uid 89); 25 Mar 2014 19:29:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Mar 2014 19:29:03 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2PJT1pC028174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Mar 2014 15:29:01 -0400 Received: from tucnak.zalov.cz (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s2PJSxQK032169 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Mar 2014 15:29:00 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.8/8.14.7) with ESMTP id s2PJSvAM021720; Tue, 25 Mar 2014 20:28:58 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.8/8.14.8/Submit) id s2PJSutl021719; Tue, 25 Mar 2014 20:28:56 +0100 Date: Tue, 25 Mar 2014 20:28:56 +0100 From: Jakub Jelinek To: Paolo Bonzini , DJ Delorie , Alexandre Oliva , Ralf Wildenhues , Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix --with-build-config=bootstrap-ubsan bootstrap of lto-plugin (PR sanitizer/56781) Message-ID: <20140325192856.GW1817@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi! lto-plugin is another problematic directory in asan/ubsan bootstraps. Unlike fixincludes, it is bootstrapped, and like fixincludes it is also linked against host libiberty. The problem for lto-plugin is that the -static-libubsan -fsanitize=undefined -B/some/path/to/libsanitizer/ -B/some/path/to/libsanitizer/ubsan/.libs/ switches are eaten by libtool, which throws them away on the floor. We apparently have libtool-ldflags which is used by other libraries to filter some options so that libtool doesn't eat them, but even after applying the lto-plugin/Makefile.am changes I got failures, because while -fsanitize=undefined now made it through, the rest of the options didn't. So, this patch also tweaks libtool-ldflags to handle some more options. Bootstrapped/regtested on x86_64-linux (normally) and i686-linux (--with-build-config=bootstrap-ubsan). Ok for trunk? 2014-03-25 Jakub Jelinek PR sanitizer/56781 * libtool-ldflags: Also prefix -static-lib*, -shared-lib* and -B* options with -Xcompiler. lto-plugin/ * Makefile.am (LTLDFLAGS, liblto_plugin_la_LINK): New variables. * Makefile.in: Regenerated. Jakub --- libtool-ldflags.jj 2008-09-05 12:59:51.000000000 +0200 +++ libtool-ldflags 2014-03-25 15:43:36.726185093 +0100 @@ -2,7 +2,7 @@ # Script to translate LDFLAGS into a form suitable for use with libtool. -# Copyright (C) 2005 Free Software Foundation, Inc. +# Copyright (C) 2005-2014 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -36,14 +36,15 @@ prev_arg= for arg do case $arg in - -f*|--*) + -f*|--*|-static-lib*|-shared-lib*|-B*) # Libtool does not ascribe any special meaning options # that begin with -f or with a double-dash. So, it will # think these options are linker options, and prefix them # with "-Wl,". Then, the compiler driver will ignore the # options. So, we prefix these options with -Xcompiler to # make clear to libtool that they are in fact compiler - # options. + # options. Similarly for e.g. -static-libstdc++, or + # -B/some/path. case $prev_arg in -Xpreprocessor|-Xcompiler|-Xlinker) # This option is already prefixed; don't prefix it again. --- lto-plugin/Makefile.am.jj 2014-03-17 20:01:54.000000000 +0100 +++ lto-plugin/Makefile.am 2014-03-25 15:46:26.832294118 +0100 @@ -18,6 +18,7 @@ in_gcc_libs = $(foreach lib, $(libexecsu # Can be removed when libiberty becomes a normal convenience library Wc=-Wc, +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) liblto_plugin_la_SOURCES = lto-plugin.c liblto_plugin_la_LIBADD = \ @@ -28,6 +29,9 @@ liblto_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a) liblto_plugin_la_DEPENDENCIES = $(if $(wildcard \ ../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,) +liblto_plugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(liblto_plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@ all-local: $(in_gcc_libs) --- lto-plugin/Makefile.in.jj 2014-03-17 20:01:54.000000000 +0100 +++ lto-plugin/Makefile.in 2014-03-25 15:47:10.059071353 +0100 @@ -84,9 +84,6 @@ am__installdirs = "$(DESTDIR)$(libexecsu LTLIBRARIES = $(libexecsub_LTLIBRARIES) am_liblto_plugin_la_OBJECTS = lto-plugin.lo liblto_plugin_la_OBJECTS = $(am_liblto_plugin_la_OBJECTS) -liblto_plugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(liblto_plugin_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = am__depfiles_maybe = @@ -239,6 +236,7 @@ in_gcc_libs = $(foreach lib, $(libexecsu # Can be removed when libiberty becomes a normal convenience library Wc = -Wc, +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) liblto_plugin_la_SOURCES = lto-plugin.c liblto_plugin_la_LIBADD = \ $(if $(wildcard ../libiberty/pic/libiberty.a),$(Wc)../libiberty/pic/libiberty.a,) @@ -251,6 +249,10 @@ liblto_plugin_la_LDFLAGS = $(AM_LDFLAGS) liblto_plugin_la_DEPENDENCIES = $(if $(wildcard \ ../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,) +liblto_plugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(liblto_plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@ + all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am