llvm-capstone/lld/test/ELF/i386-got-and-copy.s
Fangrui Song 055906e1e5 [ELF] -z combreloc: sort dynamic relocations by (!is_relative,symbol_index,r_offset)
We currently sort dynamic relocations by (!is_relative,symbol_index).
Add r_offset as the third key. This makes `readelf -r` debugging easier
(relocations to the same symbol are ordered by r_offset).

Refactor the test combreloc.s (renamed from combrelocs.s) to check
R_X86_64_RELATIVE, and delete --expand-relocs.

The difference from the reverted D61477 is that we keep !is_relative as
the first key. In local dynamic TLS model, DTPMOD (e.g.
R_ARM_TLS_DTPMOD32 R_X86_64_DTPMOD and R_PPC{,64}_DTPMOD) may use 0 as
the symbol index.

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D62141

llvm-svn: 361164
2019-05-20 15:25:01 +00:00

27 lines
889 B
ArmAsm

# REQUIRES: x86
# If there are two relocations such that the first one requires
# dynamic COPY relocation, the second one requires GOT entry
# creation, linker should create both - dynamic relocation
# and GOT entry.
# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux \
# RUN: %S/Inputs/copy-in-shared.s -o %t.so.o
# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t.o
# RUN: ld.lld %t.so.o -shared -o %t.so
# RUN: ld.lld --hash-style=sysv %t.o %t.so -o %t.exe
# RUN: llvm-readobj -r %t.exe | FileCheck %s
# CHECK: Relocations [
# CHECK-NEXT: Section (4) .rel.dyn {
# CHECK-NEXT: 0x{{[0-9A-F]+}} R_386_GLOB_DAT foo
# CHECK-NEXT: 0x{{[0-9A-F]+}} R_386_COPY foo
# CHECK-NEXT: }
# CHECK-NEXT: ]
.text
.global _start
_start:
movl $foo, (%esp) # R_386_32 - requires R_386_COPY relocation
movl foo@GOT, %eax # R_386_GOT32 - requires GOT entry