llvm-project/lld/test/dead-strip-globals.objtxt

63 lines
1.3 KiB
Plaintext

# RUN: lld-core -dead-strip -keep-globals=true %s | FileCheck -check-prefix=CHK1 %s
# RUN: lld-core -dead-strip -keep-globals=false %s | FileCheck -check-prefix=CHK2 %s
#
# Test that -keep-globals prevents -dead-strip from removing globals.
#
---
atoms:
- name: entry
dead-strip: never
fixups:
- offset: 1
kind: pcrel32
target: bar
- offset: 6
kind: pcrel32
target: baz
- name: myglobal1
scope: global
- name: bar
definition: undefined
- name: baz
definition: undefined
---
atoms:
- name: myglobal2
scope: global
type: data
- name: bar
scope: hidden
type: data
---
atoms:
- name: baz
scope: hidden
type: code
- name: mydead
type: code
...
# CHK1: name: entry
# CHK1: name: myglobal1
# CHK1: name: myglobal2
# CHK1: name: bar
# CHK1: name: baz
# CHK1-NOT: name: mydead
# CHK1: ...
# CHK2: name: entry
# CHK2-NOT: name: myglobal1
# CHK2-NOT: name: myglobal2
# CHK2: name: bar
# CHK2: name: baz
# CHK2-NOT: name: mydead
# CHK2: ...