• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3# RUN: echo "SECTIONS { \
4# RUN:  . = SIZEOF_HEADERS; \
5# RUN:  .keep : { KEEP( INPUT_SECTION_FLAGS(!SHF_WRITE) *(.sec*)) } \
6# RUN:  }" > %t.script
7# RUN: ld.lld --gc-sections -o %t --script %t.script %t.o
8# RUN: llvm-readobj --symbols %t | FileCheck %s
9
10## Check that INPUT_SECTION_FLAGS can be used within KEEP, and affects what
11## is kept.
12# CHECK: Name: keep
13# CHECK-NOT: NAME: collect
14.text
15.global _start
16_start:
17 .long 0
18
19.section .sec1, "a"
20.global keep
21keep:
22 .long 1
23
24.section .sec2, "aw"
25.global collect
26collect:
27 .long 2
28