This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][PATCH] PR gold/14608: --detect-odr-violations doesn't work with GCC 4.7 and newer
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Mon, 22 Dec 2014 09:53:43 -0800
- Subject: Re: [gold][PATCH] PR gold/14608: --detect-odr-violations doesn't work with GCC 4.7 and newer
- Authentication-results: sourceware.org; auth=none
- References: <20141220161516 dot GA15216 at gmail dot com> <CAHACq4p7dQYiKihV=c-+WaLY3fS6cMTOrGE35QyJqebP-xpH1A at mail dot gmail dot com>
On Mon, Dec 22, 2014 at 9:51 AM, Cary Coutant <ccoutant@google.com> wrote:
>> The debug_msg test has 2 implementations of SometimesInlineFunction:
>>
>> int SometimesInlineFunction(int i) { return i; }
>> int SometimesInlineFunction(int i) { return i * i; }
>>
>> and One Definition Rule (ODR) violation detection expects they will be
>> compiled into functions of different sizes. Hower, on x86, GCC 4.7 and
>> newer compile them into functions of the same size and ODR violation
>> detection test fails. This patch changes
>>
>> int SometimesInlineFunction(int i) { return i; }
>>
>> to
>>
>> int SometimesInlineFunction(int i) { return i * i * 3; }
>>
>> so that it will be compiled into a function of larger size. Tested on
>> x86, x86-64 and x32. Hopefully, it works on other targets. I checked
>> it in as an obvious fix.
>>
>> H.J.
>> ---
>> PR gold/14608
>> * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
>> to "return i * i * 3;".
>
> Thanks. I haven't seen this with GCC 4.8 on x86_64. The first,
> compiled with -O0, has a size of 12, and the second, compiled with
> -O2, has a size of 6.
>
It happens only on x86, not x86-64.
--
H.J.