merge 584778 585051
tag 584778 + fixed-upstream
tag 584778 + patch
thanks
On Sat, Jun 12, 2010 at 08:47:13PM +0200, Matthias Klose wrote:
> On 12.06.2010 19:00, André Wöbbeking wrote:
> >On Saturday 12 June 2010, Aurelien Jarno wrote:
> >
> >>Moreover we can also backport the optimized functions that have been
> >>added in 2.12, but the current goal is to move 2.11 to squeeze, so it
> >>will be for later.
> >>
> >>All that said, I don't plan to disable --with-multi-arch.
> >
> >Aurelien, you mentioned in 583858 that binutils.gold is fixed in experimental
> >(or doesn't trigger this bug). Matthias, could you backport that to Sid?
>
> I assume that the experimental binutils.gold was tested with glibc
> 2.10. No, I don't think a backport would be helpful.
>
You assume wrong, it was tested with glibc 2.11. I don't know if a
backport can be considered helpful or not, but at least it fixes the
problem. Please find the patch attached.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurel...@aurel32.net http://www.aurel32.net
#!/bin/sh -e
## 153_gold_pr10893.dpatch
##
## DP: Description: PR gold/10893: Add support for ifunc
if [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
case "$1" in
-patch) patch $patch_opts -p1 < $0;;
-unpatch) patch $patch_opts -p1 -R < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as
argument"
exit 1;;
esac
exit 0
2009-12-07 H.J. Lu
PR gold/10893
* i386.cc (Target_i386::Scan::globa): Use is_func instead of
checking elfcpp::STT_FUNC.
(Target_i386::Relocate::relocate): Likewise.
* x86_64.cc (Target_x86_64::Scan::global): Likewise.
* symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
symbols from shared libraries into normal FUNC symbols.
* symtab.h (Symbol): Add is_func and use it.
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -1248,7 +1248,7 @@ Target_i386::Scan::global(Symbol_table* symtab,
}
// Make a dynamic relocation if necessary.
int flags = Symbol::NON_PIC_REF;
-if (gsym->type() == elfcpp::STT_FUNC)
+if (gsym->is_func())
flags |= Symbol::FUNCTION_CALL;
if (gsym->needs_dynamic_reloc(flags))
{
@@ -1727,7 +1727,7 @@ Target_i386::Relocate::relocate(const Relocate_info<32,
false>* relinfo,
case elfcpp::R_386_PC32:
{
int ref_flags = Symbol::NON_PIC_REF;
-if (gsym != NULL && gsym->type() == elfcpp::STT_FUNC)
+if (gsym != NULL && gsym->is_func())
ref_flags |= Symbol::FUNCTION_CALL;
if (should_apply_static_reloc(gsym, ref_flags, true, output_section))
Relocate_functions<32, false>::pcrel32(view, object, psymval,
address);
@@ -1743,7 +1743,7 @@ Target_i386::Relocate::relocate(const Relocate_info<32,
false>* relinfo,
case elfcpp::R_386_PC16:
{
int ref_flags = Symbol::NON_PIC_REF;
-if (gsym != NULL && gsym->type() == elfcpp::STT_FUNC)
+if (gsym != NULL && gsym->is_func())
ref_flags |= Symbol::FUNCTION_CALL;
if (should_apply_static_reloc(gsym, ref_flags, false, output_section))
Relocate_functions<32, false>::pcrel16(view, object, psymval,
address);
@@ -1759,7 +1759,7 @@ Target_i386::Relocate::relocate(const Relocate_info<32,
false>* relinfo,
case elfcpp::R_386_PC8:
{
int ref_flags = Symbol::NON_PIC_REF;
-if (gsym != NULL && gsym->type() == elfcpp::STT_FUNC)
+if (gsym != NULL && gsym->is_func())
ref_flags |= Symbol::FUNCTION_CALL;
if (should_apply_static_reloc(gsym, ref_flags, false,
output_section))
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -2810,11 +2810,16 @@ Symbol_table::sized_write_symbol(
osym.put_st_size(0);
else
osym.put_st_size(sym->symsize());
+ elfcpp::STT type = sym->type();
+ // Turn IFUNC symbols from shared libraries into normal FUNC symbols.
+ if (type == elfcpp::STT_GNU_IFUNC
+ && sym->is_from_dynobj())
+type = elfcpp::STT_FUNC;
// A version script may have overridden the default binding.
if (sym->is_forced_local())
-osym.put_st_info(elfcpp::elf_st_info(elfcpp::STB_LOCAL, sym->type()));
+osym.put_st_info(elfcpp::elf_st_info(elfcpp::STB_LOCAL, type));
else
-osym.put_st_info(elfcpp::elf_st_info(sym->binding(), sym->type()));
+osym.put_st_info(elfcpp::elf_st_info(sym->binding(), type));
osym.put_st_other(elfcpp::elf_st_other(sym->visibility(), sym->nonvis()));
osym.put_st_shndx(shndx);
}
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -205,6 +205,14 @@ class Symbol
type() const
{ return this->type_; }
+ // Return true for function symbol.
+ bool
+ is_f