This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][aarch64]Patch for Relaxation
- From: Cary Coutant <ccoutant at google dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Ryan Mansfield <rmansfield at qnx dot com>, Binutils <binutils at sourceware dot org>
- Date: Fri, 17 Oct 2014 16:10:57 -0700
- Subject: Re: [gold][aarch64]Patch for Relaxation
- Authentication-results: sourceware.org; auth=none
- References: <CACkGtrhqMpo-Fdt+39XJTLTjjJtz3essmdDEdQY8Owni66sgkw at mail dot gmail dot com> <CAHACq4q2f3bhz4tWHMbz1zLbGDskopaomqveTn_A0ZjwXcBH4Q at mail dot gmail dot com> <CACkGtrjxw9d9GRmiz=ztCne6n8+Dv17jegM45db7HkMLUmy2Qw at mail dot gmail dot com> <CAHACq4rWadE1fDRMZOmqZ4Mr1Qago25a_cd9+u04y9M0b691ug at mail dot gmail dot com> <CACkGtrgoWM8f1Oc71nVTGDrNztCt0BCx1-FiQavn=QOLpZ4tnA at mail dot gmail dot com> <CAHACq4q6_XqUx9ObfG-TZLzAzh_-6L+K45osA_KJ2rTLdvQs6g at mail dot gmail dot com> <543FE312 dot 7090205 at qnx dot com> <CAKOQZ8zTmMNsDnFobgch+-NTu5f8ZoA1u-QYiPVTSsH8aGM8aA at mail dot gmail dot com>
The problem seems to be the typedef for "This":
template<int size, bool big_endian>
class AArch64_relocate_functions
{
public:
typedef enum
{
STATUS_OKAY, // No error during relocation.
STATUS_OVERFLOW, // Relocation overflow.
STATUS_BAD_RELOC, // Relocation cannot be applied.
} Status;
typedef AArch64_relocate_functions<size, big_endian> This;
Then inside AArch64_relocate_functions::maybe_apply_stub(), at line
4096, we use it to declare a This::Status:
This::Status status = This::template
rela_general<32>(view, branch_offset, 0, arp);
I reduced this down to a very small source and used the gcc 4.2.1 on
my Mac to reproduce (I don't have gold configured to build natively on
my Mac).
template<int size>
class A
{
public:
typedef enum { OK, BAD } Status;
int foo();
private:
typedef A<size> This;
int x;
};
template<int size>
int A<size>::foo()
{
This::Status status = (x == size ? OK : BAD);
return status == OK;
}
template
class A<32>;
If I change "This::Status" to just "Status", it compiles.
What puzzles me is that we use a similar typedef for "This" all over
gold, and I don't see offhand what's different about this one. (Maybe
this is just the first time the compiler runs into this problem, but
it seems unlikely, since the Makefile tends to build the target
sources last.
Any ideas?
-cary
On Thu, Oct 16, 2014 at 8:55 AM, Ian Lance Taylor <iant@google.com> wrote:
> On Thu, Oct 16, 2014 at 8:24 AM, Ryan Mansfield <rmansfield@qnx.com> wrote:
>>
>> I'm not aware of a documented required g++ version for binutils/gold. Is
>> there? I looked around but didn't find anything.
>
> There are some notes in gold/README.
>
> I think this is the first failure with GCC 4.2. It would be nice to
> make it work, if possible.
>
> Ian