From 5961520ebfcecb229ca4bcdbf83107280822c156 Mon Sep 17 00:00:00 2001 From: Bogon Kim Date: Mon, 8 Apr 2013 13:40:12 +0900 Subject: [PATCH] add missing file for previous patch Change-Id: If3c08630c7620e8fac9deb778c9a331ab089643a Signed-off-by: Bogon Kim --- packaging/pr_13990_14189.patch | 118 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100755 packaging/pr_13990_14189.patch diff --git a/packaging/pr_13990_14189.patch b/packaging/pr_13990_14189.patch new file mode 100755 index 0000000..907312b --- /dev/null +++ b/packaging/pr_13990_14189.patch @@ -0,0 +1,118 @@ +diff --git a/bfd/ChangeLog b/bfd/ChangeLog +@@ -1,3 +1,9 @@ ++2012-04-24 Hans-Peter Nilsson ++ ++ PR ld/13990 ++ * elf32-arm.c (elf32_arm_gc_sweep_hook): Handle a forced-local ++ symbol, where PLT refcount is set to -1. ++ +diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c +index 1f6c1a0..c343a6a 100644 +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -12046,8 +12046,19 @@ elf32_arm_gc_sweep_hook (bfd * abfd, + if (may_need_local_target_p + && elf32_arm_get_plt_info (abfd, eh, r_symndx, &root_plt, &arm_plt)) + { +- BFD_ASSERT (root_plt->refcount > 0); +- root_plt->refcount -= 1; ++ /* If PLT refcount book-keeping is wrong and too low, we'll ++ see a zero value (going to -1) for the root PLT reference ++ count. */ ++ if (root_plt->refcount >= 0) ++ { ++ BFD_ASSERT (root_plt->refcount != 0); ++ root_plt->refcount -= 1; ++ } ++ else ++ /* A value of -1 means the symbol has become local, forced ++ or seeing a hidden definition. Any other negative value ++ is an error. */ ++ BFD_ASSERT (root_plt->refcount == -1); + + if (!call_reloc_p) + arm_plt->noncall_refcount--; +@@ -12408,7 +12419,8 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, + + /* If the symbol is a function that doesn't bind locally, + this relocation will need a PLT entry. */ +- root_plt->refcount += 1; ++ if (root_plt->refcount != -1) ++ root_plt->refcount += 1; + + if (!call_reloc_p) + arm_plt->noncall_refcount++; +diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp +index c7a0b2c..8631466 +--- a/ld/testsuite/ld-arm/arm-elf.exp ++++ b/ld/testsuite/ld-arm/arm-elf.exp +@@ -733,3 +733,4 @@ run_dump_test "attr-merge-vfp-6r" + run_dump_test "attr-merge-incompatible" + run_dump_test "unresolved-1" + run_dump_test "unresolved-1-dyn" ++run_dump_test "gc-hidden-1" +--- /dev/null ++++ b/ld/testsuite/ld-arm/gc-hidden-1.d +@@ -0,0 +1,26 @@ ++#target: arm*-*-*eabi ++#source: main.s ++#source: gcdfn.s ++#source: hidfn.s ++#ld: --gc-sections --shared --version-script hideall.ld ++#objdump: -dRT ++ ++# See PR ld/13990: a forced-local PLT reference to a ++# forced-local symbol is GC'ed, trigging a BFD_ASSERT. ++ ++.*: file format elf32-.* ++ ++DYNAMIC SYMBOL TABLE: ++0+124 l d .text 0+ .text ++0+ g DO \*ABS\* 0+ NS NS ++ ++Disassembly of section .text: ++ ++0+124 <_start>: ++ 124: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\) ++ 128: eb000000 bl 130 ++ 12c: e8bd8000 pop {pc} ++ ++0+130 : ++ 130: e8bd8000 pop {pc} ++ +--- /dev/null ++++ binutils/ld/testsuite/ld-arm/gcdfn.s +@@ -0,0 +1,8 @@ ++ .text ++ .globl gcdfn ++ .type gcdfn, %function ++gcdfn: ++ str lr, [sp, #-4]! ++ bl hidfn(PLT) ++ ldmfd sp!, {pc} ++ .size gcdfn, . - gcdfn +--- /dev/null ++++ b/ld/testsuite/ld-arm/hideall.ld +@@ -0,0 +1 @@ ++NS { local: *; }; +--- /dev/null ++++ binutils/ld/testsuite/ld-arm/hidfn.s +@@ -0,0 +1,7 @@ ++ .text ++ .globl hidfn ++ .hidden hidfn ++ .type hidfn, %function ++hidfn: ++ ldmfd sp!, {pc} ++ .size hidfn, . - hidfn +--- /dev/null ++++ b/ld/testsuite/ld-arm/main.s +@@ -0,0 +1,8 @@ ++ .text ++ .globl _start ++ .type _start, %function ++_start: ++ str lr, [sp, #-4]! ++ bl hidfn(PLT) ++ ldmfd sp!, {pc} ++ .size _start, . - _start -- 2.7.4