This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][RFC][Offloading] Fix PR68463
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ilya Verbin <iverbin at gmail dot com>
- Cc: bschmidt at redhat dot com, gcc-patches at gcc dot gnu dot org, kirill dot yukhin at gmail dot com, thomas at codesourcery dot com, Richard Biener <rguenther at suse dot de>
- Date: Fri, 19 Feb 2016 15:53:08 +0100
- Subject: Re: [PATCH][RFC][Offloading] Fix PR68463
- Authentication-results: sourceware.org; auth=none
- References: <20160114212601 dot GA48907 at msticlxl57 dot ims dot intel dot com> <alpine dot LSU dot 2 dot 11 dot 1601150909260 dot 31122 at t29 dot fhfr dot qr> <20160118203338 dot GA33054 at msticlxl57 dot ims dot intel dot com> <alpine dot LSU dot 2 dot 11 dot 1601190956300 dot 31122 at t29 dot fhfr dot qr> <20160119093628 dot GH3017 at tucnak dot redhat dot com> <20160119133213 dot GA20979 at msticlxl57 dot ims dot intel dot com> <20160210171934 dot GA30239 at msticlxl57 dot ims dot intel dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Feb 10, 2016 at 08:19:34PM +0300, Ilya Verbin wrote:
> This patch adds crtoffload{begin,end}.o to all -fopenmp programs, if they exist.
> I couldn't think of a better solution...
> Tested using the testcase from the previous mail, e.g.:
>
> $ gcc -DNUM=1 -c -fopenmp test.c -o obj1.o
> $ gcc -DNUM=2 -c -fopenmp test.c -o obj2.o
> $ gcc -DNUM=3 -c -fopenmp test.c -o obj3.o
> $ gcc -DNUM=4 -c -fopenmp test.c -o obj4.o -flto
> $ gcc -DNUM=5 -c -fopenmp test.c -o obj5.o
> $ gcc -DNUM=6 -c -fopenmp test.c -o obj6.o -flto
> $ gcc -DNUM=7 -c -fopenmp test.c -o obj7.o
> $ gcc-ar -cvq libtest.a obj3.o obj4.o obj5.o
> $ gcc -fopenmp main.c obj1.o obj2.o libtest.a obj6.o obj7.o
>
> And other combinations.
Looking at this, I think I have no problem with crtoffloadbegin.o being
included in all -fopenmp/-fopenacc linked programs/shared libraries,
that just defines the symbols and nothing else.
I have no problem with the
__offload_funcs_end/__offload_vars_end part of crtoffloadend.o being
included too.
But, I really don't like __OFFLOAD_TABLE__ being added to all programs, that
wastes real space in data (rodata or relro?) section, and dynamic
relocations.
So, perhaps, can we split offloadstuff.c into 3 objects instead of 2,
crtoffload{begin,end,table}.o*, where the last one would be what
defines __OFFLOAD_TABLE__, and add the last one only by the linker
plugin/lto-wrapper/whatever, if any input objects had any offloading stuff
in it?
Jakub