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