[all-commits] [llvm/llvm-project] f7669b: [ELF] --save-temps --lto-emit-asm: derive ELF/asm ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Jan 23 11:38:27 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f7669ba3d9443bc95dd63fa25beea13e6265fdc5
      https://github.com/llvm/llvm-project/commit/f7669ba3d9443bc95dd63fa25beea13e6265fdc5
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-01-23 (Tue, 23 Jan 2024)

  Changed paths:
    M lld/ELF/LTO.cpp
    M lld/ELF/LTO.h
    M lld/test/ELF/common-archive-lookup.s
    M lld/test/ELF/lto/cache.ll
    M lld/test/ELF/lto/comdat-mixed-archive.test
    M lld/test/ELF/lto/emit-asm.ll
    M lld/test/ELF/lto/exclude-libs-libcall.ll
    M lld/test/ELF/lto/obj-path.ll
    M lld/test/ELF/lto/parallel-internalize.ll
    M lld/test/ELF/lto/parallel.ll
    M lld/test/ELF/lto/pseudo-probe-lto.ll
    M lld/test/ELF/lto/save-temps-eq.ll
    M lld/test/ELF/lto/thin-archivecollision.ll
    M lld/test/ELF/lto/thinlto.ll

  Log Message:
  -----------
  [ELF] --save-temps --lto-emit-asm: derive ELF/asm file names from bitcode file names

Port COFF's https://reviews.llvm.org/D78221 and
https://reviews.llvm.org/D137217 to ELF. For the in-process ThinLTO
link, `ld.lld --save-temps a.o d/b.o -o out` will create
ELF relocatable files `out.lto.a.o`/`d/out.lto.b.o` instead of
`out1.lto.o`/`out2.lto.o`. Deriving the LTO-generated relocatable file
name from bitcode file names helps debugging.

The relocatable file name from the first regular LTO partition does not
change: `out.lto.o`. The second, if present due to `--lto-partition=`,
changes from `out1.lto.o` to `lto.1.o`.

For an archive member, e.g. `d/a.a(coll.o at 8)`,
the relocatable file is `d/out.lto.a.a(coll.o at 8).o`.

`--lto-emit-asm` file names are changed similarly. `--lto-emit-asm -o
out` now creates `out.lto.s` instead of `out`, therefore the
`--lto-emit-asm -o -` idiom no longer works. However, I think this new
behavior (which matches COFF) is better since keeping or removing
`--lto-emit-asm` will dump different files, instead of overwriting the
`-o` output file from an executable/shared object to an assembly file.

Reviewers: rnk, igorkudrin, xur-llvm, teresajohnson, ZequanWu

Reviewed By: teresajohnson

Pull Request: https://github.com/llvm/llvm-project/pull/78835




More information about the All-commits mailing list