mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 19:08:21 +08:00
[ELF,test] Improve weak-undef-got-plt.s
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
# REQUIRES: x86
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/dummy-shared.s -o %t1.o
|
||||
# RUN: ld.lld %t1.o -shared -o %t1.so
|
||||
# RUN: llvm-mc -filetype=obj -x86-relax-relocations=false -triple=x86_64 %s -o %t.o
|
||||
|
||||
# RUN: ld.lld -pie %t.o %t1.so -o %t
|
||||
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOCS %s
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASM %s
|
||||
|
||||
# RELOCS: Relocations [
|
||||
# RELOCS-NEXT: Section ({{.*}}) .rela.dyn {
|
||||
# RELOCS-NEXT: R_X86_64_GLOB_DAT foo 0x0
|
||||
# RELOCS-NEXT: }
|
||||
# RELOCS-NEXT: ]
|
||||
|
||||
.weak foo
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
# DISASM: <_start>:
|
||||
# DISASM-NEXT: movq {{.*}}(%rip), %rax
|
||||
mov foo@gotpcrel(%rip), %rax
|
||||
34
lld/test/ELF/weak-undef-got-plt.s
Normal file
34
lld/test/ELF/weak-undef-got-plt.s
Normal file
@@ -0,0 +1,34 @@
|
||||
# REQUIRES: x86
|
||||
# RUN: rm -rf %t && split-file %s %t && cd %t
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64 -x86-relax-relocations=false a.s -o a.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64 %S/Inputs/shared.s -o s.o
|
||||
# RUN: ld.lld -shared s.o -o s.so
|
||||
|
||||
# RUN: ld.lld a.o -o a
|
||||
# RUN: llvm-readelf -r a | FileCheck %s --check-prefix=NORELOC
|
||||
# RUN: ld.lld a.o s.so -o as
|
||||
# RUN: llvm-objdump -dR as | FileCheck %s
|
||||
|
||||
# RUN: ld.lld -pie a.o s.so -o as.pie
|
||||
# RUN: llvm-objdump -dR as.pie | FileCheck %s
|
||||
|
||||
# RUN: ld.lld -shared a.o -o a.so
|
||||
# RUN: llvm-objdump -dR a.so | FileCheck %s
|
||||
|
||||
# NORELOC: no relocation
|
||||
|
||||
# CHECK: TYPE VALUE
|
||||
# CHECK-NEXT: R_X86_64_GLOB_DAT foo{{$}}
|
||||
# CHECK-NEXT: R_X86_64_JUMP_SLOT foo{{$}}
|
||||
# CHECK-EMPTY:
|
||||
# CHECK: <_start>:
|
||||
# CHECK-NEXT: movq {{.*}}(%rip), %rax
|
||||
# CHECK-NEXT: callq {{.*}} <foo@plt>
|
||||
|
||||
#--- a.s
|
||||
.weak foo
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
mov foo@gotpcrel(%rip), %rax
|
||||
call foo
|
||||
@@ -1,31 +0,0 @@
|
||||
# REQUIRES: x86
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
|
||||
# RUN: ld.lld %t.o -o %t --export-dynamic
|
||||
# RUN: llvm-readelf -r --dyn-syms --hex-dump=.data %t | \
|
||||
# RUN: FileCheck %s --check-prefixes=NORELOC,COMMON
|
||||
|
||||
# NORELOC: There are no relocations in this file.
|
||||
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/dummy-shared.s -o %t1.o
|
||||
# RUN: ld.lld %t1.o -shared -o %t1.so
|
||||
# RUN: ld.lld %t.o -o %t %t1.so -pie
|
||||
# RUN: llvm-readelf -r --dyn-syms --hex-dump=.data %t | \
|
||||
# RUN: FileCheck %s --check-prefixes=RELOC,COMMON
|
||||
|
||||
# RELOC: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries:
|
||||
# RELOC-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
|
||||
# RELOC-NEXT: {{.*}} 0000000100000001 R_X86_64_64 0000000000000000 foo + 0
|
||||
|
||||
# NORELOC-NOT: Symbol table '.dynsym'
|
||||
# RELOC: Symbol table '.dynsym' contains 2 entries:
|
||||
# RELOC-NEXT: Num: Value Size Type Bind Vis Ndx Name
|
||||
# RELOC-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
# RELOC-NEXT: 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND foo
|
||||
# COMMON: Hex dump of section '.data':
|
||||
# COMMON-NEXT: {{.*}} 00000000 00000000
|
||||
# COMMON-EMPTY:
|
||||
|
||||
.weak foo
|
||||
|
||||
.data
|
||||
.dc.a foo
|
||||
Reference in New Issue
Block a user