summaryrefslogtreecommitdiffstats
path: root/binutils-2.22.52.0.1-ld-13621.patch
blob: 841162af4d4deb2aa8e95ecb66c83cfefa33b7a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
commit 05906ac72f0f047472989a99dec1e66713157629
Author: Richard Henderson <rth@redhat.com>
Date:   Mon Feb 13 18:08:50 2012 +0000

    PR ld/13621
    
    bfd/
    	* linker.c (fix_syms): Force symbols outside any section into
    	bfd_abs_section_ptr.
    ld/testsuite/
    	* ld-elf/warn2.d: Expect ABS section for Foo.

diff --git a/bfd/linker.c b/bfd/linker.c
index c51c5df..0404474 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -3208,6 +3208,12 @@ fix_syms (struct bfd_link_hash_entry *h, void *data)
 		op = op1;
 	    }
 
+	  /* Refuse to choose a section for which we are out of bounds.  */
+	  /* ??? This may make most of the above moot.  */
+	  if (h->u.def.value < op->vma
+	      || h->u.def.value > op->vma + op->size)
+	    op = bfd_abs_section_ptr;
+
 	  h->u.def.value -= op->vma;
 	  h->u.def.section = op;
 	}
index 95b7ef4..a9c05f9 100644
--- a/ld/testsuite/ld-elf/warn2.d
+++ b/ld/testsuite/ld-elf/warn2.d
@@ -13,5 +13,5 @@
 # construct and that the symbol still appears as expected.
 
 #...
- +[0-9]+: +[0-9a-f]+ +20 +OBJECT +GLOBAL +DEFAULT +[1-9] Foo
+ +[0-9]+: +[0-9a-f]+ +20 +OBJECT +GLOBAL +DEFAULT +ABS Foo
 #pass