From patchwork Wed Jan 8 07:59:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Ye X-Patchwork-Id: 22934 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8B4AB202E0 for ; Wed, 8 Jan 2014 07:59:57 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id e16sf1702935qcx.1 for ; Tue, 07 Jan 2014 23:59:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:from:to:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:content-type :content-transfer-encoding; bh=cdjQlX19H7+P4kOXO+ectnZeEogzzY8HR5S3tUNrJ9w=; b=msUB/Zhi10e+Rg4RJwWZIygnGF9HICG0eRbh8HUv0I9zQnwznxiRjAVX8ZyFz7gsXG RAoFyoIo3RoZQodW11P464SXXChjqhS/+ghSHeN2/Awovc2tqoH13kG4ZZWPfjlc9mOF VXfNLh5/CDwskQFYeQLLl02pkEX+s1/avMFez2MpyMj5E+lGbeynmpakfuCbThIpt32/ Mr9yKHnWIwH25oyFll1SJhn1FBEbpLxS78j0SLrxt/XsvIaEzQx8wruG9p7PekL/A0Nx a/29zQvsyuxBo8GQQM4lwOQ4pnsK8ogogUWiau07maHnKBSaD2LrXHaBdLg76pRfBLbK VOvQ== X-Gm-Message-State: ALoCoQkfzzhpUWUdx2Gli9cPFJ1ShY2fFXIOxoWKwjIXjiadsrNugvK7XeHqyH86lA/msBJgbtY5 X-Received: by 10.236.128.243 with SMTP id f79mr525259yhi.27.1389167996800; Tue, 07 Jan 2014 23:59:56 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.41.66 with SMTP id d2ls475689qel.10.gmail; Tue, 07 Jan 2014 23:59:56 -0800 (PST) X-Received: by 10.49.12.43 with SMTP id v11mr205228172qeb.50.1389167996663; Tue, 07 Jan 2014 23:59:56 -0800 (PST) Received: from mail-vb0-x234.google.com (mail-vb0-x234.google.com [2607:f8b0:400c:c02::234]) by mx.google.com with ESMTPS id r5si68666qat.160.2014.01.07.23.59.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Jan 2014 23:59:56 -0800 (PST) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::234 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::234; Received: by mail-vb0-f52.google.com with SMTP id p5so885283vbn.25 for ; Tue, 07 Jan 2014 23:59:56 -0800 (PST) X-Received: by 10.58.46.8 with SMTP id r8mr9553566vem.11.1389167996091; Tue, 07 Jan 2014 23:59:56 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp209651ved; Tue, 7 Jan 2014 23:59:55 -0800 (PST) X-Received: by 10.68.34.37 with SMTP id w5mr20201107pbi.159.1389167995179; Tue, 07 Jan 2014 23:59:55 -0800 (PST) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id nu8si63008pbb.192.2014.01.07.23.59.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jan 2014 23:59:55 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-359092-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 3938 invoked by alias); 8 Jan 2014 07:59:41 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 3924 invoked by uid 89); 8 Jan 2014 07:59:40 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 08 Jan 2014 07:59:38 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 08 Jan 2014 07:59:36 +0000 Received: from E103005 ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 8 Jan 2014 07:59:33 +0000 From: "Joey Ye" To: Subject: [PATCH] [doc] Update plugin doc Date: Wed, 8 Jan 2014 15:59:19 +0800 Message-ID: <000001cf0c47$897a78f0$9c6f6ad0$@arm.com> MIME-Version: 1.0 X-MC-Unique: 114010807593600201 X-Original-Sender: joey.ye@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::234 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Update plugin document after switching to C++, also make it more friendly to cross-build. ChangeLog: 2014-01-08 Joey Ye doc/plugin.texi (Building GCC plugins): Update to C++. OK to trunk? diff --git a/gcc/doc/plugins.texi b/gcc/doc/plugins.texi index fc2d754..e668de6 100644 --- a/gcc/doc/plugins.texi +++ b/gcc/doc/plugins.texi @@ -465,18 +465,18 @@ integer numbers, so a plugin could ensure it is built for GCC 4.7 with The following GNU Makefile excerpt shows how to build a simple plugin: @smallexample -GCC=gcc -PLUGIN_SOURCE_FILES= plugin1.c plugin2.c -PLUGIN_OBJECT_FILES= $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES)) -GCCPLUGINS_DIR:= $(shell $(GCC) -print-file-name=plugin) -CFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -O2 - -plugin.so: $(PLUGIN_OBJECT_FILES) - $(GCC) -shared $^ -o $@@ +HOST_GCC=g++ +TARGET_GCC=gcc +PLUGIN_SOURCE_FILES= plugin1.c plugin2.cc +GCCPLUGINS_DIR:= $(shell $(TARGET_GCC) -print-file-name=plugin) +CXXFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -fno-rtti -O2 + +plugin.so: $(PLUGIN_SOURCE_FILES) + $(HOST_GCC) -shared $(CXXFLAGS) $^ -o $@@ @end smallexample -A single source file plugin may be built with @code{gcc -I`gcc --print-file-name=plugin`/include -fPIC -shared -O2 plugin.c -o +A single source file plugin may be built with @code{g++ -I`gcc +-print-file-name=plugin`/include -fPIC -shared -fno-rtti -O2 plugin.c -o plugin.so}, using backquote shell syntax to query the @file{plugin} directory.