This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR gold/11996: Gold failed to build with gcc 4.2.4
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Cc: Ian Lance Taylor <iant at google dot com>
- Date: Thu, 9 Sep 2010 10:56:34 -0700
- Subject: PATCH: PR gold/11996: Gold failed to build with gcc 4.2.4
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi Ian,
Gold failed to build with gcc 4.2.4. Here is a patch to support gcc
4.2.4. Also gcc 4.2/4.3 needs an extra __attribute__ ((used)).
Otherwise, they will error defined and not used. OK to install?
Thanks.
H.J.
---
2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
PR gold/11996
* object.cc (Sized_relobj::do_finalize_local_symbols): Remove
"This::" to work around a bug in gcc 4.2.
* testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
diff --git a/gold/object.cc b/gold/object.cc
index 7bd35f3..d8de705 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -2074,7 +2074,8 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
{
Symbol_value<size>* lv = &this->local_values_[i];
- This::Compute_final_local_value_status cflv_status =
+ // Remove "This::" to work around a bug in gcc 4.2.
+ Compute_final_local_value_status cflv_status =
this->compute_final_local_value_internal(i, lv, lv, relocatable,
out_sections, out_offsets,
symtab);
diff --git a/gold/testsuite/ifuncmain7.c b/gold/testsuite/ifuncmain7.c
index f6608ea..c2524aa 100644
--- a/gold/testsuite/ifuncmain7.c
+++ b/gold/testsuite/ifuncmain7.c
@@ -15,7 +15,7 @@ one (void)
return -30;
}
-static void * foo_ifunc (void) __asm__ ("foo");
+static void * __attribute__ ((used)) foo_ifunc (void) __asm__ ("foo");
__asm__(".type foo, %gnu_indirect_function");
static void *