llvm-capstone/lld/test/ELF/cgprofile-shared-warn.s
Fangrui Song efc0fe5a72 [ELF] Don't warn on two legitimate cases when reading .llvm.call-graph-profile
Summary:
Before, superfluous warnings were emitted for the following two cases:

1) When from symbol was in a discarded section.
  The profile should be thought of as affiliated to the section.
  It makes sense to ignore the profile if the section is discarded.

2) When to symbol was in a shared object.
  The object file containing the profile may not know about the to
  symbol, which can reside in another object file (useful profile) or a
  shared object (not useful as symbols in the shared object are fixed
  and unorderable). It makes sense to ignore the profile from the object
  file.

  Note, the warning when to symbol was undefined was suppressed in
  D53044, which is still useful for --symbol-ordering-file=

This patch silences the warnings. The check is actually more relaxed (no
warnings if either From or To is not Defined) for simplicity and I don't
see a compelling reason to warn on more cases.

Reviewers: ruiu, davidxl, espindola, Bigcheese

Reviewed By: ruiu

Subscribers: emaste, arichardson, llvm-commits

Differential Revision: https://reviews.llvm.org/D53470

llvm-svn: 344974
2018-10-22 23:43:53 +00:00

22 lines
594 B
ArmAsm

# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: ld.lld --shared %t.o -o /dev/null 2>&1 | count 0
# RUN: ld.lld -e A --unresolved-symbols=ignore-all %t.o -o /dev/null 2>&1 | count 0
# RUN: echo '.globl B; B: ret' | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t1.o
# RUN: ld.lld --shared %t1.o -o %t1.so
# RUN: ld.lld -e A %t.o %t1.so -o /dev/null 2>&1 | count 0
# RUN: ld.lld --gc-sections %t.o %t1.so -o /dev/null 2>&1 | count 0
.globl _start
_start:
ret
.section .text.A,"ax",@progbits
.globl A
A:
callq B
.cg_profile A, B, 10