From 73e2538765507c373e1d7c14363094a2f6cf645a Mon Sep 17 00:00:00 2001 From: tschwinge Date: Mon, 11 Nov 2019 08:38:28 +0000 Subject: [PATCH] [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 PR target/87833 * config/i386/intelmic-mkoffload.c (prepare_target_image): Put -fPIC and -shared the last to create offload image. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@278041 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/intelmic-mkoffload.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ca0cebc20180..1b0145fbc787 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-11-11 H.J. Lu + + 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 * gimplify.c (gimplify_scan_omp_clauses): Assert 'offset2' instead diff --git a/gcc/config/i386/intelmic-mkoffload.c b/gcc/config/i386/intelmic-mkoffload.c index 2a3e912ee74f..0b12edc72c14 100644 --- a/gcc/config/i386/intelmic-mkoffload.c +++ b/gcc/config/i386/intelmic-mkoffload.c @@ -453,8 +453,6 @@ prepare_target_image (const char *target_compiler, int argc, char **argv) if (verbose) obstack_ptr_grow (&argv_obstack, "-v"); obstack_ptr_grow (&argv_obstack, "-xlto"); - obstack_ptr_grow (&argv_obstack, "-shared"); - obstack_ptr_grow (&argv_obstack, "-fPIC"); obstack_ptr_grow (&argv_obstack, opt1); for (int i = 1; i < argc; i++) { @@ -466,6 +464,9 @@ prepare_target_image (const char *target_compiler, int argc, char **argv) if (!out_obj_filename) fatal_error (input_location, "output file not specified"); 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, target_so_filename); compile_for_target (&argv_obstack); -- 2.17.1