[all-commits] [llvm/llvm-project] d09865: [LLD] [COFF] Preserve directives and export names ...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Sat Jan 20 06:15:56 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d0986519d58e6d71656019cfa6604efa4bf6d3e7
      https://github.com/llvm/llvm-project/commit/d0986519d58e6d71656019cfa6604efa4bf6d3e7
  Author: Martin Storsjö <martin at martin.st>
  Date:   2024-01-20 (Sat, 20 Jan 2024)

  Changed paths:
    M lld/COFF/InputFiles.cpp
    A lld/test/COFF/Inputs/lto-directives.obj
    A lld/test/COFF/lto-directives.test

  Log Message:
  -----------
  [LLD] [COFF] Preserve directives and export names from LTO objects (#78802)

The export names are saved as StringRefs pointing into the COFF
directives. In the case of LTO objects, this can be memory allocated
that is owned by the LTO InputFile, which gets destructed when doing the
compilation.

In the case of LTO objects from an older version of LLVM, which require
being upgraded when loaded, the directives string gets destructed, while
when using LTO objects of a matching version (the common case), the
directives string points into memory that doesn't get destructed on LTO
compilation.

Test this by linking a bundled binary LTO object file, from an older
version of LLVM.

This fixes issue #78591, and downstream issue
https://github.com/mstorsjo/llvm-mingw/issues/392.




More information about the All-commits mailing list