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

61 lines
1.3 KiB
Plaintext

# RUN: lld -core --dead-strip --keep-globals %s | FileCheck -check-prefix=CHK1 %s
# RUN: lld -core --dead-strip %s | FileCheck -check-prefix=CHK2 %s
#
# Test that -keep-globals prevents -dead-strip from removing globals.
#
---
defined-atoms:
- name: entry
dead-strip: never
references:
- offset: 1
kind: pcrel32
target: bar
- offset: 6
kind: pcrel32
target: baz
- name: myglobal1
scope: global
undefined-atoms:
- name: bar
- name: baz
---
defined-atoms:
- name: myglobal2
scope: global
type: data
- name: bar
scope: hidden
type: data
---
defined-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: ...