diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ELF/Inputs/arm-vfp-arg-base.s | 16 | ||||
-rw-r--r-- | test/ELF/Inputs/arm-vfp-arg-compat.s | 16 | ||||
-rw-r--r-- | test/ELF/Inputs/arm-vfp-arg-toolchain.s | 15 | ||||
-rw-r--r-- | test/ELF/Inputs/arm-vfp-arg-vfp.s | 15 | ||||
-rw-r--r-- | test/ELF/Inputs/icf-absolute2.s | 3 | ||||
-rw-r--r-- | test/ELF/arm-eabi-version.s | 1 | ||||
-rw-r--r-- | test/ELF/arm-tag-vfp-args-errs.s | 29 | ||||
-rw-r--r-- | test/ELF/arm-tag-vfp-args-illegal.s | 21 | ||||
-rw-r--r-- | test/ELF/arm-tag-vfp-args.s | 72 | ||||
-rw-r--r-- | test/ELF/execute-only-mixed-data.s | 26 | ||||
-rw-r--r-- | test/ELF/execute-only.s | 10 | ||||
-rw-r--r-- | test/ELF/hexagon.s | 7 | ||||
-rw-r--r-- | test/ELF/icf-absolute2.s | 21 | ||||
-rw-r--r-- | test/ELF/icf-safe.s | 48 | ||||
-rw-r--r-- | test/ELF/icf17.s | 15 | ||||
-rw-r--r-- | test/ELF/linkerscript/orphan-report.s | 1 | ||||
-rw-r--r-- | test/ELF/lto/Inputs/libcall-archive.ll | 6 | ||||
-rw-r--r-- | test/ELF/lto/libcall-archive.ll | 20 | ||||
-rw-r--r-- | test/ELF/oformat-binary.s | 2 | ||||
-rw-r--r-- | test/ELF/relocatable-many-sections.s | 41 |
20 files changed, 349 insertions, 36 deletions
diff --git a/test/ELF/Inputs/arm-vfp-arg-base.s b/test/ELF/Inputs/arm-vfp-arg-base.s new file mode 100644 index 0000000000000..9625c0a7ceff1 --- /dev/null +++ b/test/ELF/Inputs/arm-vfp-arg-base.s @@ -0,0 +1,16 @@ + .arch armv7-a + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 2 + .eabi_attribute 30, 6 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .eabi_attribute 28, 0 // Tag_ABI_VFP_args = 0 (AAPCS, Base variant) + + .syntax unified + .global f0 + .type f0, %function +f0: bx lr diff --git a/test/ELF/Inputs/arm-vfp-arg-compat.s b/test/ELF/Inputs/arm-vfp-arg-compat.s new file mode 100644 index 0000000000000..78f6ef6854b1e --- /dev/null +++ b/test/ELF/Inputs/arm-vfp-arg-compat.s @@ -0,0 +1,16 @@ + .arch armv7-a + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 2 + .eabi_attribute 30, 6 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .eabi_attribute 28, 3 // Tag_ABI_VFP_args = 3 (Compatible with all) + + .syntax unified + .global f3 + .type f3, %function +f3: bx lr diff --git a/test/ELF/Inputs/arm-vfp-arg-toolchain.s b/test/ELF/Inputs/arm-vfp-arg-toolchain.s new file mode 100644 index 0000000000000..bc8eb14e34426 --- /dev/null +++ b/test/ELF/Inputs/arm-vfp-arg-toolchain.s @@ -0,0 +1,15 @@ + .arch armv7-a + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 2 + .eabi_attribute 30, 6 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .eabi_attribute 28, 2 // Tag_ABI_VFP_args = 2 (Toolchain specific) + .syntax unified + .global f2 + .type f1, %function +f2: bx lr diff --git a/test/ELF/Inputs/arm-vfp-arg-vfp.s b/test/ELF/Inputs/arm-vfp-arg-vfp.s new file mode 100644 index 0000000000000..e8c8a66a2cede --- /dev/null +++ b/test/ELF/Inputs/arm-vfp-arg-vfp.s @@ -0,0 +1,15 @@ + .arch armv7-a + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 2 + .eabi_attribute 30, 6 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .eabi_attribute 28, 1 // Tag_ABI_VFP_args = 1 (AAPCS, VFP variant) + .syntax unified + .global f1 + .type f1, %function +f1: bx lr diff --git a/test/ELF/Inputs/icf-absolute2.s b/test/ELF/Inputs/icf-absolute2.s new file mode 100644 index 0000000000000..1092c58ae7082 --- /dev/null +++ b/test/ELF/Inputs/icf-absolute2.s @@ -0,0 +1,3 @@ +.globl a1, a2 +a1 = 1 +a2 = 2 diff --git a/test/ELF/arm-eabi-version.s b/test/ELF/arm-eabi-version.s index a08374c132f0a..4b4f8603db6aa 100644 --- a/test/ELF/arm-eabi-version.s +++ b/test/ELF/arm-eabi-version.s @@ -9,6 +9,7 @@ _start: bx lr // CHECK: Flags [ +// CHECK-NEXT: 0x200 // CHECK-NEXT: 0x1000000 // CHECK-NEXT: 0x4000000 // CHECK-NEXT: ] diff --git a/test/ELF/arm-tag-vfp-args-errs.s b/test/ELF/arm-tag-vfp-args-errs.s new file mode 100644 index 0000000000000..622cea07a0447 --- /dev/null +++ b/test/ELF/arm-tag-vfp-args-errs.s @@ -0,0 +1,29 @@ +// REQUIRES:arm +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/arm-vfp-arg-base.s -o %tbase.o +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/arm-vfp-arg-vfp.s -o %tvfp.o +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/arm-vfp-arg-toolchain.s -o %ttoolchain.o +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o +// RUN: not ld.lld %t.o %tbase.o %tvfp.o -o%t 2>&1 | FileCheck %s +// RUN: not ld.lld %t.o %tbase.o %ttoolchain.o -o%t 2>&1 | FileCheck %s +// RUN: not ld.lld %t.o %tvfp.o %tbase.o -o%t 2>&1 | FileCheck %s +// RUN: not ld.lld %t.o %tvfp.o %ttoolchain.o -o%t 2>&1 | FileCheck %s +// RUN: not ld.lld %t.o %ttoolchain.o %tbase.o -o%t 2>&1 | FileCheck %s +// RUN: not ld.lld %t.o %ttoolchain.o %tvfp.o -o%t 2>&1 | FileCheck %s + +// CHECK: incompatible Tag_ABI_VFP_args + .arch armv7-a + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 2 + .eabi_attribute 30, 6 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .eabi_attribute 28, 3 // Tag_ABI_VFP_args = 3 (Compatible with all) + + .syntax unified + .globl _start + .type _start, %function +_start: bx lr diff --git a/test/ELF/arm-tag-vfp-args-illegal.s b/test/ELF/arm-tag-vfp-args-illegal.s new file mode 100644 index 0000000000000..471a024b3c094 --- /dev/null +++ b/test/ELF/arm-tag-vfp-args-illegal.s @@ -0,0 +1,21 @@ +// REQUIRES:arm +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o +// RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s + +// CHECK: arm-tag-vfp-args-illegal.s.tmp.o: unknown Tag_ABI_VFP_args value: 5 + .arch armv7-a + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 2 + .eabi_attribute 30, 6 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .eabi_attribute 28, 5 // Tag_ABI_VFP_args = 5 (Illegal value) + + .syntax unified + .globl _start + .type _start, %function +_start: bx lr diff --git a/test/ELF/arm-tag-vfp-args.s b/test/ELF/arm-tag-vfp-args.s new file mode 100644 index 0000000000000..b0ff095687f15 --- /dev/null +++ b/test/ELF/arm-tag-vfp-args.s @@ -0,0 +1,72 @@ +// REQUIRES:arm +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/arm-vfp-arg-base.s -o %tbase.o +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/arm-vfp-arg-vfp.s -o %tvfp.o +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/arm-vfp-arg-toolchain.s -o %ttoolchain.o +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/arm-vfp-arg-compat.s -o %tcompat.o +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o + +// The default for this file is 0 (Base AAPCS) +// RUN: ld.lld %t.o -o %tdefault +// RUN: llvm-readobj -file-headers %tdefault | FileCheck -check-prefix=CHECK-BASE %s + +// Expect explicit Base AAPCS. +// RUN: ld.lld %t.o %tbase.o -o %tbase +// RUN: llvm-readobj -file-headers %tbase | FileCheck -check-prefix=CHECK-BASE %s + +// Expect explicit Base AAPCS when linking Base and Compatible. +// RUN: ld.lld %t.o %tbase.o %tcompat.o -o %tbasecompat +// RUN: llvm-readobj -file-headers %tbasecompat | FileCheck -check-prefix=CHECK-BASE %s + +// CHECK-BASE: Flags [ (0x5000200) +// CHECK-BASE-NEXT: 0x200 +// CHECK-BASE-NEXT: 0x1000000 +// CHECK-BASE-NEXT: 0x4000000 +// CHECK-BASE-NEXT: ] + +// Expect Hard float VFP AAPCS +// RUN: ld.lld %t.o %tvfp.o -o %tvfp +// RUN: llvm-readobj -file-headers %tvfp | FileCheck -check-prefix=CHECK-VFP %s + +// Expect Hard float VFP AAPCS when linking VFP and Compatible +// RUN: ld.lld %t.o %tvfp.o %tcompat.o -o %tvfpcompat +// RUN: llvm-readobj -file-headers %tvfpcompat | FileCheck -check-prefix=CHECK-VFP %s + +// CHECK-VFP: Flags [ (0x5000400) +// CHECK-VFP-NEXT: 0x400 +// CHECK-VFP-NEXT: 0x1000000 +// CHECK-VFP-NEXT: 0x4000000 +// CHECK-VFP-NEXT: ] + +// Expect Toolchain specifc to not use either Base or VFP AAPCS +// RUN: ld.lld %t.o %ttoolchain.o -o %ttoolchain +// RUN: llvm-readobj -file-headers %ttoolchain | FileCheck -check-prefix=CHECK-TOOLCHAIN %s + +// Expect Toolchain and Compatible to have same affect as Toolchain. +// RUN: ld.lld %t.o %ttoolchain.o %tcompat.o -o %ttoolchaincompat +// RUN: llvm-readobj -file-headers %ttoolchaincompat | FileCheck -check-prefix=CHECK-TOOLCHAIN %s + +// CHECK-TOOLCHAIN: Flags [ (0x5000000) +// CHECK-TOOLCHAIN-NEXT: 0x1000000 +// CHECK-TOOLCHAIN-NEXT: 0x4000000 +// CHECK-TOOLCHAIN-NEXT: ] + + .arch armv7-a + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 2 + .eabi_attribute 30, 6 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + // We do not specify Tag_ABI_VFP_args (.eabi_attribute 28) in this file. + // When omitted the value of the tag defaults to 0, however if there + // are other files with explicit Tag_ABI_VFP_args we use that in + // preference. + + + .syntax unified + .globl _start + .type _start, %function +_start: bx lr diff --git a/test/ELF/execute-only-mixed-data.s b/test/ELF/execute-only-mixed-data.s new file mode 100644 index 0000000000000..6ef62368123f7 --- /dev/null +++ b/test/ELF/execute-only-mixed-data.s @@ -0,0 +1,26 @@ +// REQUIRES: aarch64 + +// RUN: llvm-mc -filetype=obj -triple=aarch64-linux-none %s -o %t.o + +// RUN: echo "SECTIONS \ +// RUN: { \ +// RUN: .text : { *(.text) *(.rodata.foo) } \ +// RUN: .rodata : { *(.rodata.bar) } \ +// RUN: }" > %t.lds +// RUN: not ld.lld -T%t.lds %t.o -o %t -execute-only 2>&1 | FileCheck %s + +// RUN: echo "SECTIONS \ +// RUN: { \ +// RUN: .text : { *(.text) } \ +// RUN: .rodata : { *(.rodata.bar) *(.rodata.foo) } \ +// RUN: }" > %t.lds +// RUN: ld.lld -T%t.lds %t.o -o %t -execute-only 2>&1 + +// CHECK: -execute-only does not support intermingling data and code + + br lr + +.section .rodata.foo +.word 0x1 +.section .rodata.bar +.word 0x2 diff --git a/test/ELF/execute-only.s b/test/ELF/execute-only.s new file mode 100644 index 0000000000000..7a825cb7a1883 --- /dev/null +++ b/test/ELF/execute-only.s @@ -0,0 +1,10 @@ +// REQUIRES: aarch64 + +// RUN: llvm-mc -filetype=obj -triple=aarch64-linux-none %s -o %t.o +// RUN: ld.lld -Ttext=0xcafe0000 %t.o -o %t.so -shared -execute-only +// RUN: llvm-readelf -l %t.so | FileCheck %s + +// CHECK: LOAD {{.*}} 0x00000000cafe0000 0x000004 0x000004 E 0x{{.*}} +// CHECK-NOT: LOAD {{.*}} 0x00000000cafe0000 0x000004 0x000004 R E 0x{{.*}} + + br lr diff --git a/test/ELF/hexagon.s b/test/ELF/hexagon.s index 8c824ea3c78af..1b3273374c67f 100644 --- a/test/ELF/hexagon.s +++ b/test/ELF/hexagon.s @@ -4,6 +4,13 @@ # RUN: ld.lld %t2 %t -o %t3 # RUN: llvm-objdump -d %t3 | FileCheck %s +# Note: 69632 == 0x11000 +# R_HEX_32_6_X +# R_HEX_12_X +if (p0) r0 = ##_start +# CHECK: immext(#69632) +# CHECK: if (p0) r0 = ##69632 + # R_HEX_B15_PCREL if (p0) jump:nt #_start # CHECK: if (p0) jump:nt 0x11000 diff --git a/test/ELF/icf-absolute2.s b/test/ELF/icf-absolute2.s new file mode 100644 index 0000000000000..37e26a9d9c46b --- /dev/null +++ b/test/ELF/icf-absolute2.s @@ -0,0 +1,21 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-absolute2.s -o %t2 +# RUN: ld.lld %t %t2 -o /dev/null --icf=all --print-icf-sections | FileCheck -allow-empty %s + +## Test we do not crash and do not fold sections which relocations reffering to +## absolute symbols with a different values. +# CHECK-NOT: selected + +.globl _start, f1, f2 +_start: + ret + +.section .text.f1, "ax" +f1: + .byte a1 + +.section .text.f2, "ax" +f2: + .byte a2 diff --git a/test/ELF/icf-safe.s b/test/ELF/icf-safe.s index b001fcc82ce4c..2ced78fbcdc1c 100644 --- a/test/ELF/icf-safe.s +++ b/test/ELF/icf-safe.s @@ -10,10 +10,6 @@ # RUN: ld.lld %t1.o %t2.o -o %t2 --icf=all --print-icf-sections --export-dynamic | FileCheck --check-prefix=ALL-EXPORT %s # RUN: ld.lld %t1copy.o -o %t4 --icf=safe 2>&1 | FileCheck --check-prefix=OBJCOPY %s -# CHECK-NOT: selected section {{.*}}:(.rodata.l1) -# CHECK: selected section {{.*}}:(.rodata.l3) -# CHECK: removing identical section {{.*}}:(.rodata.l4) - # CHECK-NOT: selected section {{.*}}:(.text.f1) # CHECK: selected section {{.*}}:(.text.f3) # CHECK: removing identical section {{.*}}:(.text.f4) @@ -22,6 +18,10 @@ # CHECK: selected section {{.*}}:(.rodata.h3) # CHECK: removing identical section {{.*}}:(.rodata.h4) +# CHECK-NOT: selected section {{.*}}:(.rodata.l1) +# CHECK: selected section {{.*}}:(.rodata.l3) +# CHECK: removing identical section {{.*}}:(.rodata.l4) + # CHECK-NOT: selected section {{.*}}:(.rodata.g1) # CHECK: selected section {{.*}}:(.rodata.g3) # CHECK: removing identical section {{.*}}:(.rodata.g4) @@ -30,26 +30,26 @@ # With --icf=all address-significance implies keep-unique only for rodata, not # text. -# ALL-NOT: selected section {{.*}}:(.rodata.l1) -# ALL: selected section {{.*}}:(.rodata.l3) -# ALL: removing identical section {{.*}}:(.rodata.l4) - # ALL: selected section {{.*}}:(.text.f3) # ALL: removing identical section {{.*}}:(.text.f4) -# ALL: selected section {{.*}}:(.text.f1) -# ALL: removing identical section {{.*}}:(.text.f2) -# ALL: removing identical section {{.*}}:(.text.non_addrsig1) -# ALL: removing identical section {{.*}}:(.text.non_addrsig2) - # ALL-NOT: selected section {{.*}}:(.rodata.h1) # ALL: selected section {{.*}}:(.rodata.h3) # ALL: removing identical section {{.*}}:(.rodata.h4) +# ALL-NOT: selected section {{.*}}:(.rodata.l1) +# ALL: selected section {{.*}}:(.rodata.l3) +# ALL: removing identical section {{.*}}:(.rodata.l4) + # ALL-NOT: selected section {{.*}}:(.rodata.g1) # ALL: selected section {{.*}}:(.rodata.g3) # ALL: removing identical section {{.*}}:(.rodata.g4) +# ALL: selected section {{.*}}:(.text.f1) +# ALL: removing identical section {{.*}}:(.text.f2) +# ALL: removing identical section {{.*}}:(.text.non_addrsig1) +# ALL: removing identical section {{.*}}:(.text.non_addrsig2) + # llvm-mc normally emits an empty .text section into every object file. Since # nothing actually refers to it via a relocation, it doesn't have any associated # symbols (thus nor can anything refer to it via a relocation, making it safe to @@ -58,36 +58,36 @@ # STB_LOCAL or STV_HIDDEN symbols. The dynsym entries should have prevented # anything else from being merged. # EXPORT-NOT: selected section -# EXPORT: selected section {{.*}}:(.rodata.l3) -# EXPORT: removing identical section {{.*}}:(.rodata.l4) -# EXPORT-NOT: selected section # EXPORT: selected section {{.*}}:(.rodata.h3) # EXPORT: removing identical section {{.*}}:(.rodata.h4) # EXPORT-NOT: selected section # EXPORT: selected section {{.*}}:(.text) # EXPORT: removing identical section {{.*}}:(.text) # EXPORT-NOT: selected section +# EXPORT: selected section {{.*}}:(.rodata.l3) +# EXPORT: removing identical section {{.*}}:(.rodata.l4) +# EXPORT-NOT: selected section # If --icf=all is specified when exporting we can also merge the exported text # sections, but not the exported rodata. # ALL-EXPORT-NOT: selected section -# ALL-EXPORT: selected section {{.*}}:(.rodata.l3) -# ALL-EXPORT: removing identical section {{.*}}:(.rodata.l4) -# ALL-EXPORT-NOT: selected section # ALL-EXPORT: selected section {{.*}}:(.text.f3) # ALL-EXPORT: removing identical section {{.*}}:(.text.f4) # ALL-EXPORT-NOT: selected section -# ALL-EXPORT: selected section {{.*}}:(.text.f1) -# ALL-EXPORT: removing identical section {{.*}}:(.text.f2) -# ALL-EXPORT: removing identical section {{.*}}:(.text.non_addrsig1) -# ALL-EXPORT: removing identical section {{.*}}:(.text.non_addrsig2) -# ALL-EXPORT-NOT: selected section # ALL-EXPORT: selected section {{.*}}:(.rodata.h3) # ALL-EXPORT: removing identical section {{.*}}:(.rodata.h4) # ALL-EXPORT-NOT: selected section # ALL-EXPORT: selected section {{.*}}:(.text) # ALL-EXPORT: removing identical section {{.*}}:(.text) # ALL-EXPORT-NOT: selected section +# ALL-EXPORT: selected section {{.*}}:(.rodata.l3) +# ALL-EXPORT: removing identical section {{.*}}:(.rodata.l4) +# ALL-EXPORT-NOT: selected section +# ALL-EXPORT: selected section {{.*}}:(.text.f1) +# ALL-EXPORT: removing identical section {{.*}}:(.text.f2) +# ALL-EXPORT: removing identical section {{.*}}:(.text.non_addrsig1) +# ALL-EXPORT: removing identical section {{.*}}:(.text.non_addrsig2) +# ALL-EXPORT-NOT: selected section # OBJCOPY: --icf=safe is incompatible with object files created using objcopy or ld -r diff --git a/test/ELF/icf17.s b/test/ELF/icf17.s new file mode 100644 index 0000000000000..5d28aeb869c1e --- /dev/null +++ b/test/ELF/icf17.s @@ -0,0 +1,15 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 +# RUN: ld.lld %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s + +# CHECK-NOT: selected + +.section .text +.globl _start +_start: + ret + +.section .aaa, "ax",%progbits,unique,1 +.quad _start + +.section .aaa, "axS",%progbits,unique,2 +.quad _start diff --git a/test/ELF/linkerscript/orphan-report.s b/test/ELF/linkerscript/orphan-report.s index 241857b239c4d..903ef799e7a1f 100644 --- a/test/ELF/linkerscript/orphan-report.s +++ b/test/ELF/linkerscript/orphan-report.s @@ -36,6 +36,7 @@ # REPORT-NEXT: <internal>:(.plt) is being placed in '.plt' # REPORT-NEXT: <internal>:(.eh_frame) is being placed in '.eh_frame' # REPORT-NEXT: <internal>:(.symtab) is being placed in '.symtab' +# REPORT-NEXT: <internal>:(.symtab_shndxr) is being placed in '.symtab_shndxr' # REPORT-NEXT: <internal>:(.shstrtab) is being placed in '.shstrtab' # REPORT-NEXT: <internal>:(.strtab) is being placed in '.strtab' diff --git a/test/ELF/lto/Inputs/libcall-archive.ll b/test/ELF/lto/Inputs/libcall-archive.ll new file mode 100644 index 0000000000000..4e6421c3020f6 --- /dev/null +++ b/test/ELF/lto/Inputs/libcall-archive.ll @@ -0,0 +1,6 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @memcpy() { + ret void +} diff --git a/test/ELF/lto/libcall-archive.ll b/test/ELF/lto/libcall-archive.ll new file mode 100644 index 0000000000000..731e25938bd37 --- /dev/null +++ b/test/ELF/lto/libcall-archive.ll @@ -0,0 +1,20 @@ +; RUN: rm -f %t.a +; RUN: llvm-as -o %t.o %s +; RUN: llvm-as -o %t2.o %S/Inputs/libcall-archive.ll +; RUN: llvm-ar rcs %t.a %t2.o +; RUN: ld.lld -o %t %t.o %t.a +; RUN: llvm-nm %t | FileCheck %s + +; CHECK: T _start +; CHECK: T memcpy + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @_start(i8* %a, i8* %b) { +entry: + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 1024, i1 false) + ret void +} + +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) diff --git a/test/ELF/oformat-binary.s b/test/ELF/oformat-binary.s index 44c7b5ac2d8df..e68f07c57732a 100644 --- a/test/ELF/oformat-binary.s +++ b/test/ELF/oformat-binary.s @@ -19,6 +19,8 @@ # RUN: | FileCheck %s --check-prefix ERR # ERR: unknown --oformat value: foo +# RUN: ld.lld -o /dev/null %t --oformat elf + .text .align 4 .globl _start diff --git a/test/ELF/relocatable-many-sections.s b/test/ELF/relocatable-many-sections.s index df22154d0c9f4..347f3f784f260 100644 --- a/test/ELF/relocatable-many-sections.s +++ b/test/ELF/relocatable-many-sections.s @@ -1,20 +1,32 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t.o # RUN: ld.lld -r %t.o -o %t -# RUN: llvm-readobj -file-headers %t | FileCheck %s -## Check we are able to emit a valid ELF header when -## sections amount is greater than SHN_LORESERVE. -# CHECK: ElfHeader { -# CHECK: SectionHeaderCount: 0 (65541) -# CHECK-NEXT: StringTableSectionIndex: 65535 (65539) +## Check we are able to link against relocatable file produced. +# RUN: ld.lld %t -o %t.out -## Check that 65539 is really the index of .shstrtab section. -# RUN: llvm-objdump -section-headers -section=.shstrtab %t \ -# RUN: | FileCheck %s --check-prefix=SHSTRTAB -# SHSTRTAB: Sections: -# SHSTRTAB-NEXT: Idx Name -# SHSTRTAB-NEXT: 65539 .shstrtab +## Check we emit a valid ELF header when +## sections amount is greater than SHN_LORESERVE. +# RUN: llvm-readobj -file-headers %t | FileCheck %s --check-prefix=HDR +# HDR: ElfHeader { +# HDR: SectionHeaderCount: 0 (65543) +# HDR-NEXT: StringTableSectionIndex: 65535 (65541) + +## Check that: +## 1) 65541 is the index of .shstrtab section. +## 2) .symtab_shndxr is linked with .symtab. +## 3) .symtab_shndxr entry size and alignment == 4. +## 4) .symtab_shndxr has size equal to +## (sizeof(.symtab) / entsize(.symtab)) * entsize(.symtab_shndxr) = 0x4 * 0x180048 / 0x18 == 0x04000c +# RUN: llvm-readelf -sections -symbols %t | FileCheck %s +## [Nr] Name Type Address Off Size ES Flg Lk Inf Al +# CHECK: [65538] .bar +# CHECK-NEXT: [65539] .symtab SYMTAB 0000000000000000 000040 180078 18 65542 65539 8 +# CHECK-NEXT: [65540] .symtab_shndxr SYMTAB SECTION INDICES 0000000000000000 1800b8 040014 04 65539 0 4 +# CHECK-NEXT: [65541] .shstrtab STRTAB 0000000000000000 1c00cc 0f0035 00 0 0 1 +# CHECK-NEXT: [65542] .strtab STRTAB 0000000000000000 2b0101 00000c 00 +# 5) Check we are able to represent symbol foo with section (.bar) index > 0xFF00 (SHN_LORESERVE). +# CHECK: GLOBAL DEFAULT 65538 foo .macro gen_sections4 x .section a\x @@ -88,5 +100,10 @@ gen_sections16384 b gen_sections16384 c gen_sections16384 d +.section .bar +.global foo +foo: + +.section .text, "ax" .global _start _start: |