llvm-project/lld/test/ELF/linkerscript/got-write-offset.s
Igor Kudrin 202a9f6817 [ELF] Fix writing the content of the .got section in a wrong place.
In filling the .got sections, InputSection::OutSecOff was added twice
when finding the position to apply a relocation: first time in
InputSection::writeTo() and then in SectionBase::getOffset().

Differential revision: https://reviews.llvm.org/D34232

llvm-svn: 308003
2017-07-14 08:10:45 +00:00

24 lines
577 B
ArmAsm

# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux-gnu %s -o %t
# RUN: echo "SECTIONS { \
# RUN: .data 0x1000 : { *(.data) } \
# RUN: .got 0x2000 : { \
# RUN: LONG(0) \
# RUN: *(.got) \
# RUN: } \
# RUN: };" > %t.script
# RUN: ld.lld -shared -o %t.out --script %t.script %t
# RUN: llvm-objdump -s %t.out | FileCheck %s
.text
.global foo
foo:
movl bar@GOT, %eax
.data
.local bar
bar:
.zero 4
# CHECK: Contents of section .data:
# CHECK-NEXT: 1000 00000000
# CHECK: Contents of section .got:
# CHECK-NEXT: 2000 00000000 00100000