On Sun, Sep 10, 2017 at 2:11 PM, Ian Lance Taylor wrote: > On Sat, Jul 29, 2017 at 1:42 PM, Denis Khalikov > wrote: >> >> Hello Ian, >> thanks for review. >> I've updated the patch, can you please take a look. > > Apologies again for the length of time it took to reply. I've had a > hard time understanding the patch. It's quite likely that I don't > understand how it works, but it seems to pass the same file descriptor > to process_elf_header twice. It seems to look for debug files with > the buildid in places where they will not be found. It seems to work > out the file name a second time, even though the file name must > already be known. I eventually just wrote my own implementation. > > Could you try this patch and see if it works for your cases? The > patch is against current mainline. Thanks. I have committed this patch as appended. Bootstrapped and tested on x86_64-pc-linux-gnu. Ian 2017-09-20 Ian Lance Taylor Denis Khalikov PR sanitizer/77631 Support for external debug info. * elf.c: Include , , . (S_ISLNK): Define if not defined. (xstrnlen): Define if strnlen is not available. (b_elf_note): Define type. (NT_GNU_BUILD_ID): Define macro. (elf_crc32, elf_crc32_file): New static functions. (elf_is_symlink, elf_readlink): New static functions. (elf_open_debugfile_by_buildid): New static function. (elf_try_debugfile): New static function. (elf_find_debugfile_by_debuglink): New static function. (elf_open_debugfile_by_debuglink): New static function. (elf_add): Add filename and debuginfo parameters. Adjust all callers. Look for external debug info notes, and try to fetch debug info from external file. (struct phdr_data): Add exe_filename field. (phdr_callback): Pass filename to elf_add. (backtrace_initialize): Add filename parameter. * internal.h (backtrace_initialize): Add filename parameter. * fileline.c (fileline_initialize): Pass filename to backtrace_initialize. * pecoff.c (fileline_initialize): Add unused filename parameter. * unknown.c (fileline_initialize): Likewise. * xcoff.c (fileline_initialize): Likewise. * configure.ac: Check for objcopy --add-gnu-debuglink. * Makefile.am (dtest): New test target. * configure, Makefile.in: Rebuild.