Browse Source
Since undefined weak symbols in static PIE are always resolved to 0 at run-time, linker should resolve them as 0 at link-time, regardless of whether "-z dynamic-undefined-weak" is used. "-z dynamic-undefined-weak" only makes undefined weak symbols dynamic, but doesn't change undefined weak symbol resolution in static PIE at link-time. These tests currently pass on x86, but fails on many other targets. The framework to resolve weak symbols in static PE at link-time is posted at https://sourceware.org/ml/binutils/2017-10/msg00087.html which requires users/hjl/check_relocs branch to call check_relocs after opening all inputs. I will submit backend patches for failling targets after merging users/hjl/check_relocs branch next. * PR ld/22269 * testsuite/ld-elf/pr22269.s: New file. * testsuite/ld-elf/pr22269a.d: Likewise. * testsuite/ld-elf/pr22269b.d: Likewise.gdb-8.1-branch
4 changed files with 40 additions and 0 deletions
@ -0,0 +1,13 @@ |
|||
.globl main |
|||
.globl start |
|||
.globl _start |
|||
.globl __start |
|||
.text |
|||
main: |
|||
start: |
|||
_start: |
|||
__start: |
|||
.byte 0 |
|||
.section .data.rel.ro.local,"aw",%progbits |
|||
.weak func |
|||
.dc.a func |
|||
@ -0,0 +1,10 @@ |
|||
#name: PR ld/22269 |
|||
#source: pr22269.s |
|||
#ld: -pie --no-dynamic-linker |
|||
#readelf: -r -x .data.rel.ro |
|||
#target: *-*-linux* *-*-gnu* *-*-nacl* |
|||
|
|||
There are no relocations in this file. |
|||
|
|||
Hex dump of section '.data.rel.ro': |
|||
0x[a-f0-9]+ [0 ]+[ ]+.+ |
|||
@ -0,0 +1,10 @@ |
|||
#name: PR ld/22269 (-z dynamic-undefined-weak) |
|||
#source: pr22269.s |
|||
#ld: -pie --no-dynamic-linker -z dynamic-undefined-weak |
|||
#readelf: -r -x .data.rel.ro |
|||
#target: *-*-linux* *-*-gnu* *-*-nacl* |
|||
|
|||
There are no relocations in this file. |
|||
|
|||
Hex dump of section '.data.rel.ro': |
|||
0x[a-f0-9]+ [0 ]+[ ]+.+ |
|||
Loading…
Reference in new issue