This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Offloading Support in libgomp


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]