Index: llvm/test/tools/llvm-tli-checker/ps4-tli-check.s =================================================================== --- llvm/test/tools/llvm-tli-checker/ps4-tli-check.s +++ /dev/null @@ -1,291 +0,0 @@ -# REQUIRES: x86-registered-target -# -## The object files ps4-tli-checks.right.so and ps4-tli-checks.wrong.so -## were generated with the following commands: -## llvm-mc --triple=x86_64-scei-ps4 --filetype=obj ps4-tli-check.s -o t.o -## ld.lld --shared t.o -o Inputs/ps4-tli-check.right.so -## llvm-mc --triple=x86_64-scei-ps4 --defsym WRONG=1 --filetype=obj ps4-tli-check.s -o t2.o -## ld.lld --shared t2.o -o Inputs/ps4-tli-check.wrong.so -# -# RUN: llvm-tli-checker --triple=x86_64-scei-ps4 %S/Inputs/ps4-tli-check.right.so | FileCheck %s -# -# RUN: echo %S/Inputs/ps4-tli-check.wrong.so > %t2.txt -# RUN: llvm-tli-checker --triple x86_64-scei-ps4 @%t2.txt | \ -# RUN: FileCheck %s --check-prefix=WRONG_SUMMARY --check-prefix=WRONG_DETAIL \ -# RUN: --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>" -# RUN: llvm-tli-checker --triple x86_64-scei-ps4 @%t2.txt --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-scei-ps4 @%t2.txt --separate | \ -# RUN: FileCheck %s --check-prefix=WRONG_SUMMARY \ -# RUN: --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>" -# -# RUN: llvm-tli-checker --triple x86_64-scei-ps4 --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: 0 -# CHECK: >> Total TLI no SDK yes: 0 -# CHECK: == Total TLI yes SDK yes: 235 -# -# WRONG_DETAIL: << TLI yes SDK no : '_ZdaPv' -# WRONG_DETAIL: >> TLI no SDK yes: '_ZdaPvj' -# WRONG_SUMMARY: << Total TLI yes SDK no: 1{{$}} -# WRONG_SUMMARY: >> Total TLI no SDK yes: 1{{$}} -# WRONG_SUMMARY: == Total TLI yes SDK yes: 234 -# -## 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. -# AVAIL: TLI knows 466 symbols, 235 available -# AVAIL-COUNT-235: {{^}} available -# UNAVAIL-COUNT-231: not available - -.macro defname name -.globl \name -.type \name ,@function -\name : nop -.endm - -.text -# For the WRONG case, omit _ZdaPv and include _ZdaPvj. -.ifdef WRONG -defname _ZdaPvj -.else -defname _ZdaPv -.endif -defname _ZdaPvRKSt9nothrow_t -defname _ZdaPvSt11align_val_t -defname _ZdaPvSt11align_val_tRKSt9nothrow_t -defname _ZdaPvm -defname _ZdaPvmSt11align_val_t -defname _ZdlPv -defname _ZdlPvRKSt9nothrow_t -defname _ZdlPvSt11align_val_t -defname _ZdlPvSt11align_val_tRKSt9nothrow_t -defname _ZdlPvm -defname _ZdlPvmSt11align_val_t -defname _Znam -defname _ZnamRKSt9nothrow_t -defname _ZnamSt11align_val_t -defname _ZnamSt11align_val_tRKSt9nothrow_t -defname _Znwm -defname _ZnwmRKSt9nothrow_t -defname _ZnwmSt11align_val_t -defname _ZnwmSt11align_val_tRKSt9nothrow_t -defname __cxa_atexit -defname __cxa_guard_abort -defname __cxa_guard_acquire -defname __cxa_guard_release -defname abs -defname acos -defname acosf -defname acosh -defname acoshf -defname acoshl -defname acosl -defname aligned_alloc -defname asin -defname asinf -defname asinh -defname asinhf -defname asinhl -defname asinl -defname atan -defname atan2 -defname atan2f -defname atan2l -defname atanf -defname atanh -defname atanhf -defname atanhl -defname atanl -defname atof -defname atoi -defname atol -defname atoll -defname calloc -defname cbrt -defname cbrtf -defname cbrtl -defname ceil -defname ceilf -defname ceill -defname clearerr -defname copysign -defname copysignf -defname copysignl -defname cos -defname cosf -defname cosh -defname coshf -defname coshl -defname cosl -defname exp -defname exp2 -defname exp2f -defname exp2l -defname expf -defname expl -defname expm1 -defname expm1f -defname expm1l -defname fabs -defname fabsf -defname fabsl -defname fclose -defname fdopen -defname feof -defname ferror -defname fflush -defname fgetc -defname fgetpos -defname fgets -defname fileno -defname floor -defname floorf -defname floorl -defname fmax -defname fmaxf -defname fmaxl -defname fmin -defname fminf -defname fminl -defname fmod -defname fmodf -defname fmodl -defname fopen -defname fprintf -defname fputc -defname fputs -defname fread -defname free -defname frexp -defname frexpf -defname frexpl -defname fscanf -defname fseek -defname fsetpos -defname ftell -defname fwrite -defname getc -defname getchar -defname gets -defname isdigit -defname labs -defname ldexp -defname ldexpf -defname ldexpl -defname llabs -defname log -defname log10 -defname log10f -defname log10l -defname log1p -defname log1pf -defname log1pl -defname log2 -defname log2f -defname log2l -defname logb -defname logbf -defname logbl -defname logf -defname logl -defname malloc -defname memalign -defname memchr -defname memcmp -defname memcpy -defname memmove -defname memset -defname mktime -defname modf -defname modff -defname modfl -defname nearbyint -defname nearbyintf -defname nearbyintl -defname perror -defname posix_memalign -defname pow -defname powf -defname powl -defname printf -defname putc -defname putchar -defname puts -defname qsort -defname realloc -defname remainder -defname remainderf -defname remainderl -defname remove -defname rewind -defname rint -defname rintf -defname rintl -defname round -defname roundf -defname roundl -defname scanf -defname setbuf -defname setvbuf -defname sin -defname sinf -defname sinh -defname sinhf -defname sinhl -defname sinl -defname snprintf -defname sprintf -defname sqrt -defname sqrtf -defname sqrtl -defname sscanf -defname strcasecmp -defname strcat -defname strchr -defname strcmp -defname strcoll -defname strcpy -defname strcspn -defname strdup -defname strlen -defname strncasecmp -defname strncat -defname strncmp -defname strncpy -defname strpbrk -defname strrchr -defname strspn -defname strstr -defname strtod -defname strtof -defname strtok -defname strtok_r -defname strtol -defname strtold -defname strtoll -defname strtoul -defname strtoull -defname strxfrm -defname tan -defname tanf -defname tanh -defname tanhf -defname tanhl -defname tanl -defname trunc -defname truncf -defname truncl -defname ungetc -defname vfprintf -defname vfscanf -defname vprintf -defname vscanf -defname vsnprintf -defname vsprintf -defname vsscanf -defname wcslen - Index: llvm/test/tools/llvm-tli-checker/ps4-tli-check.yaml =================================================================== --- /dev/null +++ llvm/test/tools/llvm-tli-checker/ps4-tli-check.yaml @@ -0,0 +1,1004 @@ +# REQUIRES: x86-registered-target +# +## This produces the object that matches expectations for PS4. +# RUN: yaml2obj %s -DZDAPV=_ZdaPv -o=%t1 +# RUN: llvm-tli-checker --triple=x86_64-scei-ps4 %t1 | FileCheck %s +# +## This produces an object that has _ZdaPvj instead of _ZdaPv. +# RUN: yaml2obj %s -DZDAPV=_ZdaPvj -o=%t2 +# RUN: echo %t2 > %t2.txt +# RUN: llvm-tli-checker --triple x86_64-scei-ps4 @%t2.txt | \ +# RUN: FileCheck %s --check-prefixes=WRONG_SUMMARY,WRONG_DETAIL \ +# RUN: --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>" +# +# RUN: llvm-tli-checker --triple x86_64-scei-ps4 @%t2.txt --report=summary | \ +# RUN: FileCheck %s --check-prefix=WRONG_SUMMARY \ +# RUN: --implicit-check-not="==" --implicit-check-not="<<" --implicit-check-not=">>" +## --separate implies --report=summary. +## Also use a response file to show we support that. +# RUN: llvm-tli-checker --triple x86_64-scei-ps4 @%t2.txt --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-scei-ps4 --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: 0 +# CHECK: >> Total TLI no SDK yes: 0 +# CHECK: == Total TLI yes SDK yes: 235 +# +# 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_SUMMARY: << Total TLI yes SDK no: 1{{$}} +# WRONG_SUMMARY: >> Total TLI no SDK yes: 1{{$}} +# WRONG_SUMMARY: == Total TLI yes SDK yes: 234 +# +## 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. +# AVAIL: TLI knows 466 symbols, 235 available +# AVAIL-COUNT-235: {{^}} available +# UNAVAIL-COUNT-231: not available + + +--- !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. + - Name: _ZdaPvRKSt9nothrow_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdaPvSt11align_val_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdaPvSt11align_val_tRKSt9nothrow_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdaPvm + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdaPvmSt11align_val_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdlPv + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdlPvRKSt9nothrow_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdlPvSt11align_val_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdlPvSt11align_val_tRKSt9nothrow_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdlPvm + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZdlPvmSt11align_val_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _Znam + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZnamRKSt9nothrow_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZnamSt11align_val_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZnamSt11align_val_tRKSt9nothrow_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _Znwm + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZnwmRKSt9nothrow_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZnwmSt11align_val_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: _ZnwmSt11align_val_tRKSt9nothrow_t + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: __cxa_atexit + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: __cxa_guard_abort + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: __cxa_guard_acquire + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: __cxa_guard_release + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: abs + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: acos + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: acosf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: acosh + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: acoshf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: acoshl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: acosl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: aligned_alloc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: asin + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: asinf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: asinh + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: asinhf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: asinhl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: asinl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atan + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atan2 + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atan2f + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atan2l + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atanf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atanh + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atanhf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atanhl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atanl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atof + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atoi + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atol + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: atoll + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: calloc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: cbrt + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: cbrtf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: cbrtl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: ceil + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: ceilf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: ceill + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: clearerr + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: copysign + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: copysignf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: copysignl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: cos + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: cosf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: cosh + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: coshf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: coshl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: cosl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: exp + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: exp2 + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: exp2f + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: exp2l + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: expf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: expl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: expm1 + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: expm1f + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: expm1l + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fabs + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fabsf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fabsl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fclose + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fdopen + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: feof + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: ferror + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fflush + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fgetc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fgetpos + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fgets + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fileno + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: floor + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: floorf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: floorl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fmax + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fmaxf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fmaxl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fmin + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fminf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fminl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fmod + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fmodf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fmodl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fopen + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fprintf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fputc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fputs + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fread + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: free + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: frexp + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: frexpf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: frexpl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fscanf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fseek + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fsetpos + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: ftell + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: fwrite + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: getc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: getchar + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: gets + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: isdigit + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: labs + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: ldexp + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: ldexpf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: ldexpl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: llabs + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log10 + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log10f + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log10l + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log1p + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log1pf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log1pl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log2 + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log2f + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: log2l + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: logb + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: logbf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: logbl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: logf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: logl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: malloc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: memalign + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: memchr + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: memcmp + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: memcpy + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: memmove + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: memset + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: mktime + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: modf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: modff + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: modfl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: nearbyint + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: nearbyintf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: nearbyintl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: perror + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: posix_memalign + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: pow + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: powf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: powl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: printf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: putc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: putchar + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: puts + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: qsort + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: realloc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: remainder + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: remainderf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: remainderl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: remove + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: rewind + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: rint + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: rintf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: rintl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: round + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: roundf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: roundl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: scanf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: setbuf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: setvbuf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sin + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sinf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sinh + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sinhf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sinhl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sinl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: snprintf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sprintf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sqrt + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sqrtf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sqrtl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: sscanf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strcasecmp + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strcat + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strchr + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strcmp + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strcoll + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strcpy + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strcspn + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strdup + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strlen + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strncasecmp + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strncat + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strncmp + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strncpy + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strpbrk + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strrchr + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strspn + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strstr + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strtod + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strtof + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strtok + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strtok_r + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strtol + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strtold + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strtoll + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strtoul + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strtoull + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: strxfrm + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: tan + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: tanf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: tanh + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: tanhf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: tanhl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: tanl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: trunc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: truncf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: truncl + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: ungetc + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: vfprintf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: vfscanf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: vprintf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: vscanf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: vsnprintf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: vsprintf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: vsscanf + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + - Name: wcslen + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL +... Index: llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp =================================================================== --- llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp +++ llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp @@ -39,7 +39,7 @@ #include "Opts.inc" #undef PREFIX -const opt::OptTable::Info InfoTable[] = { +static const opt::OptTable::Info InfoTable[] = { #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \ HELPTEXT, METAVAR, VALUES) \ { \ @@ -55,7 +55,7 @@ public: TLICheckerOptTable() : OptTable(InfoTable) {} }; -} // namespace +} // end anonymous namespace // We have three levels of reporting. enum class ReportKind { @@ -66,13 +66,14 @@ }; // Most of the ObjectFile interfaces return an Expected, so make it easy -// to ignore those. -template T unwrapIgnoreError(Expected E) { +// to ignore errors. +template +static T unwrapIgnoreError(Expected E, T Default = T()) { if (E) return std::move(*E); // Sink the error and return a nothing value. consumeError(E.takeError()); - return T(); + return Default; } static void fail(const Twine &Message) { @@ -99,13 +100,14 @@ } // Return Name, and if Name is mangled, append "aka" and the demangled name. -static std::string PrintableName(StringRef Name) { +static std::string getPrintableName(StringRef Name) { std::string OutputName = "'"; OutputName += Name; OutputName += "'"; - if (Name.startswith("_Z") || Name.startswith("??")) { + std::string DemangledName(demangle(Name.str())); + if (Name != DemangledName) { OutputName += " aka "; - OutputName += demangle(Name.str()); + OutputName += DemangledName; } return OutputName; } @@ -119,7 +121,7 @@ // Print out what we found. void dump(); }; -TLINameList TLINames; +static TLINameList TLINames; void TLINameList::initialize(StringRef TargetTriple) { Triple T(TargetTriple); @@ -146,7 +148,7 @@ // output as a header. So, for example, no need to repeat the triple. for (auto &TLIName : TLINames) { outs() << (TLIName.second ? " " : "not ") - << "available: " << PrintableName(TLIName.first) << '\n'; + << "available: " << getPrintableName(TLIName.first) << '\n'; } } @@ -159,24 +161,27 @@ public: void populateFromFile(StringRef LibDir, StringRef LibName); }; -SDKNameMap SDKNames; +static SDKNameMap SDKNames; // Given an ObjectFile, extract the global function symbols. void SDKNameMap::populateFromObject(ObjectFile *O) { - // FIXME: Support COFF. + // FIXME: Support other formats. if (!O->isELF()) { - WithColor::warning() << "Only ELF-format files are supported\n"; + WithColor::warning() << O->getFileName() + << ": only ELF-format files are supported\n"; return; } - auto *ELF = cast(O); + const auto *ELF = cast(O); - for (auto I = ELF->getDynamicSymbolIterators().begin(); - I != ELF->getDynamicSymbolIterators().end(); ++I) { - // We want only global function symbols. - SymbolRef::Type Type = unwrapIgnoreError(I->getType()); - uint32_t Flags = unwrapIgnoreError(I->getFlags()); - StringRef Name = unwrapIgnoreError(I->getName()); - if (Type == SymbolRef::ST_Function && (Flags & SymbolRef::SF_Global)) + for (auto &S : ELF->getDynamicSymbolIterators()) { + // We want only defined global function symbols. + SymbolRef::Type Type = unwrapIgnoreError(S.getType()); + uint32_t Flags = unwrapIgnoreError(S.getFlags()); + section_iterator Section = unwrapIgnoreError(S.getSection(), + /*Default=*/O->section_end()); + StringRef Name = unwrapIgnoreError(S.getName()); + if (Type == SymbolRef::ST_Function && (Flags & SymbolRef::SF_Global) && + Section != O->section_end()) insert({Name, true}); } } @@ -211,7 +216,7 @@ SmallString<255> Filepath(LibDir); sys::path::append(Filepath, LibName); if (!sys::fs::exists(Filepath)) { - WithColor::warning() << "Could not find '" << StringRef(Filepath) << "'\n"; + WithColor::warning() << StringRef(Filepath) << ": not found\n"; return; } outs() << "\nLooking for symbols in '" << StringRef(Filepath) << "'\n"; @@ -229,13 +234,12 @@ else if (ObjectFile *O = dyn_cast(&Binary)) populateFromObject(O); else { - WithColor::warning() << "Not an Archive or ObjectFile: '" - << StringRef(Filepath) << "'\n"; + WithColor::warning() << StringRef(Filepath) + << ": not an archive or object file\n"; return; } if (Precount == size()) - WithColor::warning() << "No symbols found in '" << StringRef(Filepath) - << "'\n"; + WithColor::warning() << StringRef(Filepath) << ": no symbols found\n"; else outs() << "Found " << size() - Precount << " global function symbols in '" << StringRef(Filepath) << "'\n"; @@ -268,10 +272,8 @@ } std::vector LibList = Args.getAllArgValues(OPT_INPUT); - if (LibList.empty()) { - WithColor::error() << "No input files\n"; - exit(EXIT_FAILURE); - } + if (LibList.empty()) + fail("no input files\n"); StringRef LibDir = Args.getLastArgValue(OPT_libdir_EQ); bool SeparateMode = Args.hasArg(OPT_separate); @@ -283,10 +285,8 @@ .Case("discrepancy", ReportKind::Discrepancy) .Case("full", ReportKind::Full) .Default(ReportKind::Error); - if (ReportLevel == ReportKind::Error) { - WithColor::error() << "invalid option for --report: " << A->getValue(); - exit(EXIT_FAILURE); - } + if (ReportLevel == ReportKind::Error) + fail(Twine("invalid option for --report: ", StringRef(A->getValue()))); } for (size_t I = 0; I < LibList.size(); ++I) { @@ -330,7 +330,8 @@ constexpr char YesNo[2][4] = {"no ", "yes"}; constexpr char Indicator[4][3] = {"!!", ">>", "<<", "=="}; outs() << Indicator[Which] << " TLI " << YesNo[TLIHas] << " SDK " - << YesNo[SDKHas] << ": " << PrintableName(TLIName.first) << '\n'; + << YesNo[SDKHas] << ": " << getPrintableName(TLIName.first) + << '\n'; } }