blob: d5a249675482639c6fdcd788d0e6513dbccb889d [file] [log] [blame]
George Rimar0a7412f2017-03-09 08:48:341# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
Rui Ueyamab3ee4322018-03-01 23:01:413# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/ztext.s -o %t2.o
Rafael Espindolad3c22f02017-03-14 22:50:074# RUN: ld.lld %t2.o -o %t2.so -shared
Rui Ueyama88fe5c92018-04-20 21:24:085
Rafael Espindolad3c22f02017-03-14 22:50:076# RUN: ld.lld -z notext %t.o %t2.so -o %t -shared
Fangrui Songb1599062019-05-01 05:49:017# RUN: llvm-readobj --dynamic-table -r %t | FileCheck %s
Rafael Espindolad3c22f02017-03-14 22:50:078# RUN: ld.lld -z notext %t.o %t2.so -o %t2 -pie
Fangrui Songb1599062019-05-01 05:49:019# RUN: llvm-readobj --dynamic-table -r %t2 | FileCheck %s
Rafael Espindolad3c22f02017-03-14 22:50:0710# RUN: ld.lld -z notext %t.o %t2.so -o %t3
Fangrui Songb1599062019-05-01 05:49:0111# RUN: llvm-readobj --dynamic-table -r %t3 | FileCheck --check-prefix=STATIC %s
Rafael Espindolad3c22f02017-03-14 22:50:0712
Rui Ueyama88fe5c92018-04-20 21:24:0813# RUN: not ld.lld %t.o %t2.so -o %t -shared 2>&1 | FileCheck --check-prefix=ERR %s
14# RUN: not ld.lld -z text %t.o %t2.so -o %t -shared 2>&1 | FileCheck --check-prefix=ERR %s
15# ERR: error: can't create dynamic relocation
16
Rafael Espindolad3c22f02017-03-14 22:50:0717# If the preference is to have text relocations, don't create plt of copy relocations.
George Rimar0a7412f2017-03-09 08:48:3418
19# CHECK: Relocations [
Rui Ueyamab3ee4322018-03-01 23:01:4120# CHECK-NEXT: Section {{.*}} .rela.dyn {
21# CHECK-NEXT: 0x1000 R_X86_64_RELATIVE - 0x1000
22# CHECK-NEXT: 0x1008 R_X86_64_64 bar 0x0
23# CHECK-NEXT: 0x1010 R_X86_64_PC64 zed 0x0
24# CHECK-NEXT: }
25# CHECK-NEXT: ]
Rui Ueyama7c18abf2018-03-01 22:56:5226
George Rimar0a7412f2017-03-09 08:48:3427# CHECK: DynamicSection [
Rui Ueyama7c18abf2018-03-01 22:56:5228# CHECK: FLAGS TEXTREL
29# CHECK: TEXTREL 0x0
George Rimar0a7412f2017-03-09 08:48:3430
Rafael Espindolad3c22f02017-03-14 22:50:0731# STATIC: Relocations [
Rui Ueyamab3ee4322018-03-01 23:01:4132# STATIC-NEXT: Section {{.*}} .rela.dyn {
33# STATIC-NEXT: 0x201008 R_X86_64_64 bar 0x0
34# STATIC-NEXT: 0x201010 R_X86_64_PC64 zed 0x0
35# STATIC-NEXT: }
36# STATIC-NEXT: ]
Rui Ueyama7c18abf2018-03-01 22:56:5237
Rafael Espindolad3c22f02017-03-14 22:50:0738# STATIC: DynamicSection [
Rui Ueyama7c18abf2018-03-01 22:56:5239# STATIC: FLAGS TEXTREL
40# STATIC: TEXTREL 0x0
Rafael Espindolad3c22f02017-03-14 22:50:0741
George Rimar0a7412f2017-03-09 08:48:3442foo:
43.quad foo
Rafael Espindolad3c22f02017-03-14 22:50:0744.quad bar
45.quad zed - .