This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR target/63815: [5 Regression] g++.dg/other/pr53811.C fails with -mcmodel=large -fpic
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Wed, 12 Nov 2014 14:06:11 -0800
- Subject: Re: PATCH: PR target/63815: [5 Regression] g++.dg/other/pr53811.C fails with -mcmodel=large -fpic
- Authentication-results: sourceware.org; auth=none
- References: <20141112204317 dot GA13104 at intel dot com> <20141112210249 dot GQ5026 at tucnak dot redhat dot com> <CAMe9rOqUb4Da5wqGri1w68hET3EbgCwNzu0WYRU_C=pAgAs5YA at mail dot gmail dot com> <20141112213931 dot GR5026 at tucnak dot redhat dot com> <CAMe9rOpCjrnp3yER_rCiHK-ERcynKP2KZGz+VF_DUVAaGpT-Tg at mail dot gmail dot com> <20141112220045 dot GT5026 at tucnak dot redhat dot com>
On Wed, Nov 12, 2014 at 2:00 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Nov 12, 2014 at 01:51:01PM -0800, H.J. Lu wrote:
>> > So, all in all, SET_REGNO sounds inappropriate to me, everywhere else
>> > gen_raw_REG or gen_rtx_REG is used instead, so IMNSHO you should do the
>> > same.
>> >
>> > Jakub
>>
>> It makes sense. I checked in the following patch.
>
> gen_raw_REG would be better, the difference is that gen_rtx_REG might
> in theory return you pic_offset_table_rtx again.
The whole x86_output_mi_thunk function uses gen_rtx_REG. Using
gen_raw_REG is out of space.
> Anyway, I don't think anything is needed for release branches,
> pic_offset_table_rtx should be initialized there just once and not changed
> afterwards.
Try this with released GCC:
[hjl@gnu-6 tmp]$ cat foo.h
struct ICCStringClass
{
virtual int CreateString (int) = 0;
};
struct AGSCCDynamicObject
{
virtual void Unserialize () = 0;
};
struct ScriptString:AGSCCDynamicObject, ICCStringClass
{
virtual int CreateString (int);
virtual void Unserialize ();
};
[hjl@gnu-6 tmp]$ cat foo1.cc
#include "foo.h"
int
__attribute__ ((noinline))
CreateNewScriptString (int fromText, bool reAllocate = true)
{
return fromText;
}
int
__attribute__ ((noinline))
ScriptString::CreateString (int fromText)
{
return CreateNewScriptString (fromText);
}
void
__attribute__ ((noinline))
ScriptString::Unserialize ()
{
}
[hjl@gnu-6 tmp]$ cat foo2.cc
#include "foo.h"
int
main ()
{
ICCStringClass *x = new ScriptString;
if (x->CreateString (1) != 1)
__builtin_abort ();
return 0;
}
[hjl@gnu-6 tmp]$ g++ -shared -fpic -O2 -mcmodel=large -o libfoo.so foo1.cc
[hjl@gnu-6 tmp]$ g++ foo2.cc ./libfoo.so
[hjl@gnu-6 tmp]$ ./a.out
Segmentation fault
[hjl@gnu-6 tmp]$
--
H.J.