diff mbox

[gomp4] Add tables generation

Message ID 87ioqsi0w8.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge April 2, 2014, 8:36 a.m. UTC
Hi!

On Wed, 02 Apr 2014 09:34:29 +0200, I wrote:
> On Thu, 20 Mar 2014 17:50:13 +0100, Bernd Schmidt <bernds@codesourcery.com> wrote:
> > This is based on Michael Zolotukhin's patch 2/3 from a while ago. It 
> > adds functionality to build function/variable tables that will allow 
> > libgomp to look up offload target code based on the address of the 
> > corresponding host function. There are two alternatives, one based on 
> > named sections, and one based on a target hook when named sections are 
> > unavailable (as on ptx).
> > 
> > Committed on gomp-4_0-branch.
> 
> I see regressions in the libgomp testsuite for configurations where
> offloading is not enabled:
> 
>     spawn [...]/build/gcc/xgcc -B[...]/build/gcc/ [...]/source/libgomp/testsuite/libgomp.c/for-3.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 -std=gnu99 -fopenmp -L[...]/build/x86_64-unknown-linux-gnu/./libgomp/.libs -lm -o ./for-3.exe
>     /tmp/ccGnT0ei.o: In function `main':
>     for-3.c:(.text+0x21032): undefined reference to `__OPENMP_TARGET__'
>     collect2: error: ld returned 1 exit status
> 
> I suppose that's because [...]

Workaround committed in r209015:

commit 6a015f81a5fafe32cf45656e3de121f4088dbf41
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Apr 2 08:29:17 2014 +0000

    Work around __OPENMP_TARGET__ not being defined for !ENABLE_OFFLOADING.
    
    	libgcc/
    	* crtstuff.c [!ENABLE_OFFLOADING] (__OPENMP_TARGET__): Define to
    	NULL.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@209015 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgcc/ChangeLog.gomp | 10 ++++++++++
 libgcc/crtstuff.c     |  2 ++
 2 files changed, 12 insertions(+)


> Also, I'd suggest to rename __OPENMP_TARGET__ (and similar ones) to
> __GNU_OFFLOAD__ (or similar).  As we're using this offloading stuff for
> both OpenACC and OpenMP target, it makes sense to me to use a generic
> name; we still have the chance to do so now while this stuff is not yet
> in trunk.


Grüße,
 Thomas
diff mbox

Patch

diff --git libgcc/ChangeLog.gomp libgcc/ChangeLog.gomp
new file mode 100644
index 0000000..7d08efa
--- /dev/null
+++ libgcc/ChangeLog.gomp
@@ -0,0 +1,10 @@ 
+2014-04-02  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* crtstuff.c [!ENABLE_OFFLOADING] (__OPENMP_TARGET__): Define to
+	NULL.
+
+Copyright (C) 2014 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git libgcc/crtstuff.c libgcc/crtstuff.c
index cda0bae..79af7f0 100644
--- libgcc/crtstuff.c
+++ libgcc/crtstuff.c
@@ -775,6 +775,8 @@  void *__OPENMP_TARGET__[] __attribute__ ((__visibility__ ("protected"))) =
   &_omp_func_table, &_omp_funcs_end,
   &_omp_var_table, &_omp_vars_end
 };
+#else
+void **__OPENMP_TARGET__ __attribute__ ((__visibility__ ("protected"))) = NULL;
 #endif