
#12147: GHC's Linker Should Support Relocation Type 42
-------------------------------------+-------------------------------------
Reporter: gershomb | Owner: Phyx-
Type: bug | Status: patch
Priority: high | Milestone: 8.0.2
Component: Runtime System | Version: 8.0.1
(Linker) |
Resolution: | Keywords:
Operating System: Linux | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2303
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Phyx-):
I haven't written a testcase since you need `binutils-2.26` for it to
trigger and I don't think I can force the test only then.
In any case, simplest case to reproduce this is to compile `GHC` with
`DYNAMIC_GHC_PROGRAMS=NO`
I use this assembly file as input:
{{{
# x86_64
# as as_test.s -o as_test.o && objdump -Dr as_test.o
# ghc --interactive hs_test as_test.o
.text
.globl foo
foo:
push %rbp
mov %rsp, %rbp
mov msg@GOTPCREL(%rip), %rdi
call puts@PLT
pop %rbp
ret
.data
msg:
.ascii "Hello World!\0"
len = . - msg
}}}
Which with
{{{
[phyx@localhost ~]$ as --version
GNU assembler (GNU Binutils) 2.26.20160125
}}}
returns the expected relocation
{{{
[phyx@localhost ~]$ as as_test.s -o as_test.o && objdump -Dr as_test.o
as_test.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <foo>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 48 8b 3d 00 00 00 00 mov 0x0(%rip),%rdi # b