1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/tools/llvm-objcopy
Jordan Rupprecht d23e0bcdb9 [llvm-objcopy] Make removeSectionReferences batched
Summary:
Removing a large number of sections from a file with a lot of symbols can have abysmal (i.e. O(n^2)) performance, e.g. when running `--only-section` to extract one section out of a large file.

This comes from iterating over all symbols in the symbol table each time we remove a section, to remove references to the section we just removed.
Instead, do just one pass of symbol removal by passing a hash set of all the sections we'd like to remove references to.

This fixes a regression when running llvm-objcopy -j <one section> on an object file with many sections and symbols -- on my machine, running `objcopy -j .keep_me huge-input.o /tmp/foo.o` takes .3s with GNU objcopy, 1.3s with an updated llvm-objcopy, and 7+ minutes with llvm-objcopy prior to this patch.

Reviewers: MaskRay, jhenderson, jakehehrlich, alexshap, espindola

Reviewed By: MaskRay, jhenderson

Subscribers: echristo, emaste, arichardson, mgrang, jdoerfert, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58296

llvm-svn: 354597
2019-02-21 16:45:42 +00:00
..
COFF [llvm-objcopy] Add --strip-unneeded-symbol(s) 2019-02-13 07:34:54 +00:00
ELF [llvm-objcopy] Make removeSectionReferences batched 2019-02-21 16:45:42 +00:00
MachO Update new files added to llvm-objcopy to use the new file header. 2019-02-11 08:25:19 +00:00
Buffer.cpp [llvm-objcopy] Fix crash when writing empty binary output 2019-01-28 15:02:40 +00:00
Buffer.h [llvm-objcopy] Fix crash when writing empty binary output 2019-01-28 15:02:40 +00:00
CMakeLists.txt [llvm-objcopy] Add ability to copy MachO object files 2019-02-02 00:38:07 +00:00
CopyConfig.cpp [llvm-objcopy] Add --strip-unneeded-symbol(s) 2019-02-13 07:34:54 +00:00
CopyConfig.h [llvm-objcopy] Add --strip-unneeded-symbol(s) 2019-02-13 07:34:54 +00:00
llvm-objcopy.cpp Small refactoring of FileError. NFC. 2019-02-11 09:49:37 +00:00
llvm-objcopy.h Small refactoring of FileError. NFC. 2019-02-11 09:49:37 +00:00
LLVMBuild.txt
ObjcopyOpts.td [llvm-objcopy] Add --strip-unneeded-symbol(s) 2019-02-13 07:34:54 +00:00
StripOpts.td [llvm-objcopy] Allow regular expressions in name comparison 2019-02-06 11:00:07 +00:00