This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC][gomp4] Offloading patches (3/3): Add invocation of target compiler
- From: Bernd Schmidt <bernds at codesourcery dot com>
- To: "Michael V. Zolotukhin" <michael dot v dot zolotukhin at gmail dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Thomas Schwinge <thomas at codesourcery dot com>, Richard Biener <rguenther at suse dot de>, Kirill Yukhin <kirill dot yukhin at gmail dot com>, Ilya Verbin <iverbin at gmail dot com>, Andrey Turetskiy <andrey dot turetskiy at gmail dot com>, Ilya Tocar <tocarip dot intel at gmail dot com>, gcc <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 20 Dec 2013 16:28:40 +0100
- Subject: Re: [RFC][gomp4] Offloading patches (3/3): Add invocation of target compiler
- Authentication-results: sourceware.org; auth=none
- References: <20131217114251 dot GB39975 at msticlxl57 dot ims dot intel dot com>
On 12/17/2013 12:42 PM, Michael V. Zolotukhin wrote:
> Hi everybody,
>
> Here is a patch 3/3: Add invocation of target compiler.
> + /* Run objcopy on TARGET_IMAGE_FILE_NAME. */
> + buf1 = (char*) xmalloc (strlen (".data=.")
> + + strlen (OFFLOAD_IMAGE_SECTION_NAME) + 1);
> + if (!buf1)
> + return NULL;
> + sprintf (buf1, ".data=%s", OFFLOAD_IMAGE_SECTION_NAME);
> + obstack_init (&argv_obstack);
> + obstack_ptr_grow (&argv_obstack, "objcopy");
> + obstack_ptr_grow (&argv_obstack, "-B");
> + obstack_ptr_grow (&argv_obstack, "i386");
> + obstack_ptr_grow (&argv_obstack, "-I");
> + obstack_ptr_grow (&argv_obstack, "binary");
> + obstack_ptr_grow (&argv_obstack, "-O");
> + /* TODO: Properly handle 32-bit mode. */
> + obstack_ptr_grow (&argv_obstack, "elf64-x86-64");
> + obstack_ptr_grow (&argv_obstack, target_image_file_name);
> + obstack_ptr_grow (&argv_obstack, "--rename-section");
> + obstack_ptr_grow (&argv_obstack, buf1);
> + obstack_ptr_grow (&argv_obstack, NULL);
> +
> + argv = XOBFINISH (&argv_obstack, const char **);
This patch seems to make rather too many assumptions about host and
target compilers. Certainly code like this can't go into
target-independent code like lto-wrapper. Also, I'm not sure you can
assume you'll get ELF files out of the OpenACC target compiler; I'd very
prefer a solution that doesn't rely on objcopy.
Bernd