This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix up LTO TARGET_OPTION_NODE handling on x86 (PR lto/64374)
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, Uros Bizjak <ubizjak at gmail dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Feb 2015 20:48:19 +0100
- Subject: Re: [PATCH] Fix up LTO TARGET_OPTION_NODE handling on x86 (PR lto/64374)
- Authentication-results: sourceware.org; auth=none
- References: <20150224192919 dot GP1746 at tucnak dot redhat dot com>
> Hi!
>
> As mentioned in the PR, the ix86_cmodel option is TargetSave,
> but during option processing is adjusted from flag_pic, which is
> for LTO a global option.
> This causes a problem when some translation unit is compiled with LTO
> without -fpic, and then the final link is done with -fpic - then
> ix86_cmodel might be the non-_PIC CM_* even when flag_pic is on, which
> greatly confuses the backend.
>
> Fixed by adding a target hook to do such adjustments upon TARGET_OPTION_NODE
> streaming in.
>
> Unfortunately, for some reason I can't now really reproduce the ICE and the
> testcase seems to be missing a function definition, but I've at least
> verified it that without the patch there is inconsistent value of
> ix86_cmodel while the patch fixes that.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2015-02-24 Jakub Jelinek <jakub@redhat.com>
>
> PR lto/64374
> * target.def (target_option_stream_in): New target hook.
> * tree-streamer-in.c (streamer_read_tree_bitfields): Invoke
> targetm.target_option.post_stream_in if non-NULL.
> * doc/tm.texi.in: Add @hook TARGET_OPTION_POST_STREAM_IN.
> * doc/tm.texi: Updated.
> * config/i386/i386.c (ix86_function_specific_post_stream_in): New
> function.
> (TARGET_OPTION_POST_STREAM_IN): Redefine.
Thanks, the i386 parts of the patch are OK, but I think you want to add the reverse
transformation, too. I.e. if someone compiles with -fPIC but links without.
My plan to fix the testcase was to put it into ix86_function_specific_restore
which would save need for a new hook. But I am fine either way (just can't
approve the newhook)
Honza