From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125792 invoked by alias); 21 Oct 2015 17:34:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 125333 invoked by uid 89); 21 Oct 2015 17:34:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f175.google.com Received: from mail-ig0-f175.google.com (HELO mail-ig0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 21 Oct 2015 17:34:15 +0000 Received: by igbdj2 with SMTP id dj2so42796932igb.1 for ; Wed, 21 Oct 2015 10:34:13 -0700 (PDT) X-Received: by 10.50.111.79 with SMTP id ig15mr30656991igb.51.1445448853314; Wed, 21 Oct 2015 10:34:13 -0700 (PDT) Received: from msticlxl57.ims.intel.com (jfdmzpr02-ext.jf.intel.com. [134.134.137.71]) by smtp.gmail.com with ESMTPSA id f128sm4115196ioe.13.2015.10.21.10.34.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 10:34:12 -0700 (PDT) Date: Wed, 21 Oct 2015 17:38:00 -0000 From: Ilya Verbin To: Nathan Sidwell , Bernd Schmidt , Jakub Jelinek , "H.J. Lu" Cc: GCC Patches , Kirill Yukhin Subject: Re: Constify host-side offload data` Message-ID: <20151021173350.GA7682@msticlxl57.ims.intel.com> References: <55A70152.8010702@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55A70152.8010702@acm.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg02121.txt.bz2 Hi! On Wed, Jul 15, 2015 at 20:56:50 -0400, Nathan Sidwell wrote: > --- libgcc/offloadstuff.c (revision 225851) > +++ libgcc/offloadstuff.c (working copy) > ... > -void *__offload_func_table[0] > +const void *const __offload_func_table[0] > ... > -void *__offload_var_table[0] > +const void *const __offload_var_table[0] I've just noticed that this patch + similar change in intelmic-mkoffload.c bumps up the filesize of "helloworld" with offloading to MIC from 17KB to 4MB! This happens because .gnu.offload_{funcs,vars} sections in crtoffload{begin,end}.o now doesn't have WRITE flag, but the same sections produced by omp_finish_file has it. When linker joins writable + nonwritable sections from several objects, it inserts some weird 2MB offset into the final binary. I.e. now there are 2 such offsets: one in the host binary and one in the MIC target image, hence 4MB. I haven't investigated how it happens, because I thing it's bad idea to join sections with different flags. But we can't make .gnu.offload_{funcs,vars} in omp_finish_file also readonly, because in case of shared libraries there are R_X86_64_RELATIVE relocations, which make these sections writable. So, I guess we need to remove all consts to make these sections writable in all objects. H.J., Maybe linker should print some warning about joining writable + nonwritable sections? Here is a simple testcase: $ cat t1.s .section ".AAA", "a" .long 0x12345678 $ cat t2.s .section ".AAA", "wa" .long 0x12345678 $ as t1.s -o t1.o $ as t2.s -o t2.o $ ld -shared t1.o t2.o $ ls -lh a.out 2.1M a.out -- Ilya