| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
| |
The restoreDateOnFile() method used to preserve dates uses sys::fs::openFileForWrite(). That method defaults to opening files with CD_CreateAlways, which truncates the output file if it exists. Use CD_OpenExisting instead to open it and *not* truncate it, which also has the side benefit of erroring if the file does not exist (it should always exist, because we just wrote it out).
Also, fix the test case to make sure the output is a valid output file, and not empty. The extra test assertions are enough to catch this regression.
llvm-svn: 340996
|
|
|
|
| |
llvm-svn: 340241
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Before, llvm-strip accepted a second argument but it would just be ignored.
Reviewers: alexshap, jhenderson, paulsemel
Reviewed By: alexshap
Subscribers: jakehehrlich, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D51004
llvm-svn: 340229
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Port GNU Objcopy -G/--keep-global-symbol(s).
This is slightly different than the already-implemented --globalize-symbol, which marks a symbol as global when copying. When --keep-global-symbol (alias -G) is used, *only* those symbols marked will stay global, and all other globals are demoted to local. (Also note that it doesn't *promote* a symbol to global). Additionally, there is a pluralized version of the flag --keep-global-symbols, which effectively applies --keep-global-symbol for every non-comment in a file.
Reviewers: jakehehrlich, jhenderson, alexshap
Reviewed By: jhenderson
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D50589
llvm-svn: 340105
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The -I (--input-target) and -B (--binary-architecture) flags exist but are currently silently ignored. This adds support for -I binary for architectures i386, x86-64 (and alias i386:x86-64), arm, aarch64, sparc, and ppc (powerpc:common64). This is largely based on D41687.
This is done by implementing an additional subclass of Reader, BinaryReader, which works by interpreting the input file as contents for .data field, sets up a synthetic header, and adds additional sections/symbols (e.g. _binary__tmp_data_txt_start).
Reviewers: jakehehrlich, alexshap, jhenderson, javed.absar
Reviewed By: jhenderson
Subscribers: jyknight, nemanjai, kbarton, fedor.sergeev, jrtc27, kristof.beyls, paulsemel, llvm-commits
Differential Revision: https://reviews.llvm.org/D50343
llvm-svn: 340070
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: [llvm-strip] Preserve access/modification timestamps when -p is used.
Reviewers: jakehehrlich, jhenderson, alexshap
Reviewed By: jhenderson
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D50744
llvm-svn: 339921
|
|
|
|
| |
llvm-svn: 339616
|
|
|
|
| |
llvm-svn: 339404
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D50381
llvm-svn: 339362
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D49979
llvm-svn: 339358
|
|
|
|
| |
llvm-svn: 338752
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Add support for --rename-section flags from gnu objcopy.
Not all flags appear to have an effect for ELF objects, but allowing them would allow easier drop-in replacement. Other unrecognized flags are rejected.
This was only tested by comparing flags printed by "readelf -e <.o>" against the output of gnu vs llvm objcopy, it hasn't been tested to be valid beyond that.
Reviewers: jakehehrlich, alexshap
Subscribers: llvm-commits, paulsemel, alexshap
Differential Revision: https://reviews.llvm.org/D49870
llvm-svn: 338582
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
See binutils-gdb/bfd/elf.c, GNU objcopy also strips .stab* (STABS)
.line* (DWARF 1) .gnu.linkonce.wi.* (linkonce section for .debug_info) but
I'm not sure we need to be compatible with it.
Reviewers: dblaikie, alexshap, jakehehrlich, jhenderson
Reviewed By: alexshap, jakehehrlich
Subscribers: aprantl, JDevlieghere, jakehehrlich, llvm-commits
Differential Revision: https://reviews.llvm.org/D50100
llvm-svn: 338443
|
|
|
|
|
|
| |
This behavior matches GNU objcopy.
llvm-svn: 338173
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
These two cases will trigger a dereference on a nullptr, since the
SymbolTable can be nonexistent for a given library, in addition to just
being empty.
Reviewers: alexshap
Reviewed By: alexshap
Subscribers: meikeb, kongyi, chh, jakehehrlich, llvm-commits, pirama
Differential Revision: https://reviews.llvm.org/D49534
llvm-svn: 338062
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Add basic support for --rename-section=old=new to llvm-objcopy.
A full replacement for GNU objcopy requires also modifying flags (i.e. --rename-section=old=new,flag1,flag2); I'd like to keep that in a separate change to keep this simple.
Reviewers: jakehehrlich, alexshap
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49576
llvm-svn: 337604
|
|
|
|
|
|
|
|
|
|
| |
Nest any classes not used outside of a file into anon. Nest any classes used
across files in llvm-objcopy into namespace llvm::objcopy.
Differential Revision: https://reviews.llvm.org/D49449
llvm-svn: 337337
|
|
|
|
|
|
|
|
| |
Anywhere in tools/llvm-objcopy where functions or classes are not referenced
outside of a given file, we change things to make the function or class static
or put inside an anonymous namespace.
llvm-svn: 337220
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This option appears to have been dropped as part of the refactoring in
r331663. Unfortunately, if we want to use llvm-strip as a drop-in
replacement for strip, this option should still be available.
Reviewers: alexshap
Reviewed By: alexshap
Subscribers: meikeb, kongyi, chh, jakehehrlich, llvm-commits, pirama
Differential Revision: https://reviews.llvm.org/D49226
llvm-svn: 336921
|
|
|
|
|
|
|
|
|
|
|
| |
This diff adds support for handling static libraries
to llvm-objcopy and llvm-strip.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D48413
llvm-svn: 336455
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D47818
llvm-svn: 334182
|
|
|
|
|
|
|
|
|
|
| |
Expose objcopy's --discard-all option in llvm-strip.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D47750
llvm-svn: 334131
|
|
|
|
|
|
|
|
|
| |
This fixes the bug where strip-all option was
leading to a malformed outputted ELF file.
Differential Revision: https://reviews.llvm.org/D47414
llvm-svn: 333772
|
|
|
|
|
|
|
|
|
|
|
| |
This diff implements the option -o
for specifying a file to write the output to.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D47505
llvm-svn: 333693
|
|
|
|
|
|
|
|
| |
This option prevent from removing file symbols while removing symbols.
Differential Revision: https://reviews.llvm.org/D46830
llvm-svn: 333339
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D46896
llvm-svn: 333267
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a small follow-up to the revisions r333117 and r331663.
1. Avoid the name conflicts of the generated variables for prefixes.
2. Apply clang-format -i -style=llvm to llvm-objcopy.cpp once again.
3. Add a test for the flag with double dash.
Test plan: make check-all
llvm-svn: 333120
|
|
|
|
|
|
|
|
|
|
| |
Expose --keep-symbol option in llvm-strip.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D47222
llvm-svn: 333117
|
|
|
|
|
|
|
|
|
|
|
|
| |
If one runs llvm-objcopy --strip-all --keep-symbol foo
and the symbol table indeed contains the symbol "foo"
then it should not be removed.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D47052
llvm-svn: 333008
|
|
|
|
|
|
|
|
| |
There is a use after free I didn't see. Need to investigate.
This reverts commit f7624abeb1f0d012309baf2e78cf2499fbfe5e5f.
llvm-svn: 332925
|
|
|
|
|
|
|
|
| |
This option removes symbols that are not needed by relocations.
Differential Revision: https://reviews.llvm.org/D46896
llvm-svn: 332915
|
|
|
|
|
|
|
|
|
| |
Apply clang-format -i -style=llvm to llvm-objcopy.cpp
NFC.
Test plan: make check-all
llvm-svn: 332693
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This option just keeps being a problem and really needs to be implemented
in some fashion. Implementing it properly requires some kind of
"replaceSectionReference" method because all the existing links need to be
maintained. The desired behavior is just for allocated sections to become
NOBITS but actually implementing that is rather tricky due to the current
design of llvm-objcopy. However converting allocated sections to NOBITS is
just an optimization and not something debuggers need. Debuggers can debug
a stripped executable and take an unstripped executable for that stripped
executable as input. Additionally allocated sections account for a very
small part of debug binaries so this optimization is quite small. I propose
that for the time being we implement this as a NOP so that people can use
llvm-objcopy where they need to, just in a sub-optimal way.
This option has already blocked a lot of people and its currently blocking me.
llvm-svn: 332396
|
|
|
|
|
|
|
|
|
| |
This option permits to explicitly keep the specified
symbol so that it doesn't get removed.
Differential Revision: https://reviews.llvm.org/D46819
llvm-svn: 332356
|
|
|
|
|
|
|
|
|
|
| |
This diff adds support for -remove-section to llvm-strip.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D46567
llvm-svn: 332081
|
|
|
|
| |
llvm-svn: 331924
|
|
|
|
|
|
|
|
|
|
| |
Set the exit code to 1 if no arguments are specified.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D46547
llvm-svn: 331776
|
|
|
|
|
|
|
|
|
|
|
|
| |
llvm-strip is supposed to be a drop-in replacement for binutils strip.
To start the ball rolling this diff adds the initial bits for llvm-strip,
more features will be added incrementally over time.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D46407
llvm-svn: 331663
|
|
|
|
| |
llvm-svn: 331400
|
|
|
|
| |
llvm-svn: 331397
|
|
|
|
| |
llvm-svn: 331070
|
|
|
|
| |
llvm-svn: 331068
|
|
|
|
|
|
|
|
|
|
|
| |
This diff implements --redefine-sym option
for changing the name of a symbol.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D46029
llvm-svn: 330973
|
|
|
|
| |
llvm-svn: 330963
|
|
|
|
|
|
| |
Follow-up for r330685.
llvm-svn: 330686
|
|
|
|
|
|
|
|
|
| |
Add explicit dependency on ObjcopyTableGen
and rerun the tests on Windows.
I will double-check the build bots
and revert this commit if necessary.
llvm-svn: 330685
|
|
|
|
|
|
|
|
|
|
|
| |
We have a few functions that virtually all command wants to run on
process startup/shutdown. This patch adds InitLLVM class to do that
all at once, so that we don't need to copy-n-paste boilerplate code
to each llvm command's main() function.
Differential Revision: https://reviews.llvm.org/D45602
llvm-svn: 330046
|
|
|
|
|
|
|
|
| |
TableGen seems to work differently on windows. I'll need to revert this
This reverts commit 7a153ddea067b24da59f6a66c733d79205969501.
llvm-svn: 329867
|
|
|
|
|
|
|
|
|
| |
Swithces from using the command line library to using TableGen. This will allow
llvm-strip to exist and allow refinements of the command line syntax.
Differential Revision: https://reviews.llvm.org/D44236
llvm-svn: 329863
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the output file is not specified make the modifications in-place
(like binutils objcopy does). In particular, this fixes
the behavior of Clang -gsplit-dwarf (if Clang is configured to use llvm-objcopy),
previously it was creating .dwo files, but still leaving *dwo* sections in
the original binary.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D42873
llvm-svn: 324783
|