2017-03-01 06:42:49 +08:00
|
|
|
# REQUIRES: x86
|
|
|
|
|
|
|
|
### Make sure that we do not merge data.
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
|
2018-06-22 23:08:01 +08:00
|
|
|
# RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s
|
2017-12-11 09:06:39 +08:00
|
|
|
# RUN: llvm-readelf -S -W %t2 | FileCheck --check-prefix=SEC %s
|
2017-03-01 06:42:49 +08:00
|
|
|
|
2017-12-11 09:06:39 +08:00
|
|
|
# SEC: .rodata PROGBITS 0000000000200120 000120 000002 00 A 0 0 1
|
|
|
|
|
2018-02-14 06:56:49 +08:00
|
|
|
# CHECK-NOT: selected section {{.*}}:(.rodata.d1)
|
|
|
|
# CHECK-NOT: selected section {{.*}}:(.rodata.d2)
|
2017-03-01 06:42:49 +08:00
|
|
|
|
2017-12-12 09:36:24 +08:00
|
|
|
# We do merge rodata if passed --icf-data
|
2018-02-10 01:55:09 +08:00
|
|
|
# RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections --ignore-data-address-equality | \
|
|
|
|
# RUN: FileCheck --check-prefix=DATA %s
|
2017-12-12 09:36:24 +08:00
|
|
|
# RUN: llvm-readelf -S -W %t2 | FileCheck --check-prefix=DATA-SEC %s
|
|
|
|
|
2018-02-14 06:56:49 +08:00
|
|
|
# DATA: selected section {{.*}}:(.rodata.d1)
|
|
|
|
# DATA: removing identical section {{.*}}:(.rodata.d2)
|
2017-12-12 09:36:24 +08:00
|
|
|
|
|
|
|
# DATA-SEC: .rodata PROGBITS 0000000000200120 000120 000001 00 A 0 0 1
|
|
|
|
|
2017-03-01 06:42:49 +08:00
|
|
|
.globl _start, d1, d2
|
|
|
|
_start:
|
|
|
|
ret
|
|
|
|
|
2017-12-12 09:36:24 +08:00
|
|
|
.section .rodata.d1, "a"
|
2017-03-01 06:42:49 +08:00
|
|
|
d1:
|
|
|
|
.byte 1
|
|
|
|
|
2017-12-12 09:36:24 +08:00
|
|
|
.section .rodata.d2, "a"
|
2017-03-01 06:42:49 +08:00
|
|
|
d2:
|
|
|
|
.byte 1
|