• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2
3### Make sure that we do not merge data.
4# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
5# RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s
6# RUN: llvm-readelf -S -W %t2 | FileCheck --check-prefix=SEC %s
7
8# SEC:  .rodata      PROGBITS  0000000000200120 000120 000002 00 A 0 0 1
9
10# CHECK-NOT: selected section {{.*}}:(.rodata.d1)
11# CHECK-NOT: selected section {{.*}}:(.rodata.d2)
12
13# We do merge rodata if passed --icf-data
14# RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections --ignore-data-address-equality | \
15# RUN:   FileCheck --check-prefix=DATA %s
16# RUN: llvm-readelf -S -W %t2 | FileCheck --check-prefix=DATA-SEC %s
17
18# DATA: selected section {{.*}}:(.rodata.d1)
19# DATA:   removing identical section {{.*}}:(.rodata.d2)
20
21# DATA-SEC:  .rodata      PROGBITS  0000000000200120 000120 000001 00 A 0 0 1
22
23.globl _start, d1, d2
24_start:
25  ret
26
27.section .rodata.d1, "a"
28d1:
29  .byte 1
30
31.section .rodata.d2, "a"
32d2:
33  .byte 1
34