[llvm] [TLI Checker] Extend the targets for Linux, macOS and Windows. (PR #114556)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 10:10:40 PDT 2024


================
@@ -0,0 +1,1182 @@
+## This produces a static object that matches expectations for macOS target.
+# RUN: yaml2obj %s -DTYPE=ET_REL -DLABEL=Symbols -DZDAPV=_ZdaPv -o=%t1
+# RUN: llvm-tli-checker --triple=x86_64-apple-darwin %t1 | FileCheck %s
+# RUN: llvm-tli-checker --triple=aarch64-apple-darwin %t1 | FileCheck %s
+#
+## This produces a dynamic object that has _ZdaPvj instead of _ZdaPv.
+# RUN: yaml2obj %s -DTYPE=ET_DYN -DLABEL=DynamicSymbols -DZDAPV=_ZdaPvj -o=%t2
+# RUN: llvm-tli-checker --triple x86_64-apple-darwin %t2 | \
+# RUN:     FileCheck %s --check-prefixes=WRONG_SUMMARY,WRONG_DETAIL \
+# RUN:    --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>"
+# RUN: llvm-tli-checker --triple aarch64-apple-darwin %t2 | \
+# RUN:     FileCheck %s --check-prefixes=WRONG_SUMMARY,WRONG_DETAIL \
+# RUN:    --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>"
+#
+## --report=discrepancy is the default, check we get the same output.
+# RUN: llvm-tli-checker --triple x86_64-apple-darwin %t2 --report=discrepancy | \
+# RUN:     FileCheck %s --check-prefixes=WRONG_SUMMARY,WRONG_DETAIL \
+# RUN:    --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>"
+# RUN: llvm-tli-checker --triple aarch64-apple-darwin %t2 --report=discrepancy | \
+# RUN:     FileCheck %s --check-prefixes=WRONG_SUMMARY,WRONG_DETAIL \
+# RUN:    --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>"
+#
+## --report=summary should not print the details (checked by the
+## implicit-check-not strings).
+# RUN: llvm-tli-checker --triple x86_64-apple-darwin %t2 --report=summary | \
+# RUN:     FileCheck %s --check-prefix=WRONG_SUMMARY \
+# RUN:     --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>"
+# RUN: llvm-tli-checker --triple aarch64-apple-darwin %t2 --report=summary | \
+# RUN:     FileCheck %s --check-prefix=WRONG_SUMMARY \
+# RUN:     --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>"
+#
+## --separate implies --report=summary.
+# RUN: llvm-tli-checker --triple x86_64-apple-darwin %t2 --separate | \
+# RUN:     FileCheck %s --check-prefix=WRONG_SUMMARY \
+# RUN:     --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>"
+# RUN: llvm-tli-checker --triple aarch64-apple-darwin %t2 --separate | \
+# RUN:     FileCheck %s --check-prefix=WRONG_SUMMARY \
+# RUN:     --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>"
+#
+## Verify --dump-tli reports the full set.
+# RUN: llvm-tli-checker --triple x86_64-apple-darwin --dump-tli > %t3.txt
+# RUN: FileCheck %s --check-prefix=AVAIL --input-file %t3.txt
+# RUN: FileCheck %s --check-prefix=UNAVAIL --input-file %t3.txt
+# RUN: llvm-tli-checker --triple aarch64-apple-darwin --dump-tli > %t3.txt
+# RUN: FileCheck %s --check-prefix=AVAIL --input-file %t3.txt
+# RUN: FileCheck %s --check-prefix=UNAVAIL --input-file %t3.txt
+#
+# CHECK: << Total TLI yes SDK no:  18
+# CHECK: >> Total TLI no  SDK yes: 0
+# CHECK: == Total TLI yes SDK yes: 271
+#
+# WRONG_DETAIL: << TLI yes SDK no : '_ZdaPv' aka operator delete[](void*)
+# WRONG_DETAIL: >> TLI no  SDK yes: '_ZdaPvj' aka operator delete[](void*, unsigned int)
+# WRONG_DETAIL-COUNT-8: << TLI yes SDK no : {{.*}}__hot_cold_t
+# WRONG_DETAIL-COUNT-4: << TLI yes SDK no : '__size_returning_new{{.*}}
+# WRONG_DETAIL: << TLI yes SDK no : 'fmaximum_num'
+# WRONG_DETAIL: << TLI yes SDK no : 'fmaximum_numf'
+# WRONG_DETAIL: << TLI yes SDK no : 'fmaximum_numl'
+# WRONG_DETAIL: << TLI yes SDK no : 'fminimum_num'
+# WRONG_DETAIL: << TLI yes SDK no : 'fminimum_numf'
+# WRONG_DETAIL: << TLI yes SDK no : 'fminimum_numl'
+# WRONG_SUMMARY: << Total TLI yes SDK no:  19{{$}}
+# WRONG_SUMMARY: >> Total TLI no  SDK yes: 1{{$}}
+# WRONG_SUMMARY: == Total TLI yes SDK yes: 270
+#
+## The -COUNT suffix doesn't care if there are too many matches, so check
+## the exact count first; the two directives should add up to that.
+## Yes, this means additions to TLI will fail this test, but the argument
+## to -COUNT can't be an expression.
+# AVAIL: TLI knows 522 symbols, 289 available
+# AVAIL-COUNT-289: {{^}} available
+# AVAIL-NOT:       {{^}} available
+# UNAVAIL-COUNT-233: not available
+# UNAVAIL-NOT:       not available
+
+## This is a large file so it's worth telling lit to stop here.
+# END.
+
+--- !ELF
+FileHeader:
+    Class:           ELFCLASS64
+    Data:            ELFDATA2LSB
+    OSABI:           ELFOSABI_FREEBSD
+    Type:            ET_DYN
+    Machine:         EM_X86_64
+Sections:
+  - Name:            .text
+    Type:            SHT_PROGBITS
+DynamicSymbols:
+# This is an undefined symbol that is known to TLI but not in the
+# available set for PS4, showing the tool will ignore undefined symbols.
+# Omitting the Section attribute makes it undefined.
+  - Name:            memcpy_chk
+    Type:            STT_FUNC
+    Binding:         STB_GLOBAL
+# This will be either _ZdaPv or _ZdaPvj (see yaml2obj invocations above).
+  - Name:            [[ZDAPV]]
+    Type:            STT_FUNC
+    Section:         .text
+    Binding:         STB_GLOBAL
+# The rest of these are the remaining symbols needed for PS4.
----------------
arsenm wrote:

Copy paste comment 

https://github.com/llvm/llvm-project/pull/114556


More information about the llvm-commits mailing list