Hi! On Tue, 28 Apr 2015 15:24:08 +0200, Bernd Schmidt <ber...@codesourcery.com> wrote: > On 04/27/2015 06:08 PM, Thomas Schwinge wrote: > > >>> OK to do the following instead? (Coding style/code copied from > >>> gcc/config/i386/intelmic-mkoffload.c for consistency.) > > Err, was this a question for me? I'm fine with that too.
Yes -- you're the nvptx maintainer after all. ;-) Committed in r222583: commit df615909263269988fd9611f8d007902580829d9 Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Wed Apr 29 16:23:26 2015 +0000 [PR libgomp/65099] nvptx mkoffload: pass "-m32" or "-m64" to the compiler ... depending on "-foffload-abi=[...]". Coding style/code copied from gcc/config/i386/intelmic-mkoffload.c for consistency. gcc/ * config/nvptx/mkoffload.c (target_ilp32): New variable. (main): Set it depending on "-foffload-abi=[...]". (compile_native, main): Use it to pass "-m32" or "-m64" to the compiler. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222583 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/nvptx/mkoffload.c | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git gcc/ChangeLog gcc/ChangeLog index aaa06c3..d7455e4 100644 --- gcc/ChangeLog +++ gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-04-29 Thomas Schwinge <tho...@codesourcery.com> + + PR libgomp/65099 + * config/nvptx/mkoffload.c (target_ilp32): New variable. + (main): Set it depending on "-foffload-abi=[...]". + (compile_native, main): Use it to pass "-m32" or "-m64" to the + compiler. + 2015-04-29 Alan Lawrence <alan.lawre...@arm.com> PR target/65770 diff --git gcc/config/nvptx/mkoffload.c gcc/config/nvptx/mkoffload.c index dbc68bc..8687154 100644 --- gcc/config/nvptx/mkoffload.c +++ gcc/config/nvptx/mkoffload.c @@ -126,6 +126,9 @@ static id_map *var_ids, **vars_tail = &var_ids; static const char *ptx_name; static const char *ptx_cfile_name; +/* Shows if we should compile binaries for i386 instead of x86-64. */ +bool target_ilp32 = false; + /* Delete tempfiles. */ /* Unlink a temporary file unless requested otherwise. */ @@ -885,6 +888,7 @@ compile_native (const char *infile, const char *outfile, const char *compiler) struct obstack argv_obstack; obstack_init (&argv_obstack); obstack_ptr_grow (&argv_obstack, compiler); + obstack_ptr_grow (&argv_obstack, target_ilp32 ? "-m32" : "-m64"); obstack_ptr_grow (&argv_obstack, infile); obstack_ptr_grow (&argv_obstack, "-c"); obstack_ptr_grow (&argv_obstack, "-o"); @@ -962,11 +966,23 @@ main (int argc, char **argv) passed with @file. Expand them into argv before processing. */ expandargv (&argc, &argv); + /* Find out whether we should compile binaries for i386 or x86-64. */ + for (int i = argc - 1; i > 0; i--) + if (strncmp (argv[i], "-foffload-abi=", sizeof ("-foffload-abi=") - 1) == 0) + { + if (strstr (argv[i], "ilp32")) + target_ilp32 = true; + else if (!strstr (argv[i], "lp64")) + fatal_error (input_location, + "unrecognizable argument of option -foffload-abi"); + break; + } + struct obstack argv_obstack; obstack_init (&argv_obstack); obstack_ptr_grow (&argv_obstack, driver); obstack_ptr_grow (&argv_obstack, "-xlto"); - obstack_ptr_grow (&argv_obstack, "-m64"); + obstack_ptr_grow (&argv_obstack, target_ilp32 ? "-m32" : "-m64"); obstack_ptr_grow (&argv_obstack, "-S"); for (int ix = 1; ix != argc; ix++) Grüße, Thomas
pgp4nQYIGv1oG.pgp
Description: PGP signature