This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Offloading Support in libgomp
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: Ilya Verbin <iverbin at gmail dot com>, Kirill Yukhin <kirill dot yukhin at gmail dot com>, Richard Henderson <rth at redhat dot com>, GCC Development <gcc at gcc dot gnu dot org>, triegel at redhat dot com, julian at codesourcery dot com
- Date: Thu, 17 Jul 2014 15:35:36 +0200
- Subject: Re: [RFC] Offloading Support in libgomp
- Authentication-results: sourceware.org; auth=none
- References: <20130910151453 dot GB1817 at tucnak dot redhat dot com> <20130910153053 dot GB2059 at msticlxl57 dot ims dot intel dot com> <20130910153624 dot GD1817 at tucnak dot redhat dot com> <20130910153810 dot GC2059 at msticlxl57 dot ims dot intel dot com> <20130913112930 dot GC30181 at msticlxl57 dot ims dot intel dot com> <87tx6go21t dot fsf at kepler dot schwinge dot homeip dot net> <CADG=Z0FrJdByBEqVHBdFfDBpV+aUrSr9ExeLPpyKdqK=EoTyNg at mail dot gmail dot com> <20140717123712 dot GL31640 at tucnak dot redhat dot com> <87ha2gnnvn dot fsf at schwinge dot name> <87lhrsnncj dot fsf at kepler dot schwinge dot homeip dot net>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jul 17, 2014 at 03:09:32PM +0200, Thomas Schwinge wrote:
> > But I'm not yet sure how we could use this to tie the libgomp plugin
> > search path to the location of libgomp.so... Especially, given that the
> > location of libgomp.so during compilation need not match the location
> > during execution. A show-stopper? (No time currently to explore this in
> > more detail.)
>
> Heh, would a "hack" like the following work?
>
> libcilkrts/runtime/sysdep-unix.c:
>
> /* (Non-static) dummy function is used by get_runtime_path() to find the path
> * to the .so containing the Cilk runtime.
> */
> void dummy_function() { }
>
> /* return a string with the path to the Cilk runtime, or "unknown" if the path
> * cannot be determined.
> */
> static const char *get_runtime_path ()
> {
> #ifdef __CYGWIN__
> // Cygwin doesn't support dladdr, which sucks
> return "unknown";
> #else
> Dl_info info;
> if (0 == dladdr(dummy_function, &info)) return "unknown";
> return info.dli_fname;
> #endif
> }
>
> Putting that into libgomp, it should give the path to the libgomp.so
> actually loaded, and then we can load the plugins relative from its
> dirname?
Well, libgomp has to be far more portable than this, so the question is
if we want to live with one behavior on Linux and another one elsewhere
(fallback to absolute path)? In any case, as last resort it should just try
to dlopen the plugin without full path, and the plugins really should have
libgomp-plugin or something similar in their names to make it less likely
to clash with something else.
If we would be ok with that, then a function to return that would need
to go into config/linux/ and config/posix/.
Jakub