diff options
| author | lumag <dbaryshkov@gmail.com> | 2011-08-16 16:07:44 +0000 |
|---|---|---|
| committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-08-16 13:07:43 +0200 |
| commit | 246b0b07f771ef6d096d0ef3e488ea28c56e13c5 (patch) | |
| tree | 7fcc32addbf393a106f80bce8ff89bbccc57911e /meta-oe/recipes-devtools/binutils | |
| parent | 6d424db5a0f952956a218e82a3ef0c43ebaafd5a (diff) | |
| download | meta-openembedded-246b0b07f771ef6d096d0ef3e488ea28c56e13c5.tar.gz | |
binutils-2.20.1: import several patches from Debian
Import several patches from Debian to improve --no-add-needed handling
vs. weak symbols and branching to weak symbols on arm.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/recipes-devtools/binutils')
5 files changed, 467 insertions, 1 deletions
diff --git a/meta-oe/recipes-devtools/binutils/binutils-2.20.1/152_arm_branches_to_weak_symbols.patch b/meta-oe/recipes-devtools/binutils/binutils-2.20.1/152_arm_branches_to_weak_symbols.patch new file mode 100644 index 0000000000..48523f889d --- /dev/null +++ b/meta-oe/recipes-devtools/binutils/binutils-2.20.1/152_arm_branches_to_weak_symbols.patch | |||
| @@ -0,0 +1,240 @@ | |||
| 1 | #!/bin/sh -e | ||
| 2 | ## 152_arm_branches_to_weak_symbols.dpatch | ||
| 3 | ## | ||
| 4 | ## DP: Description: http://sourceware.org/ml/binutils/2010-04/msg00446.html | ||
| 5 | ## DP: Description: taken from the trunk | ||
| 6 | |||
| 7 | if [ $# -ne 1 ]; then | ||
| 8 | echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" | ||
| 9 | exit 1 | ||
| 10 | fi | ||
| 11 | |||
| 12 | [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts | ||
| 13 | patch_opts="${patch_opts:--f --no-backup-if-mismatch}" | ||
| 14 | |||
| 15 | case "$1" in | ||
| 16 | -patch) patch $patch_opts -p0 < $0;; | ||
| 17 | -unpatch) patch $patch_opts -p0 -R < $0;; | ||
| 18 | *) | ||
| 19 | echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" | ||
| 20 | exit 1;; | ||
| 21 | esac | ||
| 22 | |||
| 23 | exit 0 | ||
| 24 | |||
| 25 | gas/ | ||
| 26 | |||
| 27 | 2010-05-04 Nick Clifton <nickc@redhat.com> | ||
| 28 | |||
| 29 | * write.c (fixup_segment): Revert previous delta. | ||
| 30 | * config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Also force the | ||
| 31 | generation of relocations for fixups against weak symbols. | ||
| 32 | |||
| 33 | 2010-04-29 Nathan Sidwell <nathan@codesourcery.com> | ||
| 34 | |||
| 35 | * write.c (fixup_segment): Do not assume we know the section a | ||
| 36 | defined weak symbol is in. | ||
| 37 | * config/tc-arm.c (relax_adr, relax_branch, md_apply_fix): Treat | ||
| 38 | weak symbols as not known to be in the same section, even if they | ||
| 39 | are defined. | ||
| 40 | |||
| 41 | gas/testsuite/ | ||
| 42 | |||
| 43 | 2010-04-29 Nathan Sidwell <nathan@codesourcery.com> | ||
| 44 | |||
| 45 | * gas/arm/weakdef-1.s: New. | ||
| 46 | * gas/arm/weakdef-1.d: New. | ||
| 47 | * gas/arm/weakdef-2.s: New. | ||
| 48 | * gas/arm/weakdef-2.d: New. | ||
| 49 | * gas/arm/weakdef-2.l: New. | ||
| 50 | |||
| 51 | @DPATCH@ | ||
| 52 | diff -urN gas.orig/config/tc-arm.c gas/config/tc-arm.c | ||
| 53 | --- a/gas/config/tc-arm.c 2010-02-22 08:06:52.000000000 +0000 | ||
| 54 | +++ b/gas/config/tc-arm.c 2010-05-06 12:52:25.391085365 +0000 | ||
| 55 | @@ -18207,7 +18207,8 @@ | ||
| 56 | |||
| 57 | /* Assume worst case for symbols not known to be in the same section. */ | ||
| 58 | if (!S_IS_DEFINED (fragp->fr_symbol) | ||
| 59 | - || sec != S_GET_SEGMENT (fragp->fr_symbol)) | ||
| 60 | + || sec != S_GET_SEGMENT (fragp->fr_symbol) | ||
| 61 | + || S_IS_WEAK (fragp->fr_symbol)) | ||
| 62 | return 4; | ||
| 63 | |||
| 64 | val = relaxed_symbol_addr (fragp, stretch); | ||
| 65 | @@ -18250,7 +18251,8 @@ | ||
| 66 | |||
| 67 | /* Assume worst case for symbols not known to be in the same section. */ | ||
| 68 | if (!S_IS_DEFINED (fragp->fr_symbol) | ||
| 69 | - || sec != S_GET_SEGMENT (fragp->fr_symbol)) | ||
| 70 | + || sec != S_GET_SEGMENT (fragp->fr_symbol) | ||
| 71 | + || S_IS_WEAK (fragp->fr_symbol)) | ||
| 72 | return 4; | ||
| 73 | |||
| 74 | #ifdef OBJ_ELF | ||
| 75 | @@ -19463,22 +19465,23 @@ | ||
| 76 | not have a reloc for it, so tc_gen_reloc will reject it. */ | ||
| 77 | fixP->fx_done = 1; | ||
| 78 | |||
| 79 | - if (fixP->fx_addsy | ||
| 80 | - && ! S_IS_DEFINED (fixP->fx_addsy)) | ||
| 81 | + if (fixP->fx_addsy) | ||
| 82 | { | ||
| 83 | - as_bad_where (fixP->fx_file, fixP->fx_line, | ||
| 84 | - _("undefined symbol %s used as an immediate value"), | ||
| 85 | - S_GET_NAME (fixP->fx_addsy)); | ||
| 86 | - break; | ||
| 87 | - } | ||
| 88 | + const char *msg = 0; | ||
| 89 | |||
| 90 | - if (fixP->fx_addsy | ||
| 91 | - && S_GET_SEGMENT (fixP->fx_addsy) != seg) | ||
| 92 | - { | ||
| 93 | - as_bad_where (fixP->fx_file, fixP->fx_line, | ||
| 94 | - _("symbol %s is in a different section"), | ||
| 95 | - S_GET_NAME (fixP->fx_addsy)); | ||
| 96 | - break; | ||
| 97 | + if (! S_IS_DEFINED (fixP->fx_addsy)) | ||
| 98 | + msg = _("undefined symbol %s used as an immediate value"); | ||
| 99 | + else if (S_GET_SEGMENT (fixP->fx_addsy) != seg) | ||
| 100 | + msg = _("symbol %s is in a different section"); | ||
| 101 | + else if (S_IS_WEAK (fixP->fx_addsy)) | ||
| 102 | + msg = _("symbol %s is weak and may be overridden later"); | ||
| 103 | + | ||
| 104 | + if (msg) | ||
| 105 | + { | ||
| 106 | + as_bad_where (fixP->fx_file, fixP->fx_line, | ||
| 107 | + msg, S_GET_NAME (fixP->fx_addsy)); | ||
| 108 | + break; | ||
| 109 | + } | ||
| 110 | } | ||
| 111 | |||
| 112 | newimm = encode_arm_immediate (value); | ||
| 113 | @@ -19504,24 +19507,25 @@ | ||
| 114 | unsigned int highpart = 0; | ||
| 115 | unsigned int newinsn = 0xe1a00000; /* nop. */ | ||
| 116 | |||
| 117 | - if (fixP->fx_addsy | ||
| 118 | - && ! S_IS_DEFINED (fixP->fx_addsy)) | ||
| 119 | + if (fixP->fx_addsy) | ||
| 120 | { | ||
| 121 | - as_bad_where (fixP->fx_file, fixP->fx_line, | ||
| 122 | - _("undefined symbol %s used as an immediate value"), | ||
| 123 | - S_GET_NAME (fixP->fx_addsy)); | ||
| 124 | - break; | ||
| 125 | - } | ||
| 126 | + const char *msg = 0; | ||
| 127 | |||
| 128 | - if (fixP->fx_addsy | ||
| 129 | - && S_GET_SEGMENT (fixP->fx_addsy) != seg) | ||
| 130 | - { | ||
| 131 | - as_bad_where (fixP->fx_file, fixP->fx_line, | ||
| 132 | - _("symbol %s is in a different section"), | ||
| 133 | - S_GET_NAME (fixP->fx_addsy)); | ||
| 134 | - break; | ||
| 135 | + if (! S_IS_DEFINED (fixP->fx_addsy)) | ||
| 136 | + msg = _("undefined symbol %s used as an immediate value"); | ||
| 137 | + else if (S_GET_SEGMENT (fixP->fx_addsy) != seg) | ||
| 138 | + msg = _("symbol %s is in a different section"); | ||
| 139 | + else if (S_IS_WEAK (fixP->fx_addsy)) | ||
| 140 | + msg = _("symbol %s is weak and may be overridden later"); | ||
| 141 | + | ||
| 142 | + if (msg) | ||
| 143 | + { | ||
| 144 | + as_bad_where (fixP->fx_file, fixP->fx_line, | ||
| 145 | + msg, S_GET_NAME (fixP->fx_addsy)); | ||
| 146 | + break; | ||
| 147 | + } | ||
| 148 | } | ||
| 149 | - | ||
| 150 | + | ||
| 151 | newimm = encode_arm_immediate (value); | ||
| 152 | temp = md_chars_to_number (buf, INSN_SIZE); | ||
| 153 | |||
| 154 | diff -urN gas.orig/config/tc-arm.h gas/config/tc-arm.h | ||
| 155 | --- a/gas/config/tc-arm.h 2009-09-01 00:24:01.000000000 +0000 | ||
| 156 | +++ b/gas/config/tc-arm.h 2010-05-06 12:53:42.784835970 +0000 | ||
| 157 | @@ -183,6 +183,7 @@ | ||
| 158 | (!(FIX)->fx_pcrel \ | ||
| 159 | || (FIX)->fx_r_type == BFD_RELOC_ARM_GOT32 \ | ||
| 160 | || (FIX)->fx_r_type == BFD_RELOC_32 \ | ||
| 161 | + || ((FIX)->fx_addsy != NULL && S_IS_WEAK ((FIX)->fx_addsy)) \ | ||
| 162 | || TC_FORCE_RELOCATION (FIX)) | ||
| 163 | |||
| 164 | /* Force output of R_ARM_REL32 relocations against thumb function symbols. | ||
| 165 | diff -urN gas.orig/testsuite/gas/arm/weakdef-1.d gas/testsuite/gas/arm/weakdef-1.d | ||
| 166 | --- a/gas/testsuite/gas/arm/weakdef-1.d 1970-01-01 00:00:00.000000000 +0000 | ||
| 167 | +++ b/gas/testsuite/gas/arm/weakdef-1.d 2010-05-06 12:52:25.391085365 +0000 | ||
| 168 | @@ -0,0 +1,20 @@ | ||
| 169 | +# name: Thumb branch to weak | ||
| 170 | +# as: | ||
| 171 | +# objdump: -dr | ||
| 172 | +# This test is only valid on ELF based ports. | ||
| 173 | +#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* | ||
| 174 | + | ||
| 175 | +.*: +file format .*arm.* | ||
| 176 | + | ||
| 177 | + | ||
| 178 | +Disassembly of section .text: | ||
| 179 | + | ||
| 180 | +0+000 <Weak>: | ||
| 181 | + 0: e7fe b.n 2 <Strong> | ||
| 182 | + 0: R_ARM_THM_JUMP11 Strong | ||
| 183 | + | ||
| 184 | +0+002 <Strong>: | ||
| 185 | + 2: f7ff bffe b.w 0 <Random> | ||
| 186 | + 2: R_ARM_THM_JUMP24 Random | ||
| 187 | + 6: f7ff bffe b.w 0 <Weak> | ||
| 188 | + 6: R_ARM_THM_JUMP24 Weak | ||
| 189 | diff -urN gas.orig/testsuite/gas/arm/weakdef-1.s gas/testsuite/gas/arm/weakdef-1.s | ||
| 190 | --- a/gas/testsuite/gas/arm/weakdef-1.s 1970-01-01 00:00:00.000000000 +0000 | ||
| 191 | +++ b/gas/testsuite/gas/arm/weakdef-1.s 2010-05-06 12:52:25.391085365 +0000 | ||
| 192 | @@ -0,0 +1,18 @@ | ||
| 193 | + .syntax unified | ||
| 194 | + .text | ||
| 195 | + .thumb | ||
| 196 | + | ||
| 197 | + .globl Weak | ||
| 198 | + .weak Weak | ||
| 199 | + .thumb_func | ||
| 200 | + .type Weak, %function | ||
| 201 | +Weak: | ||
| 202 | + b Strong | ||
| 203 | + .size Weak, .-Weak | ||
| 204 | + | ||
| 205 | + .globl Strong | ||
| 206 | + .type Strong, %function | ||
| 207 | +Strong: | ||
| 208 | + b Random | ||
| 209 | + b Weak | ||
| 210 | + .size Strong, .-Strong | ||
| 211 | diff -urN gas.orig/testsuite/gas/arm/weakdef-2.d gas/testsuite/gas/arm/weakdef-2.d | ||
| 212 | --- a/gas/testsuite/gas/arm/weakdef-2.d 1970-01-01 00:00:00.000000000 +0000 | ||
| 213 | +++ b/gas/testsuite/gas/arm/weakdef-2.d 2010-05-06 12:52:25.391085365 +0000 | ||
| 214 | @@ -0,0 +1,5 @@ | ||
| 215 | +# name: adr of weak | ||
| 216 | +# as: | ||
| 217 | +# error-output: weakdef-2.l | ||
| 218 | +# This test is only valid on ELF based ports. | ||
| 219 | +#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* | ||
| 220 | diff -urN gas.orig/testsuite/gas/arm/weakdef-2.l gas/testsuite/gas/arm/weakdef-2.l | ||
| 221 | --- a/gas/testsuite/gas/arm/weakdef-2.l 1970-01-01 00:00:00.000000000 +0000 | ||
| 222 | +++ b/gas/testsuite/gas/arm/weakdef-2.l 2010-05-06 12:52:25.391085365 +0000 | ||
| 223 | @@ -0,0 +1,3 @@ | ||
| 224 | +[^:]*: Assembler messages: | ||
| 225 | +[^:]*:9: Error: symbol Weak is weak and may be overridden later | ||
| 226 | +[^:]*:10: Error: symbol Weak is weak and may be overridden later | ||
| 227 | diff -urN gas.orig/testsuite/gas/arm/weakdef-2.s gas/testsuite/gas/arm/weakdef-2.s | ||
| 228 | --- a/gas/testsuite/gas/arm/weakdef-2.s 1970-01-01 00:00:00.000000000 +0000 | ||
| 229 | +++ b/gas/testsuite/gas/arm/weakdef-2.s 2010-05-06 12:52:25.391085365 +0000 | ||
| 230 | @@ -0,0 +1,10 @@ | ||
| 231 | + .syntax unified | ||
| 232 | + .text | ||
| 233 | + .globl Strong | ||
| 234 | +Strong: | ||
| 235 | + adrl r0,Strong | ||
| 236 | + adr r0,Strong | ||
| 237 | + .globl Weak | ||
| 238 | + .weak Weak | ||
| 239 | +Weak: adrl r0,Weak | ||
| 240 | + adr r0,Weak | ||
diff --git a/meta-oe/recipes-devtools/binutils/binutils-2.20.1/200_elflink_%B_fixes.patch b/meta-oe/recipes-devtools/binutils/binutils-2.20.1/200_elflink_%B_fixes.patch new file mode 100644 index 0000000000..ac8168574e --- /dev/null +++ b/meta-oe/recipes-devtools/binutils/binutils-2.20.1/200_elflink_%B_fixes.patch | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run | ||
| 2 | ## 200_elflink_%B_fixes.dpatch by <kirr@landau.phys.spbu.ru> | ||
| 3 | ## | ||
| 4 | ## All lines beginning with `## DP:' are a description of the patch. | ||
| 5 | ## DP: Description: Fixes several msgs; needed for later elflink patches | ||
| 6 | ## DP: Upstream status: submitted upstream for binutils-2_20-branch | ||
| 7 | |||
| 8 | 2010-08-07 Kirill Smelkov <kirr@landau.phys.spbu.ru> | ||
| 9 | |||
| 10 | Backport from mainline: | ||
| 11 | 2009-10-12 Roland McGrath <roland@frob.com> | ||
| 12 | |||
| 13 | * elflink.c (elf_link_add_object_symbols, _bfd_elf_merge_symbol): | ||
| 14 | Fix %s that should be %B in several message formats. | ||
| 15 | |||
| 16 | @DPATCH@ | ||
| 17 | diff --git a/bfd/elflink.c b/bfd/elflink.c | ||
| 18 | index c42c6e1..4a348de 100644 | ||
| 19 | --- a/bfd/elflink.c | ||
| 20 | +++ b/bfd/elflink.c | ||
| 21 | @@ -1110,19 +1110,19 @@ _bfd_elf_merge_symbol (bfd *abfd, | ||
| 22 | |||
| 23 | if (tdef && ntdef) | ||
| 24 | (*_bfd_error_handler) | ||
| 25 | - (_("%s: TLS definition in %B section %A mismatches non-TLS definition in %B section %A"), | ||
| 26 | + (_("%B: TLS definition in %B section %A mismatches non-TLS definition in %B section %A"), | ||
| 27 | tbfd, tsec, ntbfd, ntsec, h->root.root.string); | ||
| 28 | else if (!tdef && !ntdef) | ||
| 29 | (*_bfd_error_handler) | ||
| 30 | - (_("%s: TLS reference in %B mismatches non-TLS reference in %B"), | ||
| 31 | + (_("%B: TLS reference in %B mismatches non-TLS reference in %B"), | ||
| 32 | tbfd, ntbfd, h->root.root.string); | ||
| 33 | else if (tdef) | ||
| 34 | (*_bfd_error_handler) | ||
| 35 | - (_("%s: TLS definition in %B section %A mismatches non-TLS reference in %B"), | ||
| 36 | + (_("%B: TLS definition in %B section %A mismatches non-TLS reference in %B"), | ||
| 37 | tbfd, tsec, ntbfd, h->root.root.string); | ||
| 38 | else | ||
| 39 | (*_bfd_error_handler) | ||
| 40 | - (_("%s: TLS reference in %B mismatches non-TLS definition in %B section %A"), | ||
| 41 | + (_("%B: TLS reference in %B mismatches non-TLS definition in %B section %A"), | ||
| 42 | tbfd, ntbfd, ntsec, h->root.root.string); | ||
| 43 | |||
| 44 | bfd_set_error (bfd_error_bad_value); | ||
| 45 | @@ -4437,7 +4437,7 @@ error_free_dyn: | ||
| 46 | if ((elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0) | ||
| 47 | { | ||
| 48 | (*_bfd_error_handler) | ||
| 49 | - (_("%s: invalid DSO for symbol `%s' definition"), | ||
| 50 | + (_("%B: invalid DSO for symbol `%s' definition"), | ||
| 51 | abfd, name); | ||
| 52 | bfd_set_error (bfd_error_bad_value); | ||
| 53 | goto error_free_vers; | ||
| 54 | @@ -12495,7 +12495,7 @@ _bfd_elf_get_dynamic_reloc_section (bfd * abfd, | ||
| 55 | section does not exist it is created and attached to the DYNOBJ | ||
| 56 | bfd and stored in the SRELOC field of SEC's elf_section_data | ||
| 57 | structure. | ||
| 58 | - | ||
| 59 | + | ||
| 60 | ALIGNMENT is the alignment for the newly created section and | ||
| 61 | IS_RELA defines whether the name should be .rela.<SEC's name> | ||
| 62 | or .rel.<SEC's name>. The section name is looked up in the | ||
| 63 | -- | ||
| 64 | 1.7.2.1.44.g721e7 | ||
| 65 | |||
diff --git a/meta-oe/recipes-devtools/binutils/binutils-2.20.1/201_elflink_improve_noaddneeded_errors.patch b/meta-oe/recipes-devtools/binutils/binutils-2.20.1/201_elflink_improve_noaddneeded_errors.patch new file mode 100644 index 0000000000..85675a3d9e --- /dev/null +++ b/meta-oe/recipes-devtools/binutils/binutils-2.20.1/201_elflink_improve_noaddneeded_errors.patch | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run | ||
| 2 | ## 201_elflink_improve_errors.dpatch by <kirr@landau.phys.spbu.ru> | ||
| 3 | ## | ||
| 4 | ## All lines beginning with `## DP:' are a description of the patch. | ||
| 5 | ## DP: Improves error messages regarding -no-add-needed cases; needed for | ||
| 6 | ## DP: later elflink patches | ||
| 7 | ## DP: Upstream status: submitted upstream for binutils-2_20-branch | ||
| 8 | |||
| 9 | 2010-08-07 Kirill Smelkov <kirr@landau.phys.spbu.ru> | ||
| 10 | |||
| 11 | Backport from mainline: | ||
| 12 | 2009-11-05 Nick Clifton <nickc@redhat.com> | ||
| 13 | |||
| 14 | * elflink.c (elf_link_add_object_symbols): Improve error | ||
| 15 | message generated when a symbol is left unresolved because a | ||
| 16 | --no-add-needed command line option has prevented the | ||
| 17 | inclusion of the DSO defining it. | ||
| 18 | |||
| 19 | @DPATCH@ | ||
| 20 | diff --git a/bfd/elflink.c b/bfd/elflink.c | ||
| 21 | index 4a348de..10eee8c 100644 | ||
| 22 | --- a/bfd/elflink.c | ||
| 23 | +++ b/bfd/elflink.c | ||
| 24 | @@ -3866,6 +3866,7 @@ error_free_dyn: | ||
| 25 | bfd_boolean common; | ||
| 26 | unsigned int old_alignment; | ||
| 27 | bfd *old_bfd; | ||
| 28 | + bfd * undef_bfd = NULL; | ||
| 29 | |||
| 30 | override = FALSE; | ||
| 31 | |||
| 32 | @@ -4097,6 +4098,20 @@ error_free_dyn: | ||
| 33 | name = newname; | ||
| 34 | } | ||
| 35 | |||
| 36 | + /* If this is a definition of a previously undefined symbol | ||
| 37 | + make a note of the bfd that contained the reference in | ||
| 38 | + case we need to refer to it later on in error messages. */ | ||
| 39 | + if (! bfd_is_und_section (sec)) | ||
| 40 | + { | ||
| 41 | + h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE); | ||
| 42 | + | ||
| 43 | + if (h != NULL | ||
| 44 | + && (h->root.type == bfd_link_hash_undefined | ||
| 45 | + || h->root.type == bfd_link_hash_undefweak) | ||
| 46 | + && h->root.u.undef.abfd) | ||
| 47 | + undef_bfd = h->root.u.undef.abfd; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | if (!_bfd_elf_merge_symbol (abfd, info, name, isym, &sec, | ||
| 51 | &value, &old_alignment, | ||
| 52 | sym_hash, &skip, &override, | ||
| 53 | @@ -4437,9 +4452,12 @@ error_free_dyn: | ||
| 54 | if ((elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0) | ||
| 55 | { | ||
| 56 | (*_bfd_error_handler) | ||
| 57 | - (_("%B: invalid DSO for symbol `%s' definition"), | ||
| 58 | + (_("%B: undefined reference to symbol '%s'"), | ||
| 59 | + undef_bfd == NULL ? info->output_bfd : undef_bfd, name); | ||
| 60 | + (*_bfd_error_handler) | ||
| 61 | + (_("note: '%s' is defined in DSO %B so try adding it to the linker command line"), | ||
| 62 | abfd, name); | ||
| 63 | - bfd_set_error (bfd_error_bad_value); | ||
| 64 | + bfd_set_error (bfd_error_invalid_operation); | ||
| 65 | goto error_free_vers; | ||
| 66 | } | ||
| 67 | |||
| 68 | -- | ||
| 69 | 1.7.2.1.44.g721e7 | ||
| 70 | |||
diff --git a/meta-oe/recipes-devtools/binutils/binutils-2.20.1/202_elflink_noaddneeded_vs_weak.patch b/meta-oe/recipes-devtools/binutils/binutils-2.20.1/202_elflink_noaddneeded_vs_weak.patch new file mode 100644 index 0000000000..a7dbc7ad82 --- /dev/null +++ b/meta-oe/recipes-devtools/binutils/binutils-2.20.1/202_elflink_noaddneeded_vs_weak.patch | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run | ||
| 2 | ## 202_elflink_noaddneeded_vs_weak.dpatch by <kirr@landau.phys.spbu.ru> | ||
| 3 | ## | ||
| 4 | ## All lines beginning with `## DP:' are a description of the patch. | ||
| 5 | ## DP: Fixes '-no-add-needed breaks linking with weak symbols' | ||
| 6 | ## DP: Upstream status: submitted upstream for binutils-2_20-branch | ||
| 7 | |||
| 8 | |||
| 9 | 2010-08-07 Kirill Smelkov <kirr@landau.phys.spbu.ru> | ||
| 10 | |||
| 11 | Backport from mainline: | ||
| 12 | 2010-01-21 Nick Clifton <nickc@redhat.com> | ||
| 13 | |||
| 14 | * elflink.c (elf_link_add_object_symbols): Look up name of | ||
| 15 | undefined symbol both before and after versioning has been | ||
| 16 | applied. Do not bother with symbols that are weakly undefined. | ||
| 17 | |||
| 18 | |||
| 19 | @DPATCH@ | ||
| 20 | diff --git a/bfd/elflink.c b/bfd/elflink.c | ||
| 21 | index 10eee8c..e058064 100644 | ||
| 22 | --- a/bfd/elflink.c | ||
| 23 | +++ b/bfd/elflink.c | ||
| 24 | @@ -3991,6 +3991,20 @@ error_free_dyn: | ||
| 25 | unsigned int vernum = 0; | ||
| 26 | bfd_boolean skip; | ||
| 27 | |||
| 28 | + /* If this is a definition of a symbol which was previously | ||
| 29 | + referenced in a non-weak manner then make a note of the bfd | ||
| 30 | + that contained the reference. This is used if we need to | ||
| 31 | + refer to the source of the reference later on. */ | ||
| 32 | + if (! bfd_is_und_section (sec)) | ||
| 33 | + { | ||
| 34 | + h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE); | ||
| 35 | + | ||
| 36 | + if (h != NULL | ||
| 37 | + && h->root.type == bfd_link_hash_undefined | ||
| 38 | + && h->root.u.undef.abfd) | ||
| 39 | + undef_bfd = h->root.u.undef.abfd; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | if (ever == NULL) | ||
| 43 | { | ||
| 44 | if (info->default_imported_symver) | ||
| 45 | @@ -4098,16 +4112,15 @@ error_free_dyn: | ||
| 46 | name = newname; | ||
| 47 | } | ||
| 48 | |||
| 49 | - /* If this is a definition of a previously undefined symbol | ||
| 50 | - make a note of the bfd that contained the reference in | ||
| 51 | - case we need to refer to it later on in error messages. */ | ||
| 52 | - if (! bfd_is_und_section (sec)) | ||
| 53 | + /* If necessary, make a second attempt to locate the bfd | ||
| 54 | + containing an unresolved, non-weak reference to the | ||
| 55 | + current symbol. */ | ||
| 56 | + if (! bfd_is_und_section (sec) && undef_bfd == NULL) | ||
| 57 | { | ||
| 58 | h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE); | ||
| 59 | |||
| 60 | if (h != NULL | ||
| 61 | - && (h->root.type == bfd_link_hash_undefined | ||
| 62 | - || h->root.type == bfd_link_hash_undefweak) | ||
| 63 | + && h->root.type == bfd_link_hash_undefined | ||
| 64 | && h->root.u.undef.abfd) | ||
| 65 | undef_bfd = h->root.u.undef.abfd; | ||
| 66 | } | ||
| 67 | @@ -4448,12 +4461,14 @@ error_free_dyn: | ||
| 68 | /* A symbol from a library loaded via DT_NEEDED of some | ||
| 69 | other library is referenced by a regular object. | ||
| 70 | Add a DT_NEEDED entry for it. Issue an error if | ||
| 71 | - --no-add-needed is used. */ | ||
| 72 | - if ((elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0) | ||
| 73 | + --no-add-needed is used and the reference was not | ||
| 74 | + a weak one. */ | ||
| 75 | + if (undef_bfd != NULL | ||
| 76 | + && (elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0) | ||
| 77 | { | ||
| 78 | (*_bfd_error_handler) | ||
| 79 | (_("%B: undefined reference to symbol '%s'"), | ||
| 80 | - undef_bfd == NULL ? info->output_bfd : undef_bfd, name); | ||
| 81 | + undef_bfd, name); | ||
| 82 | (*_bfd_error_handler) | ||
| 83 | (_("note: '%s' is defined in DSO %B so try adding it to the linker command line"), | ||
| 84 | abfd, name); | ||
| 85 | -- | ||
| 86 | 1.7.2.1.44.g721e7 | ||
| 87 | |||
diff --git a/meta-oe/recipes-devtools/binutils/binutils_2.20.1.bb b/meta-oe/recipes-devtools/binutils/binutils_2.20.1.bb index 6961a46f7f..2558bdaa08 100644 --- a/meta-oe/recipes-devtools/binutils/binutils_2.20.1.bb +++ b/meta-oe/recipes-devtools/binutils/binutils_2.20.1.bb | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | require binutils.inc | 1 | require binutils.inc |
| 2 | 2 | ||
| 3 | PR = "r5" | 3 | PR = "r6" |
| 4 | 4 | ||
| 5 | LIC_FILES_CHKSUM="\ | 5 | LIC_FILES_CHKSUM="\ |
| 6 | file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\ | 6 | file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\ |
| @@ -30,6 +30,10 @@ SRC_URI = "\ | |||
| 30 | file://libiberty_path_fix.patch \ | 30 | file://libiberty_path_fix.patch \ |
| 31 | file://binutils-poison.patch \ | 31 | file://binutils-poison.patch \ |
| 32 | file://libtool-rpath-fix.patch \ | 32 | file://libtool-rpath-fix.patch \ |
| 33 | file://152_arm_branches_to_weak_symbols.patch \ | ||
| 34 | file://200_elflink_%B_fixes.patch \ | ||
| 35 | file://201_elflink_improve_noaddneeded_errors.patch \ | ||
| 36 | file://202_elflink_noaddneeded_vs_weak.patch \ | ||
| 33 | " | 37 | " |
| 34 | 38 | ||
| 35 | SRC_URI[md5sum] = "9cdfb9d6ec0578c166d3beae5e15c4e5" | 39 | SRC_URI[md5sum] = "9cdfb9d6ec0578c166d3beae5e15c4e5" |
