This is the mail archive of the gcc-patches@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: [gomp4] Offload option handling


On 10/03/2014 04:31 PM, Andrey Turetskiy wrote:

I've applied your option patch on our offload branch (w/o
'-ftarget-options' switch yet) and it seems to be working fine.
However the patch looks a bit unfinished:

@@ -440,7 +554,11 @@ access_check (const char *name, int mode

  static char*
  prepare_target_image (const char *target, const char *compiler_path,
-      unsigned in_argc, char *in_argv[])
+      unsigned in_argc, char *in_argv[],
+      struct cl_decoded_option *compiler_opts,
+      unsigned int compiler_opt_count,
+      struct cl_decoded_option * /*linker_opts */,
+      unsigned int /*linker_opt_count*/)
  {
    const char **argv;
    struct obstack argv_obstack;
@@ -469,8 +587,6 @@ prepare_target_image (const char *target
    /* Generate temp file name.  */
    filename = make_temp_file (".target.o");

-  /* --------------------------------------  */
-  /* Run gcc for target.  */
    obstack_init (&argv_obstack);
    obstack_ptr_grow (&argv_obstack, compiler);
    obstack_ptr_grow (&argv_obstack, "-o");
@@ -479,6 +595,8 @@ prepare_target_image (const char *target
    for (i = 1; i < in_argc; ++i)
      if (strncmp (in_argv[i], "-fresolution=", sizeof ("-fresolution=") - 1))
        obstack_ptr_grow (&argv_obstack, in_argv[i]);
+
+  append_compiler_options (&argv_obstack, compiler_opts, compiler_opt_count);
    obstack_ptr_grow (&argv_obstack, NULL);

    argv = XOBFINISH (&argv_obstack, const char **);

    argv = XOBFINISH (&argv_obstack, char **);

What do you suppose to do with 'linker_opts'?

Unclear at this point. For ptx, at the moment we don't even perform a linking step. This is likely to change, but even then the host linker options are probably not relevant. Most likely we could scan for things like "-lgfortran" which we could assume must exist on the offload target and pass these down.


Bernd


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