This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[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: binutils at sourceware dot org
- Cc: Cary Coutant <ccoutant at google dot com>
- Date: Sat, 20 Dec 2014 08:15:17 -0800
- Subject: [gold][PATCH] PR gold/14608: --detect-odr-violations doesn't work with GCC 4.7 and newer
- Authentication-results: sourceware.org; auth=none
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;".
---
gold/ChangeLog | 6 ++++++
gold/testsuite/debug_msg.cc | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 9edf043..f67df17 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gold/14608
+ * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
+ to "return i * i * 3;".
+
2014-12-16 Cary Coutant <ccoutant@google.com>
* mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
diff --git a/gold/testsuite/debug_msg.cc b/gold/testsuite/debug_msg.cc
index e5beb5f..a48c141 100644
--- a/gold/testsuite/debug_msg.cc
+++ b/gold/testsuite/debug_msg.cc
@@ -66,7 +66,7 @@ OdrBase* CreateOdrDerived2(); // in odr_violation2.cc
extern "C" int OverriddenCFunction(int i); // in odr_violation*.cc
inline int SometimesInlineFunction(int i) { // strong in odr_violation2.cc.
- return i;
+ return i * i * 3;
}
--
1.9.3