bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/30568] New: --dependency-file includes temporary LTO files


From: npopov at redhat dot com
Subject: [Bug ld/30568] New: --dependency-file includes temporary LTO files
Date: Tue, 20 Jun 2023 12:42:01 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30568

            Bug ID: 30568
           Summary: --dependency-file includes temporary LTO files
           Product: binutils
           Version: 2.38
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: npopov at redhat dot com
  Target Milestone: ---

The --dependency-file output currently includes temporary files created by
linker plugins.

CMake 3.27 started making use of this option, which means that those temporary
files are now recorded as dependencies. Of course, the temporary files are
removed after the linker run and as such considered dirty on the next build
system invocation, resulting in all libraries and binaries being rebuilt, even
if none of the inputs changed.

This can be reproduced as follows (where cc=gcc and cc=clang both exhibit the
problem):

echo "int main() { return 0; }" > test.c
cc -flto -c test.c
cc -flto -Wl,--dependency-file=test.dep test.o

The resulting dependency file will include an entry for something like
/tmp/cc2EGrdy.ltrans0.ltrans.o (gcc) or /tmp/lto-llvm-a63ee9.o (clang).

This also happens with -fuse-ld=gold, so this affects both ld.bfd and ld.gold.

I think the right fix for ld.bfd would be to guard the track_dependency_files()
call in
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/ldfile.c;h=4976367bbf03b09df6e5625a676acb309e1f30ea;hb=HEAD#l355
with a !entry->flags.lto_output check. Not sure about ld.gold.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]