[sanitizer] Intercept glibc's argp_parse()
authorIlya Leoshkevich <iii@linux.ibm.com>
Wed, 8 Mar 2023 14:53:33 +0000 (15:53 +0100)
committerIlya Leoshkevich <iii@linux.ibm.com>
Wed, 8 Mar 2023 15:08:19 +0000 (16:08 +0100)
commitcc6b86e175da1cf4fa7de98ee99bb9e55e16ac7d
tree636fe868256a293718d5db0acf1c489a5158c2df
parenta6dd2ce375bbfd7c2ff74a24f8a54805adb59fa1
[sanitizer] Intercept glibc's argp_parse()

Glibc provides the argp_parse() function for parsing command line
arguments [1].

Indicate that argc/argv are read from and arg_index is written to.
Strictly speaking, we also need to indicate that argp is read from,
but this would require describing its layout, and most people use a
static initializer there, so it's not worth the effort.

[1] https://www.gnu.org/software/libc/manual/html_node/Argp.html

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D143330
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/test/sanitizer_common/TestCases/Linux/argp_parse.c [new file with mode: 0644]