Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cg_llvm: split dwarf support #77117

Merged
merged 10 commits into from
Dec 16, 2020
Merged

Commits on Dec 16, 2020

  1. llvm: update ffi bindings for split dwarf

    This commit modifies the FFI bindings to LLVM required for Split DWARF
    support in rustc. In particular:
    
    - `addPassesToEmitFile`'s wrapper, `LLVMRustWriteOutputFile` now takes
      a `DwoPath` `const char*`. When disabled, `nullptr` should be provided
      which will preserve existing behaviour. When enabled, the path to the
      `.dwo` file should be provided.
    - `createCompileUnit`'s wrapper, `LLVMRustDIBuilderCreateCompileUnit`
      now has two additional arguments, for the `DWOId` and to enable
      `SplitDebugInlining`. `DWOId` should always be zero.
    - `createTargetMachine`'s wrapper, `LLVMRustCreateTargetMachine` has an
      additional argument which should be provided the path to the `.dwo`
      when enabled.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    341aa97 View commit details
    Browse the repository at this point in the history
  2. session: add split-dwarf flag

    This commit adds a flag for Split DWARF, which enables debuginfo to be
    split into multiple files.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    57d05d3 View commit details
    Browse the repository at this point in the history
  3. cg_ssa: correct documentation comments

    This commit changes some comments to documentation comments so that
    they can be read on the generated rustdoc.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    cf49c2a View commit details
    Browse the repository at this point in the history
  4. cg_ssa: introduce TargetMachineFactoryFn alias

    This commit removes the `TargetMachineFactory` struct and adds a
    `TargetMachineFactoryFn` type alias which is used everywhere that the
    previous, long type was used.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    6890312 View commit details
    Browse the repository at this point in the history
  5. bootstrap: copy llvm-dwp to sysroot

    `llvm-dwp` is required for linking the DWARF objects into DWARF packages
    when using Split DWARF, especially given that rustc produces multiple
    DWARF objects (one for each codegen unit).
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    241160d View commit details
    Browse the repository at this point in the history
  6. cg_llvm: implement split dwarf support

    This commit implements Split DWARF support, wiring up the flag (added in
    earlier commits) to the modified FFI wrapper (also from earlier
    commits).
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    e3fdae9 View commit details
    Browse the repository at this point in the history
  7. cg_clif: fix build with split dwarf

    This commit makes minor changes to the cranelift backend so that it can
    build given changes in cg_ssa for Split DWARF.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    6c4350d View commit details
    Browse the repository at this point in the history
  8. tests: add run-make-fulldeps split-dwarf test

    This commit adds a run-make-fulldeps test which checks that a DWARF
    package file is emitted.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    2b22670 View commit details
    Browse the repository at this point in the history
  9. compiletest: add split dwarf compare mode

    This commit adds a Split DWARF compare mode to compiletest so that
    debuginfo tests are also tested using Split DWARF in split mode (and
    manually in single mode).
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    99ad915 View commit details
    Browse the repository at this point in the history
  10. cg_llvm: split dwarf filename and comp dir

    llvm-dwp concatenates `DW_AT_comp_dir` with `DW_AT_GNU_dwo_name` (only
    when `DW_AT_comp_dir` exists), which can result in it failing to find
    the DWARF object files.
    
    In earlier testing, `DW_AT_comp_dir` wasn't present in the final
    object and the current directory was the output directory.
    
    When running tests through compiletest, the working directory of the
    compilation is different from output directory and that resulted in
    `DW_AT_comp_dir` being in the object file (and set to the current
    working directory, rather than the output directory), and
    `DW_AT_GNU_dwo_name` being set to the full path (rather than just
    the filename), so llvm-dwp was failing.
    
    This commit changes the compilation directory provided to LLVM to match
    the output directory, where DWARF objects are output; and ensures that
    only the filename is used for `DW_AT_GNU_dwo_name`.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Dec 16, 2020
    Configuration menu
    Copy the full SHA
    ee073b5 View commit details
    Browse the repository at this point in the history