]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Properly check symbol defined by assignment in linker script
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 1 Dec 2015 22:45:51 +0000 (14:45 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 5 Dec 2015 16:18:59 +0000 (08:18 -0800)
commit97753ee528c1c01e1cf0c7b41b344713103b2631
tree7808c333c672eb37c1914ee9493e7bb05a7f20f1
parent567ebff7fa31d70cd963378c395fcc581ddcb4d7
Properly check symbol defined by assignment in linker script

Symbol defined by a linker assignment may have type bfd_link_hash_new
or bfd_link_hash_undefined.  And h->def_regular is always set.
elf_i386_convert_load and elf_x86_64_convert_load should check
h->def_regular as well as bfd_link_hash_undefined and bfd_link_hash_new
to see if a symbol is defined by a linker script.

bfd/

PR ld/19319
* elf32-i386.c (elf_i386_convert_load): Check h->def_regular
instead of bfd_link_hash_new.
* elf64-x86-64.c (elf_x86_64_convert_load): Likewise.  Skip
relocation overflow for bfd_link_hash_undefined and
bfd_link_hash_new if h->def_regular is set.

ld/testsuite/

PR ld/19319
* ld-i386/i386.exp: Run pr19319 test.
* ld-x86-64/x86-64.exp: Likewise.
* ld-i386/pr19319.dd: New file.
* ld-i386/pr19319a.S: Likewise.
* ld-i386/pr19319b.S: Likewise.
* ld-x86-64/pr19319.dd: Likewise.
* ld-x86-64/pr19319a.S: Likewise.
* ld-x86-64/pr19319b.S: Likewise.

(cherry picked from commit ead3d5427a2df5e33316d4ad045510c1d2078c2a)
12 files changed:
bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c
ld/testsuite/ChangeLog
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/pr19319.dd [new file with mode: 0644]
ld/testsuite/ld-i386/pr19319a.S [new file with mode: 0644]
ld/testsuite/ld-i386/pr19319b.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19319.dd [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19319a.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19319b.S [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp