[PATCH] D96035: [dsymutil][DWARFlinker] implement separate multi-thread processing for compile units.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 16:13:14 PST 2022


clayborg added a comment.

So I am currently just looking at the content of the DWARF that is produced when using "--use-dlnext". Right now the main issue is it seems that types declared in an anonymous namespace in implementation files are all being moved to the "__type_table" die:

  0x0000000b: DW_TAG_compile_unit
                DW_AT_producer	("DWARFLinker lib")
                DW_AT_language	(DW_LANG_C_plus_plus_14)
                DW_AT_name	("__type_table")
                DW_AT_stmt_list	(0x00000000)
                DW_AT_comp_dir	("")

One quick example is LVBase from APValue.cpp line 165:

  namespace {
    struct LVBase {
      APValue::LValueBase Base;
      CharUnits Offset;
      unsigned PathLength;
      bool IsNullPtr : 1;
      bool IsOnePastTheEnd : 1;
    };
  }

Which produces a type in the "__type_table" compile unit:

  0x000000a6:   DW_TAG_namespace
                  DW_AT_decl_file	("/Users/gclayton/Documents/src/lldb/clean/Debug/lib/libclangAST.a(APValue.cpp.o)")
  
  0x000000a9:     DW_TAG_structure_type
                    DW_AT_calling_convention	(DW_CC_pass_by_value)
                    DW_AT_name	("LVBase")
                    DW_AT_byte_size	(0x20)
                    DW_AT_decl_file	("/Users/gclayton/Documents/src/lldb/clean/llvm-project/clang/lib/AST/APValue.cpp")
                    DW_AT_decl_line	(166)
  
  0x000000b3:       DW_TAG_subprogram
                      DW_AT_name	("LVBase")
                      DW_AT_declaration	(true)
                      DW_AT_artificial	(true)
                      DW_AT_external	(true)

I would think we should leave these types in the original compile unit as that will be the only compile unit that will use these types. Right now you are moving them to the "__type_table" compile unit so they can be uniqued, but they don't need to be uniqued. This is pretty C++ specific though.

The namespace also has the object file path as the decl file. If we are going to move the type, wouldn't it be better to use the compile unit's path like:

  0x000000a6:   DW_TAG_namespace
                  DW_AT_decl_file	("/Users/gclayton/Documents/src/lldb/clean/llvm-project/clang/lib/AST/APValue.cpp")


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96035/new/

https://reviews.llvm.org/D96035



More information about the llvm-commits mailing list