2017-03-02 09:50:34 +08:00
|
|
|
# REQUIRES: x86
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
|
|
|
# RUN: echo "SECTIONS { \
|
|
|
|
# RUN: used_in_reloc : { *(used_in_reloc) } \
|
|
|
|
# RUN: used_in_script : { *(used_in_script) } \
|
2017-03-03 03:19:59 +08:00
|
|
|
# RUN: .text : { *(.text) } \
|
2017-03-02 09:50:34 +08:00
|
|
|
# RUN: }" > %t.script
|
2017-03-03 03:19:59 +08:00
|
|
|
# RUN: ld.lld -T %t.script -o %t.so %t.o --gc-sections
|
2017-03-02 09:50:34 +08:00
|
|
|
# RUN: llvm-objdump -h %t.so | FileCheck %s
|
|
|
|
|
|
|
|
# CHECK: Idx Name Size Address Type
|
|
|
|
# CHECK-NEXT: 0
|
|
|
|
# CHECK-NEXT: used_in_reloc
|
2017-03-03 03:19:59 +08:00
|
|
|
# CHECK-NEXT: .text
|
2017-03-02 09:50:34 +08:00
|
|
|
# CHECK-NEXT: .comment
|
|
|
|
# CHECK-NEXT: .symtab
|
|
|
|
# CHECK-NEXT: .shstrtab
|
|
|
|
# CHECK-NEXT: .strtab
|
|
|
|
|
2017-03-03 03:19:59 +08:00
|
|
|
.global _start
|
|
|
|
_start:
|
2017-03-02 09:50:34 +08:00
|
|
|
.quad __start_used_in_reloc
|
|
|
|
|
|
|
|
.section unused,"a"
|
|
|
|
.quad 0
|
|
|
|
|
|
|
|
.section used_in_script,"a"
|
2017-03-07 02:48:18 +08:00
|
|
|
.quad __start_used_in_script
|
2017-03-02 09:50:34 +08:00
|
|
|
|
|
|
|
.section used_in_reloc,"a"
|
|
|
|
.quad 0
|