From patchwork Thu May 8 09:43:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 346960 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 8C77E140088 for ; Thu, 8 May 2014 19:44:09 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=svVSKCJCGuSh67d5 w733JRsILGJXKiUuqF5cghaD93vPT9sxTnx/dYN54G8Huum1czCSshQvV+Yvrqr4 /rF83+2wHEjrx5JPLNHMovCn8eupL9RVKnmHA+hpLx8kEhLZ+5vJEtLHGoXKI4yl wtbOjJ5iX0Vcgh09IBbMwqAjUwA= 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:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=bu70XvLKkzYUOQ8QrK5JpU 18vE4=; b=ZXtgexahW2frHMK/wy0xht8OSU3x6UO9bohZelaLhO2elitXCPst1L f3zmVL4CJEzgvTYLT4hsN3wRqU85hQ6IfSMYYG7THikXGbvFVVbRU7udeAE3rvvF 5sFoBdYc3lNEmkz2W5el+9j11maPqvu2VTj8JM5CMqOUF8Gp0cu/M= Received: (qmail 14997 invoked by alias); 8 May 2014 09:44:01 -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 14983 invoked by uid 89); 8 May 2014 09:44:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 May 2014 09:44:00 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WiKrr-0003rw-8r from Thomas_Schwinge@mentor.com ; Thu, 08 May 2014 02:43:55 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 8 May 2014 02:43:55 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Thu, 8 May 2014 10:43:52 +0100 From: Thomas Schwinge To: "Michael V. Zolotukhin" CC: Jakub Jelinek , Bernd Schmidt , Richard Biener , Kirill Yukhin , Ilya Verbin , Andrey Turetskiy , Ilya Tocar , gcc Subject: [gomp4] Mark __OPENMP_TARGET__ as addressable (was: Offloading patches (2/3): Add tables generation) In-Reply-To: <20131217113957.GA39975@msticlxl57.ims.intel.com> References: <20131217113957.GA39975@msticlxl57.ims.intel.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Thu, 8 May 2014 11:43:43 +0200 Message-ID: <87vbtgy59s.fsf@schwinge.name> MIME-Version: 1.0 Hi! On Tue, 17 Dec 2013 15:39:57 +0400, "Michael V. Zolotukhin" wrote: > in this patch we > start to pass '__OPENMP_TARGET__' symbol to GOMP_target calls. > --- a/gcc/omp-low.c > +++ b/gcc/omp-low.c > @@ -8371,19 +8372,22 @@ expand_omp_target (struct omp_region *region) > } > > gimple g; > - /* FIXME: This will be address of > - extern char __OPENMP_TARGET__[] __attribute__((visibility ("hidden"))) > - symbol, as soon as the linker plugin is able to create it for us. */ > - tree openmp_target = build_zero_cst (ptr_type_node); > + tree openmp_target > + = build_decl (UNKNOWN_LOCATION, VAR_DECL, > + get_identifier ("__OPENMP_TARGET__"), ptr_type_node); > + TREE_PUBLIC (openmp_target) = 1; > + DECL_EXTERNAL (openmp_target) = 1; > if (kind == GF_OMP_TARGET_KIND_REGION) > { > tree fnaddr = build_fold_addr_expr (child_fn); > - g = gimple_build_call (builtin_decl_explicit (start_ix), 7, > - device, fnaddr, openmp_target, t1, t2, t3, t4); > + g = gimple_build_call (builtin_decl_explicit (start_ix), 7, device, > + fnaddr, build_fold_addr_expr (openmp_target), > + t1, t2, t3, t4); In the trunk into gomp-4_0-branch merge that I'm currently preparing, all offloading usage results in an ICE like: spawn [...]/build/gcc/xgcc -B[...]/build/gcc/ [...]/source/libgomp/testsuite/libgomp.c/target-1.c -B[...]/build/x86_64-unknown-linux-gnu/./libgomp/ -B[...]/build/x86_64-unknown-linux-gnu/./libgomp/.libs -I[...]/build/x86_64-unknown-linux-gnu/./libgomp -I[...]/source/libgomp/testsuite/.. -fmessage-length=0 -fno-diagnostics-show-caret -fdiagnostics-color=never -fopenmp -O2 -L[...]/build/x86_64-unknown-linux-gnu/./libgomp/.libs -lm -o ./target-1.exe [...]/source/libgomp/testsuite/libgomp.c/target-1.c: In function 'fn2': [...]/source/libgomp/testsuite/libgomp.c/target-1.c:46:3: error: address taken, but ADDRESSABLE bit not set __OPENMP_TARGET__ [...]/source/libgomp/testsuite/libgomp.c/target-1.c:35:11: note: in statement __builtin_GOMP_target_data (-1, &__OPENMP_TARGET__, 1, &.omp_data_arr.12, &.omp_data_sizes.13, &.omp_data_kinds.14); [...]/source/libgomp/testsuite/libgomp.c/target-1.c:46:3: error: address taken, but ADDRESSABLE bit not set __OPENMP_TARGET__ [...]/source/libgomp/testsuite/libgomp.c/target-1.c:37:13: note: in statement __builtin_GOMP_target (-1, fn2._omp_fn.0, &__OPENMP_TARGET__, 6, &.omp_data_arr.6, &.omp_data_sizes.7, &.omp_data_kinds.8); [...]/source/libgomp/testsuite/libgomp.c/target-1.c:46:3: error: address taken, but ADDRESSABLE bit not set __OPENMP_TARGET__ [...]/source/libgomp/testsuite/libgomp.c/target-1.c:44:13: note: in statement __builtin_GOMP_target_update (-1, &__OPENMP_TARGET__, 2, &.omp_data_arr.9, &.omp_data_sizes.10, &.omp_data_kinds.11); [...]/source/libgomp/testsuite/libgomp.c/target-1.c:46:3: internal compiler error: verify_gimple failed 0xa149ec verify_gimple_in_cfg(function*, bool) ../../source/gcc/tree-cfg.c:4954 0x93a407 execute_function_todo ../../source/gcc/passes.c:1777 0x93ad63 execute_todo ../../source/gcc/passes.c:1834 In r210207, I committed the following patch; should we also be setting any additional flags, such as DECL_ARTIFICIAL? commit aaf964a67612f5aa50b405d2aa7998ed3b5d5ac6 Author: tschwinge Date: Thu May 8 09:41:33 2014 +0000 Mark __OPENMP_TARGET__ as addressable. gcc/ * omp-low.c (get_offload_symbol_decl): Mark __OPENMP_TARGET__ as addressable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@210207 138bc75d-0d04-0410-961f-82ee72b054a4 Grüße, Thomas diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index 1bd1f51..b1e73c0 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,3 +1,8 @@ +2014-05-08 Thomas Schwinge + + * omp-low.c (get_offload_symbol_decl): Mark __OPENMP_TARGET__ as + addressable. + 2014-04-04 Bernd Schmidt * lto-wrapper.c (replace_special_characters): Remove functions and diff --git gcc/omp-low.c gcc/omp-low.c index de00516..5e90ce3 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -233,6 +233,7 @@ get_offload_symbol_decl (void) tree decl = build_decl (UNKNOWN_LOCATION, VAR_DECL, get_identifier ("__OPENMP_TARGET__"), ptr_type_node); + TREE_ADDRESSABLE (decl) = 1; TREE_PUBLIC (decl) = 1; DECL_EXTERNAL (decl) = 1; DECL_WEAK (decl) = 1;