[all-commits] [llvm/llvm-project] d4a141: Switch over to using the LLVM archive parser for B...

Greg Clayton via All-commits all-commits at lists.llvm.org
Tue Sep 5 16:54:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4a141ef932a596df61581090b70d0b546de68b2
      https://github.com/llvm/llvm-project/commit/d4a141ef932a596df61581090b70d0b546de68b2
  Author: Greg Clayton <gclayton at fb.com>
  Date:   2023-09-05 (Tue, 05 Sep 2023)

  Changed paths:
    M lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
    M lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
    M lldb/test/API/functionalities/archives/TestBSDArchives.py
    M lldb/test/API/functionalities/archives/b.c
    M lldb/test/API/functionalities/archives/c.c

  Log Message:
  -----------
  Switch over to using the LLVM archive parser for BSD archives.

Our LLDB parser didn't correctly handle archives of all flavors on different systems, it currently only correctly handled BSD archives, normal and thin, on macOS, but I noticed that it was getting incorrect information when decoding a variety of archives on linux. There were subtle changes to how names were encoded that we didn't handle correctly and we also didn't set the result of GetObjectSize() correctly as there was some bad math. This didn't matter when exracting .o files from .a files for LLDB because the size was always way too big, but it was big enough to at least read enough bytes for each object within the archive.

This patch does the following:
- switch over to use LLVM's archive parser and avoids previous code duplication
- remove values from ObjectContainerBSDArchive::Object that we don't use like:
  - uid
  - gid
  - mode
- fix ths ObjectContainerBSDArchive::Object::file_size value to be correct
- adds tests to test that we get the correct module specifications

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




More information about the All-commits mailing list