Commit ad65b427 by H.J. Lu Committed by Thomas Schwinge

[PR87833] x86: Put -fPIC and -shared the last to create offload image

On x86, since -fPIC and -shared should be used to create offload image,
we put them the last to properly create offload image.

2019-11-11  H.J. Lu  <hjl.tools@gmail.com>

	PR target/87833
	* config/i386/intelmic-mkoffload.c (prepare_target_image): Put
	-fPIC and -shared the last to create offload image.

From-SVN: r278041
parent d9945c88
2019-11-11 H.J. Lu <hjl.tools@gmail.com>
PR target/87833
* config/i386/intelmic-mkoffload.c (prepare_target_image): Put
-fPIC and -shared the last to create offload image.
2019-11-11 Thomas Schwinge <thomas@codesourcery.com> 2019-11-11 Thomas Schwinge <thomas@codesourcery.com>
* gimplify.c (gimplify_scan_omp_clauses): Assert 'offset2' instead * gimplify.c (gimplify_scan_omp_clauses): Assert 'offset2' instead
...@@ -453,8 +453,6 @@ prepare_target_image (const char *target_compiler, int argc, char **argv) ...@@ -453,8 +453,6 @@ prepare_target_image (const char *target_compiler, int argc, char **argv)
if (verbose) if (verbose)
obstack_ptr_grow (&argv_obstack, "-v"); obstack_ptr_grow (&argv_obstack, "-v");
obstack_ptr_grow (&argv_obstack, "-xlto"); obstack_ptr_grow (&argv_obstack, "-xlto");
obstack_ptr_grow (&argv_obstack, "-shared");
obstack_ptr_grow (&argv_obstack, "-fPIC");
obstack_ptr_grow (&argv_obstack, opt1); obstack_ptr_grow (&argv_obstack, opt1);
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
{ {
...@@ -466,6 +464,9 @@ prepare_target_image (const char *target_compiler, int argc, char **argv) ...@@ -466,6 +464,9 @@ prepare_target_image (const char *target_compiler, int argc, char **argv)
if (!out_obj_filename) if (!out_obj_filename)
fatal_error (input_location, "output file not specified"); fatal_error (input_location, "output file not specified");
obstack_ptr_grow (&argv_obstack, opt2); obstack_ptr_grow (&argv_obstack, opt2);
/* NB: Put -fPIC and -shared the last to create shared library. */
obstack_ptr_grow (&argv_obstack, "-fPIC");
obstack_ptr_grow (&argv_obstack, "-shared");
obstack_ptr_grow (&argv_obstack, "-o"); obstack_ptr_grow (&argv_obstack, "-o");
obstack_ptr_grow (&argv_obstack, target_so_filename); obstack_ptr_grow (&argv_obstack, target_so_filename);
compile_for_target (&argv_obstack); compile_for_target (&argv_obstack);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment