28 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o3# RUN: echo "SECTIONS { \4# RUN: . = SIZEOF_HEADERS; \5# RUN: .keep : { KEEP( INPUT_SECTION_FLAGS(!SHF_WRITE) *(.sec*)) } \6# RUN: }" > %t.script7# RUN: ld.lld --gc-sections -o %t --script %t.script %t.o8# RUN: llvm-readobj --symbols %t | FileCheck %s9 10## Check that INPUT_SECTION_FLAGS can be used within KEEP, and affects what11## is kept.12# CHECK: Name: keep13# CHECK-NOT: NAME: collect14.text15.global _start16_start:17 .long 018 19.section .sec1, "a"20.global keep21keep:22 .long 123 24.section .sec2, "aw"25.global collect26collect:27 .long 228