#! /bin/sh -e
## 113_elf_backend_hide_symbol.dpatch
##
## DP: Description: fix ld internal error on hppa (#254549)
## DP: Author: Alan Modra <amodra@bigpond.net.au>
## DP: Upstream status: Committed to trunk
## DP: Date: 2004-08-13
## DP: URL: http://sources.redhat.com/ml/binutils/2004-08/msg00129.html

if [ $# -lt 1 ]; then
    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"

case "$1" in
    -patch) patch -p1 ${patch_opts} < $0;;
    -unpatch) patch -R -p1 ${patch_opts} < $0;;
    *)
        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
        exit 1;;
esac

exit 0

@DPATCH@
diff -urNad /home/james/debian/packages/binutils/binutils-2.15/bfd/elf32-hppa.c binutils-2.15/bfd/elf32-hppa.c
--- /home/james/debian/packages/binutils/binutils-2.15/bfd/elf32-hppa.c	2004-05-17 20:35:58.000000000 +0100
+++ binutils-2.15/bfd/elf32-hppa.c	2004-08-31 21:07:51.357989873 +0100
@@ -1615,7 +1615,7 @@
   if (! ((struct elf32_hppa_link_hash_entry *) h)->plabel)
     {
       h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
-      h->plt.offset = (bfd_vma) -1;
+      h->plt = elf_hash_table (info)->init_refcount;
     }
 }
 
