[gomp4] Offload option handling
Andrey Turetskiy
andrey.turetskiy@gmail.com
Fri Oct 3 14:31:00 GMT 2014
On Wed, Sep 17, 2014 at 5:11 PM, Andrey Turetskiy
<andrey.turetskiy@gmail.com> wrote:
> On Wed, Sep 17, 2014 at 3:19 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
>> I have no objections to supporting a -ftarget-options switch. I had posted a
>> patch a while ago that looked somewhat similar, but also contained an
>> automatic translation step from things like -march=x86_64 to a generic
>> -foffload-abi=lp64. I still think such a mechanism is desirable.
>
> I'm going to apply your patch on '-ftarget-options' stuff and check if
> it works together.
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'?
Do you want to call 'append_linker_options (&argv_obstack,
linker_opts, linker_opt_count, false)'? That would explain why you
have 'include_target_options' argument in the function.
--
Best regards,
Andrey Turetskiy
More information about the Gcc-patches
mailing list