summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-05-18 05:09:56 -0400
committermidipix <writeonce@midipix.org>2016-05-18 14:49:24 -0400
commit11489e4bc6d0c6eaa68df5fefb6ebfb982f9b5c7 (patch)
tree9d08d8fdd37febc392d428cf3748ab0440bebb94 /README
parent2fbdf2a35af928d23045d55a3a9c5ee1152f5046 (diff)
downloadchainport-11489e4bc6d0c6eaa68df5fefb6ebfb982f9b5c7.tar.bz2
chainport-11489e4bc6d0c6eaa68df5fefb6ebfb982f9b5c7.tar.xz
binutils-2.24.51: updated patch.
+ PE/COFF: properly handle references to addresses of weak data symbols. + a special thanks to Rich Felker, primary author of musl libc, for invaluable help and direction. + while commit 8dfab477 did resolve binutils bug 16858, it did not address the issue of references to weak data symbols. Before this patch, assembly of the the following minimal example would result in p holding offset of dummy from the beginning of the .data section which is always wrong (weak data symbols should be treated the same way as external symbols) and never needed, namely since the recorded dependency on 'a' suffices for the linker even in cases where the strong symbol 'a' is not present. + relevant code path: md_apply_fix(): for PE targets, and given a relocation based on a weak symbol that is *not* a function, store the inverse of the symbol value, retrieved via S_GET_VALUE (fixP->fx_addsy); bfd_install_relocation(): here we relocate based on the weak symbol's value: relocation = symbol->value; this value is later added to the value that was stored to memory in the previous step: DOIT(x); the result is zero plus any offset that is symbol-relative (array member, etc.) == TEST CASE == .data .globl top .balign 8 top: .quad 0x12345678 .balign 4 dummy: .long 7 .globl p .balign 8 p: .quad a .weak a .set a,dummy == VERIFICATION == a.o: file format pe-x86-64 Disassembly of section .data: 0000000000000000 <top>: 0: 78 56 js 58 <p+0x48> 2: 34 12 xor $0x12,%al 4: 00 00 add %al,(%rax) ... 0000000000000008 <.weak.a.top>: 8: 07 (bad) 9: 00 00 add %al,(%rax) b: 00 00 add %al,(%rax) d: 00 00 add %al,(%rax) ... 0000000000000010 <p>: ... 10: R_X86_64_64 a signed-off by Z. Gilboa; see copying.midipix (9cd0746c) for additional information.
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions