This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp4] Offload option handling
- From: Andrey Turetskiy <andrey dot turetskiy at gmail dot com>
- To: Bernd Schmidt <bernds at codesourcery dot com>
- Cc: Ilya Verbin <iverbin at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 3 Oct 2014 18:31:22 +0400
- Subject: Re: [gomp4] Offload option handling
- Authentication-results: sourceware.org; auth=none
- References: <20140915162258 dot GA48540 at msticlxl57 dot ims dot intel dot com> <CADB16ZA56oxQTs9J40Pw=OFu=ZJ5rXBqR5pcf0vpWwEijm4rNg at mail dot gmail dot com> <20140917114225 dot GE17454 at tucnak dot redhat dot com> <CADB16ZC0GiFF6rY2SdHz3MuVvA=FT=OzO2=+7OHosgda-zpEJQ at mail dot gmail dot com>
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