Hi!

On Fri, 4 Apr 2014 11:30:49 +0200, Bernd Schmidt <ber...@codesourcery.com> 
wrote:
> On 03/21/2014 04:20 PM, Jakub Jelinek wrote:
> > On Fri, Mar 21, 2014 at 04:13:45PM +0100, Bernd Schmidt wrote:
> >> On 03/20/2014 07:56 PM, Jakub Jelinek wrote:
> >>> When we were discussing the design last year, my strong preference was 
> >>> that
> >>> either this lives in some other crt object that mkoffload/linker plugin 
> >>> adds
> >>> to link, or that it would be completely mkoffload synthetized.
> >>
> >> mkoffload is only concerned with generating target images. These
> >> fragments are for the host tables.
> >>
> >> How's this? It moves everything to ompbegin.o/ompend.o and only
> >> links in these files if we have produced at least one target offload
> >> image.
> >
> > I'd call the files crtompbegin.o/crtompend.o instead.

I'd go with crtoffload* (or similar).  ;-)


> > Also, supposedly if you've used section names without . in them, the linker
> > itself would provide the symbols automatically and you wouldn't actually
> > need begin/end, but just one object that would reference the linker created
> > symbols.  Just use say __gnu_offload_whatever__ or similar section names.
> 
> I've checked in the following which should address all this.

Is it a linker bug that I need to add something like the following?

--- libgcc/ompstuff.c
+++ libgcc/ompstuff.c
@@ -40,6 +40,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
 #include "libgcc_tm.h"
 
 #if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
+# if 1
+/* TODO: Without the following, will get missing symbols for __start_* and
+   __stop_*.  Linker bug?  */
+static void *_funcs[0] __attribute__ ((section ("__gnu_offload_funcs"))) = { };
+static void *_vars[0] __attribute__ ((section ("__gnu_offload_vars"))) = { };
+# endif
 extern void __start___gnu_offload_funcs;
 extern void __stop___gnu_offload_funcs;
 extern void __start___gnu_offload_vars;

    $ ld --version
    GNU ld (Sourcery CodeBench 2013.11-17) 2.23.52.20130912
    [...]


> --- libgcc/ompstuff.c (revision 0)
> +++ libgcc/ompstuff.c (working copy)

> +extern void __start___gnu_offload_funcs;
> +extern void __stop___gnu_offload_funcs;
> +extern void __start___gnu_offload_vars;
> +extern void __stop___gnu_offload_vars;
> +void *__OPENMP_TARGET__[] __attribute__ ((__visibility__ ("hidden"))) =
> +{
> +  &__start___gnu_offload_funcs, &__stop___gnu_offload_funcs,
> +  &__start___gnu_offload_vars, &__stop___gnu_offload_vars
> +};

    ../../../source/libgcc/ompstuff.c:49:3: warning: taking address of 
expression of type 'void'
       &__start___gnu_offload_funcs, &__stop___gnu_offload_funcs,
       ^
    ../../../source/libgcc/ompstuff.c:49:33: warning: taking address of 
expression of type 'void'
       &__start___gnu_offload_funcs, &__stop___gnu_offload_funcs,
                                     ^
    ../../../source/libgcc/ompstuff.c:50:3: warning: taking address of 
expression of type 'void'
       &__start___gnu_offload_vars, &__stop___gnu_offload_vars
       ^
    ../../../source/libgcc/ompstuff.c:50:32: warning: taking address of 
expression of type 'void'
       &__start___gnu_offload_vars, &__stop___gnu_offload_vars
                                    ^

s%void%char makes this go away.


Grüße,
 Thomas

Attachment: pgpPQxXD1zF2u.pgp
Description: PGP signature

Reply via email to